diff --git a/.github/actions/install-cargo-component/action.yml b/.github/actions/install-cargo-component/action.yml new file mode 100644 index 00000000000..7a23e0673ec --- /dev/null +++ b/.github/actions/install-cargo-component/action.yml @@ -0,0 +1,14 @@ +name: Install cargo-component +description: Install cargo-component using a precompiled binary (taiki-e/install-action). + +# Replaces ad-hoc `cargo install cargo-component --locked || true` calls. The +# precompiled-binary path takes a few seconds vs. several minutes for a source +# install, and we no longer swallow install failures. + +runs: + using: composite + steps: + - name: Install cargo-component + uses: taiki-e/install-action@62b0f2dec647a8e604c6a0fda0e38530180dce20 # v2 + with: + tool: cargo-component diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 2dcfedecb06..207aa37cabc 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -1,6 +1,19 @@ name: Code Style on: pull_request: + paths-ignore: + - 'README.md' + - 'CHANGELOG.md' + - 'CONTRIBUTING.md' + - 'CLAUDE.md' + - 'AGENTS.md' + - 'COVERAGE_PLAN.md' + - 'FEATURE_PARITY.md' + - 'LICENSE-*' + - '*.png' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - 'docs/**' # Pushes to main/staging refresh the rust-cache entries that PR jobs # restore from. PR jobs themselves are restore-only (see `save-if` # on the rust-cache steps below). @@ -8,6 +21,19 @@ on: branches: - main - staging + paths-ignore: + - 'README.md' + - 'CHANGELOG.md' + - 'CONTRIBUTING.md' + - 'CLAUDE.md' + - 'AGENTS.md' + - 'COVERAGE_PLAN.md' + - 'FEATURE_PARITY.md' + - 'LICENSE-*' + - '*.png' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - 'docs/**' permissions: contents: read @@ -94,7 +120,13 @@ jobs: clippy-windows: name: Clippy Windows (${{ matrix.name }}) - if: github.base_ref == 'main' + # Mirror the Linux clippy gating: PR to main runs the full matrix for + # Windows-specific feature coverage, push to main/staging runs only the + # all-features leg to warm the shared cache (which `windows-build` + # used to fill before it was removed from test.yml). + if: > + (github.event_name == 'pull_request' && github.base_ref == 'main') || + (github.event_name == 'push' && matrix.name == 'all-features') runs-on: windows-latest strategy: fail-fast: false @@ -117,11 +149,11 @@ jobs: components: clippy - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 with: - # Share the per-variant Windows target cache with test.yml's - # windows-build job. That job runs on `push` to main (where save-if - # allows writes), so clippy-windows — which only runs on main PRs — - # can restore from a warm cache instead of cold-building every time. - key: windows-${{ matrix.name }} + # Single shared slot for all three Windows clippy legs. Mirrors the + # Linux clippy `shared-key: clippy` pattern: --all-features is a + # superset, so restoring from whichever variant saved last beats + # storing three near-duplicate Windows target/ caches. + shared-key: clippy-windows save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} - name: Check lints run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 074433d232d..faaa3d99fcc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -86,10 +86,7 @@ jobs: uses: taiki-e/install-action@62b0f2dec647a8e604c6a0fda0e38530180dce20 # cargo-llvm-cov - name: Install cargo-component - run: | - if ! command -v cargo-component >/dev/null 2>&1; then - cargo install cargo-component --locked - fi + uses: ./.github/actions/install-cargo-component - name: Build WASM channels (for integration tests) run: ./scripts/build-wasm-extensions.sh --channels @@ -150,10 +147,7 @@ jobs: uses: taiki-e/install-action@62b0f2dec647a8e604c6a0fda0e38530180dce20 # cargo-llvm-cov - name: Install cargo-component - run: | - if ! command -v cargo-component >/dev/null 2>&1; then - cargo install cargo-component --locked - fi + uses: ./.github/actions/install-cargo-component - name: Build WASM channels run: ./scripts/build-wasm-extensions.sh --channels diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d23449e00f..2021738bbe6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -279,9 +279,9 @@ jobs: persist-credentials: false submodules: recursive - name: Install Rust toolchain + wasm target - run: | - rustup target add wasm32-wasip2 - cargo install cargo-component --locked || true + run: rustup target add wasm32-wasip2 + - name: Install cargo-component + uses: ./.github/actions/install-cargo-component - uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 with: key: wasm-extensions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 388412fc0d9..2a81c8fcec2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,9 +9,35 @@ on: pull_request: branches: - main + paths-ignore: + - 'README.md' + - 'CHANGELOG.md' + - 'CONTRIBUTING.md' + - 'CLAUDE.md' + - 'AGENTS.md' + - 'COVERAGE_PLAN.md' + - 'FEATURE_PARITY.md' + - 'LICENSE-*' + - '*.png' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - 'docs/**' push: branches: - main + paths-ignore: + - 'README.md' + - 'CHANGELOG.md' + - 'CONTRIBUTING.md' + - 'CLAUDE.md' + - 'AGENTS.md' + - 'COVERAGE_PLAN.md' + - 'FEATURE_PARITY.md' + - 'LICENSE-*' + - '*.png' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - 'docs/**' permissions: contents: read @@ -49,7 +75,7 @@ jobs: key: ${{ matrix.name }} save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} - name: Install cargo-component - run: cargo install cargo-component --locked || true + uses: ./.github/actions/install-cargo-component - name: Build WASM channels (for integration tests) run: ./scripts/build-wasm-extensions.sh --channels - name: Run Tests @@ -109,37 +135,6 @@ jobs: timeout --signal=INT --kill-after=30s 10m \ cargo test --manifest-path channels-src/telegram/Cargo.toml -- --nocapture - windows-build: - name: Windows Build (${{ matrix.name }}) - if: > - github.event_name != 'pull_request' || - github.base_ref != 'staging' - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - name: all-features - flags: "--no-default-features --features postgres,libsql,html-to-markdown,bedrock,import" - - name: default - flags: "" - - name: libsql-only - flags: "--no-default-features --features libsql" - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - with: - ref: ${{ inputs.ref || github.sha }} - persist-credentials: false - - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 - with: - key: windows-${{ matrix.name }} - save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} - - name: Check compilation - run: cargo check --all --benches --tests --examples ${{ matrix.flags }} - wasm-wit-compat: name: WASM WIT Compatibility if: > @@ -162,7 +157,7 @@ jobs: key: wasm-extensions save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} - name: Install cargo-component - run: cargo install cargo-component --locked || true + uses: ./.github/actions/install-cargo-component - name: Build all WASM extensions against current WIT run: ./scripts/build-wasm-extensions.sh - name: Instantiation test (host linker compatibility) @@ -224,7 +219,10 @@ jobs: name: Run Tests runs-on: ubuntu-latest if: always() - needs: [tests, heavy-integration-tests, telegram-tests, wasm-wit-compat, docker-build, windows-build, version-check, bench-compile] + # Windows compilation is covered by the clippy-windows job in + # code_style.yml (clippy implies cargo check), so no Windows job is needed + # here. + needs: [tests, heavy-integration-tests, telegram-tests, wasm-wit-compat, docker-build, version-check, bench-compile] steps: - run: | # Unit tests must always pass @@ -237,12 +235,11 @@ jobs: exit 1 fi # Gated jobs: must pass on promotion PRs / push, skipped on developer PRs - for job in telegram-tests wasm-wit-compat docker-build windows-build version-check bench-compile; do + for job in telegram-tests wasm-wit-compat docker-build version-check bench-compile; do case "$job" in telegram-tests) result="${{ needs.telegram-tests.result }}" ;; wasm-wit-compat) result="${{ needs.wasm-wit-compat.result }}" ;; docker-build) result="${{ needs.docker-build.result }}" ;; - windows-build) result="${{ needs.windows-build.result }}" ;; version-check) result="${{ needs.version-check.result }}" ;; bench-compile) result="${{ needs.bench-compile.result }}" ;; esac