fix(chain-ops): Reset consecutive_errors
counter to zero after a su…
#452
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Price Feeder & Alarms Dispatcher CI" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
- "dev-*.*" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- "main" | |
- "dev-*.*" | |
paths-ignore: | |
- ".gitignore" | |
- "README.md" | |
concurrency: | |
cancel-in-progress: true | |
group: |- | |
${{ format( | |
'{0}-{1}-{2}', | |
github.ref_name, | |
github.ref_type, | |
github.event_name | |
) }} | |
defaults: | |
run: | |
shell: "sh" | |
env: | |
CARGO_INCREMENTAL: "0" | |
jobs: | |
check_formatting: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- run: |- | |
"cargo" "fmt" --all --check | |
audit_dependencies: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "nolus-protocol/rust-ci-actions/rust_cache@main" | |
with: | |
update_and_cache_toolchains: "true" | |
- uses: "nolus-protocol/rust-ci-actions/audit_dependencies@main" | |
linting: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "nolus-protocol/rust-ci-actions/rust_cache@main" | |
with: | |
update_and_cache_toolchains: "true" | |
- name: "Run clippy" | |
run: |- | |
"cargo" "clippy" --workspace -- -D "warnings" | |
test_encoding_compatibility: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "nolus-protocol/rust-ci-actions/rust_cache@main" | |
with: | |
update_and_cache_toolchains: "true" | |
- name: "Run encoding compatibility tests" | |
run: |- | |
"cargo" "test" --workspace | |
working-directory: "./test-encoding-compatibility" | |
code_coverage: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "nolus-protocol/rust-ci-actions/rust_cache@main" | |
with: | |
update_and_cache_toolchains: "true" | |
- uses: "nolus-protocol/rust-ci-actions/code_coverage@main" | |
test_release_profile: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "nolus-protocol/rust-ci-actions/rust_cache@main" | |
with: | |
update_and_cache_toolchains: "true" | |
- name: "Run tests in release profile" | |
run: |- | |
"cargo" "test" --workspace --release | |
build: | |
runs-on: "ubuntu-latest" | |
needs: | |
- "check_formatting" | |
- "audit_dependencies" | |
- "linting" | |
- "test_encoding_compatibility" | |
- "code_coverage" | |
- "test_release_profile" | |
if: |- | |
github.ref_type == 'tag' | |
strategy: | |
fail-fast: true | |
matrix: | |
package: | |
- "alarms-dispatcher" | |
- "market-data-feeder" | |
# GitHub Actions escaped string evaluation | |
name: "Build image [${{ matrix.package }}]" | |
permissions: | |
packages: write | |
env: | |
container_registry: "ghcr.io" | |
container_repository: "nolus-protocol" | |
package: |- | |
${{ matrix.package }} | |
tag: |- | |
${{ github.ref_name }} | |
steps: | |
- uses: "actions/checkout@v4" | |
- name: "Build image" | |
run: |- | |
set -e | |
"docker" \ | |
"build" \ | |
--build-arg "package=${package}" \ | |
--build-arg "profile=release" \ | |
--build-arg "profile_output_dir=release" \ | |
--file "./Containerfile" \ | |
--pull \ | |
--tag "service" \ | |
--target "service" \ | |
"." | |
- name: "Login at container registry" | |
uses: "docker/login-action@v3" | |
with: | |
registry: |- | |
${{ env.container_registry }} | |
username: |- | |
${{ github.actor }} | |
password: |- | |
${{ secrets.GITHUB_TOKEN }} | |
- name: "Push image to container registry" | |
run: | | |
set -e | |
image_name="${package}" | |
readonly image_name | |
base_url="${container_registry}/${container_repository}" | |
readonly base_url | |
image_url="${base_url}/${image_name}" | |
readonly image_url | |
regex="^[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\$" | |
readonly regex | |
if "grep" -q -s "${regex}" <<-EOF | |
${tag} | |
EOF | |
then | |
"docker" "tag" "service" "${image_url}:latest" | |
"docker" "push" "${image_url}:latest" | |
fi | |
for image_tag in "${tag}" "dev" | |
do | |
"docker" "tag" "service" "${image_url}:${image_tag}" | |
"docker" "push" "${image_url}:${image_tag}" | |
done |