|
| 1 | +# CI for the whole Cargo workspace. Although having two relatively independent |
| 2 | +# crates in this workspace (as they do not get released together, as for example |
| 3 | +# tokio with its sub crates), a PR for a certain CI may report errors in the |
| 4 | +# other workspace members. I think this is unfortunate. I've experimented with |
| 5 | +# CI runs per workspace member but the complexity in the end was not worth it. |
| 6 | +# Instead, it is the right thing that the CI always covers the whole repository |
| 7 | +# and that it is as stable as possible. |
| 8 | + |
| 9 | +name: "Cargo workspace" |
| 10 | + |
| 11 | +# Run on every push (tag, branch) and pull_request |
| 12 | +on: [pull_request, push, workflow_dispatch] |
| 13 | + |
| 14 | +env: |
| 15 | + CARGO_TERM_COLOR: always |
| 16 | + |
| 17 | +jobs: |
| 18 | + integrationtest: |
| 19 | + name: integrationtest |
| 20 | + # No "needs" to make CI faster. |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Check out |
| 24 | + uses: actions/checkout@v3 |
| 25 | + - uses: cachix/install-nix-action@v20 |
| 26 | + with: |
| 27 | + # This channel is only required to invoke "nix-shell". |
| 28 | + # Everything inside that nix-shell will use a pinned version of |
| 29 | + # nixpkgs. |
| 30 | + nix_path: nixpkgs=channel:nixos-23.05 |
| 31 | + - uses: DeterminateSystems/magic-nix-cache-action@main |
| 32 | + - name: Set up cargo cache |
| 33 | + uses: actions/cache@v3 |
| 34 | + continue-on-error: false |
| 35 | + with: |
| 36 | + path: | |
| 37 | + ~/.cargo/bin/ |
| 38 | + ~/.cargo/registry/index/ |
| 39 | + ~/.cargo/registry/cache/ |
| 40 | + ~/.cargo/git/db/ |
| 41 | + integration-test/bins/target/ |
| 42 | + # Hash over Cargo.toml and Cargo.lock, as this might be copied to |
| 43 | + # projects that do not have a Cargo.lock in their repository tree! |
| 44 | + key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }} |
| 45 | + # Have all the "copying into Nix store" messages in a dedicated step for |
| 46 | + # better log visibility. |
| 47 | + - run: cd integration-test && nix-shell --run "echo OK" && cd .. |
| 48 | + # Now, run the actual test. |
| 49 | + - run: cd integration-test && nix-shell --run ./run.sh && cd .. |
0 commit comments