|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: {} |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} |
| 13 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 14 | + |
| 15 | +env: |
| 16 | + CARGO_TERM_COLOR: always |
| 17 | + CARGO_INCREMENTAL: 0 |
| 18 | + |
| 19 | +jobs: |
| 20 | + pre_job: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 24 | + steps: |
| 25 | + - id: skip_check |
| 26 | + uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 |
| 27 | + |
| 28 | + lint: |
| 29 | + name: Lint |
| 30 | + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} |
| 31 | + timeout-minutes: 30 |
| 32 | + needs: pre_job |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Checkout sources |
| 36 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 37 | + |
| 38 | + - name: Install system dependencies |
| 39 | + run: sudo apt-get update && sudo apt-get install -y libcap-dev |
| 40 | + |
| 41 | + - uses: ./.github/actions/use-sccache |
| 42 | + |
| 43 | + - name: Setup Node.js |
| 44 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 45 | + with: |
| 46 | + node-version: 20 |
| 47 | + |
| 48 | + - name: Check formatting |
| 49 | + run: cargo fmt --all --check |
| 50 | + |
| 51 | + - name: Clippy |
| 52 | + run: cargo clippy --all-targets -- -D warnings |
| 53 | + |
| 54 | + - name: Check licenses (THIRD-PARTY) |
| 55 | + run: | |
| 56 | + cargo install --locked cargo-about --features cli |
| 57 | + bash scripts/generate-third-party.sh |
| 58 | + git diff --exit-code THIRD-PARTY || (echo "THIRD-PARTY file is stale. Run 'bash scripts/generate-third-party.sh' and commit." && exit 1) |
| 59 | +
|
| 60 | + test: |
| 61 | + name: Test (${{ matrix.os }}) |
| 62 | + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} |
| 63 | + timeout-minutes: 30 |
| 64 | + needs: pre_job |
| 65 | + runs-on: ${{ matrix.os }} |
| 66 | + strategy: |
| 67 | + fail-fast: false |
| 68 | + matrix: |
| 69 | + os: [ubuntu-latest, macos-latest] |
| 70 | + steps: |
| 71 | + - name: Checkout sources |
| 72 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 73 | + |
| 74 | + - name: Install system dependencies (Linux) |
| 75 | + if: runner.os == 'Linux' |
| 76 | + run: | |
| 77 | + sudo apt-get update && sudo apt-get install -y libcap-dev |
| 78 | + echo "kernel.apparmor_restrict_unprivileged_userns = 0" | sudo tee /etc/sysctl.d/99-userns.conf |
| 79 | + sudo sysctl --system |
| 80 | +
|
| 81 | + - uses: ./.github/actions/use-sccache |
| 82 | + |
| 83 | + - name: Install jj |
| 84 | + run: cargo install --locked --bin jj jj-cli |
| 85 | + |
| 86 | + - name: Run tests |
| 87 | + run: cargo test --all-targets |
0 commit comments