Repository navigation
feat(runner): usage-limit detection (TM-977 B1) #1102
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
| name: CLI | |
| on: | |
| pull_request: | |
| paths: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'public/install.sh' | |
| - 'rust-toolchain.toml' | |
| - '.github/workflows/cli.yml' | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'public/install.sh' | |
| - 'rust-toolchain.toml' | |
| - '.github/workflows/cli.yml' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: cli-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: fmt and clippy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 | |
| - run: cargo fmt --all --check | |
| - run: cargo clippy --workspace --all-targets --locked -- -D warnings | |
| - run: cargo clippy -p tmgr-cli --features runner --all-targets --locked -- -D warnings | |
| test: | |
| name: test ${{ matrix.name }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 55 | |
| env: | |
| CARGO_PROFILE_DEV_DEBUG: line-tables-only | |
| TMGR_TEST_REQUIRE_LANDLOCK: ${{ startsWith(matrix.name, 'linux') && '1' || '' }} | |
| TMGR_TEST_REQUIRE_RO_MOUNT: ${{ startsWith(matrix.name, 'linux') && '1' || '' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # macOS slots are scarce and shared with release work: x86_64 runs only on master, Dependabot PRs skip macOS. | |
| include: >- | |
| ${{ fromJSON(github.event.pull_request.user.login == 'dependabot[bot]' | |
| && '[{"name":"linux-x86_64","runner":"ubuntu-latest","target":""},{"name":"linux-aarch64","runner":"ubuntu-24.04-arm","target":""}]' | |
| || github.event_name == 'pull_request' | |
| && '[{"name":"linux-x86_64","runner":"ubuntu-latest","target":""},{"name":"linux-aarch64","runner":"ubuntu-24.04-arm","target":""},{"name":"macos-arm64","runner":"macos-latest","target":""}]' | |
| || '[{"name":"linux-x86_64","runner":"ubuntu-latest","target":""},{"name":"linux-aarch64","runner":"ubuntu-24.04-arm","target":""},{"name":"macos-arm64","runner":"macos-latest","target":""},{"name":"macos-x86_64","runner":"macos-latest","target":"x86_64-apple-darwin"}]') }} | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 | |
| with: | |
| key: ${{ matrix.name }} | |
| - name: allow unprivileged user namespaces | |
| if: startsWith(matrix.name, 'linux') | |
| run: | | |
| if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then | |
| sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
| fi | |
| - name: test | |
| timeout-minutes: 30 | |
| env: | |
| TARGET: ${{ matrix.target }} | |
| TMGR_BUILD_COMMIT: ${{ github.sha }} | |
| run: | | |
| umask 002 | |
| cargo test --workspace --locked --no-fail-fast ${TARGET:+--target "$TARGET"} | |
| - name: test runner feature | |
| timeout-minutes: 20 | |
| env: | |
| TARGET: ${{ matrix.target }} | |
| TMGR_BUILD_COMMIT: ${{ github.sha }} | |
| run: cargo test -p tmgr-cli --features runner --locked ${TARGET:+--target "$TARGET"} |