Merge pull request #87 from autonomys/slot-time-fix #233
This file contains hidden or 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
| # This action runs the Rust checks for the repository. | |
| name: Rust | |
| # This action is triggered for every PR, push to `main`, tag, release, merge queue, and manually. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "*" | |
| release: | |
| pull_request: | |
| workflow_dispatch: | |
| merge_group: | |
| concurrency: | |
| group: rust-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Not needed in CI, should make things a bit faster | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| # Prioritise debugging over disk space and build speed | |
| #RUSTFLAGS: -C strip=symbols | |
| RUST_BACKTRACE: full | |
| jobs: | |
| cargo-fmt: | |
| name: cargo-fmt (ubuntu-24.04) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: cargo fmt | |
| run: cargo fmt --all -- --check | |
| cargo-clippy: | |
| name: cargo-clippy (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ | |
| "ubuntu-24.04", | |
| "ubuntu-24.04-arm", | |
| "windows-2025", | |
| "windows-11-arm", | |
| "macos-15", | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| # Some clippy checks require a release build | |
| - name: cargo clippy | |
| run: | | |
| cargo clippy --release --locked --all-features --all-targets -- -D warnings | |
| cargo-build: | |
| name: cargo-build (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ | |
| "ubuntu-24.04", | |
| "ubuntu-24.04-arm", | |
| "windows-2025", | |
| "windows-11-arm", | |
| "macos-15", | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: cargo build | |
| run: | | |
| cargo build --release --locked --all-features --all-targets | |
| cargo-nextest: | |
| name: cargo-nextest (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ | |
| "ubuntu-24.04", | |
| "ubuntu-24.04-arm", | |
| "windows-2025", | |
| "windows-11-arm", | |
| "macos-15", | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| # Don't use the full 6 hours if a test hangs | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@21517c4e721ab8b872d9b8e90828e584dcabe8e2 # 2.56.3 | |
| with: | |
| tool: cargo-nextest | |
| - name: cargo nextest run --locked | |
| run: | | |
| cargo nextest run --locked --all-features | |
| # Run a single OS using cargo-test, just to make sure it works. | |
| cargo-test: | |
| name: cargo-test (ubuntu-24.04) | |
| runs-on: "ubuntu-24.04" | |
| # Don't use the full 6 hours if a test hangs | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: cargo test --locked | |
| run: | | |
| cargo test --locked --all-features | |
| # Runs the chain-alerter process until it sends a startup alert, but with Slack disabled. | |
| # This is useful for testing the chain-alerter process setup and main loop. | |
| # | |
| # This should be kept in sync with the docker.yml `docker-run` job. | |
| cargo-run: | |
| name: cargo-run (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ | |
| "ubuntu-24.04", | |
| "ubuntu-24.04-arm", | |
| "windows-2025", | |
| "windows-11-arm", | |
| "macos-15", | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| # Unfortunately, this doesn't work at the step level on Windows. | |
| defaults: | |
| run: | |
| shell: bash | |
| # Don't use the full 6 hours if this integration test hangs | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: Install ripgrep from crates.io | |
| uses: baptiste0928/cargo-install@b687c656bda5733207e629b50a22bf68974a0305 # v3.3.2 | |
| with: | |
| crate: ripgrep | |
| # Randomly choose between the foundation and labs nodes, then run the integration test, | |
| # checking for the startup alert, but printing all the logs to the console. | |
| - name: cargo run --locked -- --slack=false --test-startup | |
| run: | | |
| ./scripts/check-startup.sh | |
| # This job checks for incorrectly added dependencies, or dependencies that were made unused by code changes. | |
| cargo-unused-deps: | |
| name: cargo-unused-deps (ubuntu-24.04) | |
| # Linux is the fastest OS | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: Install cargo-udeps | |
| uses: taiki-e/install-action@21517c4e721ab8b872d9b8e90828e584dcabe8e2 # 2.56.3 | |
| with: | |
| tool: cargo-udeps | |
| # If this check fails, check the new dependency is actually needed. If it isn't, add an exception to the | |
| # crate: | |
| # <https://github.com/est31/cargo-udeps?tab=readme-ov-file#ignoring-some-of-the-dependencies> | |
| - name: check for unused dependencies | |
| run: | | |
| ./scripts/find-unused-deps.sh | |
| rust-all: | |
| # Hack for buggy GitHub Actions behavior with skipped checks: | |
| # <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks> | |
| if: ${{ always() }} | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - cargo-fmt | |
| - cargo-clippy | |
| - cargo-build | |
| - cargo-nextest | |
| - cargo-test | |
| - cargo-run | |
| - cargo-unused-deps | |
| steps: | |
| - name: Check job statuses | |
| # Another hack is to actually check the status of the dependencies or else it'll fall through | |
| run: | | |
| echo "Checking statuses..." | |
| [[ "${{ needs.cargo-fmt.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-clippy.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-build.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-nextest.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-test.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-run.result }}" == "success" ]] || exit 1 | |
| [[ "${{ needs.cargo-unused-deps.result }}" == "success" ]] || exit 1 |