Switch to pnpm and force its usafe for UI - Remove npm calls from build.rs
#5539
Workflow file for this run
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: CI | |
| permissions: | |
| contents: read | |
| on: [push, pull_request] | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CARGO_TERM_COLOR: always | |
| CLICOLOR: 1 | |
| jobs: | |
| ci: | |
| permissions: | |
| contents: none | |
| name: CI | |
| needs: [test, msrv, docs, rustfmt, clippy] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Done | |
| run: exit 0 | |
| test: | |
| name: Test | |
| strategy: | |
| matrix: | |
| os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
| rust: ["stable"] | |
| continue-on-error: ${{ matrix.rust != 'stable' }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup pnpm | |
| # Installs the pnpm CLI tool | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: ui/package.json | |
| - name: Setup Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| cache-dependency-path: ui/pnpm-lock.yaml | |
| - name: Verify pnpm is available | |
| run: pnpm --version | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Install UI dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: ./ui | |
| - name: Build UI | |
| run: pnpm build | |
| working-directory: ./ui | |
| - name: Build | |
| # [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway. | |
| run: cargo test --no-run --workspace | |
| - name: Default features | |
| run: cargo test --workspace | |
| # [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway. | |
| # - name: All features | |
| # run: cargo test --workspace --all-features | |
| - name: No-default features | |
| run: cargo test --workspace --no-default-features | |
| - name: History check | |
| run: cargo xtask history | |
| msrv: | |
| name: Check MSRV | |
| runs-on: ubuntu-latest | |
| env: | |
| MSRV: "1.88.0" # MSRV | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup pnpm | |
| # Installs the pnpm CLI tool | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: ui/package.json | |
| - name: Setup Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| cache-dependency-path: ui/pnpm-lock.yaml | |
| - name: Verify pnpm is available | |
| run: pnpm --version | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.MSRV }} | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| # The intended toolchain is being overridden here by the version defined in rust-toolchain.toml so we need to manually set it back | |
| - name: Override default toolchain | |
| run: rustup override set "${{ env.MSRV }}" | |
| - name: Validate correct toolchain is active | |
| run: | | |
| CURRENT_TOOLCHAIN=$(rustup show active-toolchain | awk '{print $1}' | sed 's/-.*//') | |
| if [ "$CURRENT_TOOLCHAIN" != "${{ env.MSRV }}" ]; then | |
| echo "Expected active toolchain ${{ env.MSRV }} but got $CURRENT_TOOLCHAIN" | |
| exit 1 | |
| else | |
| echo "Correct toolchain $CURRENT_TOOLCHAIN is installed and active" | |
| fi | |
| - name: Install UI dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: ./ui | |
| - name: Build UI | |
| run: pnpm build | |
| working-directory: ./ui | |
| - name: Default features | |
| run: cargo check --workspace --all-targets | |
| # [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway. | |
| # - name: All features | |
| # run: cargo check --workspace --all-targets --all-features | |
| - name: No-default features | |
| run: cargo check --workspace --all-targets --no-default-features | |
| lockfile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: "Is lockfile updated?" | |
| run: cargo fetch --locked | |
| docs: | |
| name: Docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup pnpm | |
| # Installs the pnpm CLI tool | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: ui/package.json | |
| - name: Setup Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| cache-dependency-path: ui/pnpm-lock.yaml | |
| - name: Verify pnpm is available | |
| run: pnpm --version | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Install UI dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: ./ui | |
| - name: Build UI | |
| run: pnpm build | |
| working-directory: ./ui | |
| - name: Check documentation | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| # [ToDo LQ] Re-enable --all-features once the issue is resolved in Tantivy (zstd-safe). This is an experimental feature anyway. | |
| # run: cargo doc --workspace --all-features --no-deps --document-private-items | |
| run: cargo doc --workspace --no-deps --document-private-items | |
| rustfmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| # Not MSRV because its harder to jump between versions and people are | |
| # more likely to have stable | |
| toolchain: stable | |
| components: rustfmt | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| check-external-types: | |
| name: Check external types | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Skip check | |
| run: echo "External types check skipped" | |
| ################################################################################# | |
| # TODO Enable this once check-external-types support is available in a version | |
| # that is compatible with our current MSRV. | |
| # See: https://github.com/open-telemetry/weaver/pull/651#issuecomment-2747851893 | |
| ################################################################################# | |
| # check-external-types: | |
| # name: Check external types | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Checkout repository | |
| # uses: actions/checkout@v4 | |
| # - name: Install Rust | |
| # uses: dtolnay/rust-toolchain@stable | |
| # with: | |
| # # cargo check-external-types is only available on this specific nightly | |
| # toolchain: nightly-2024-06-30 | |
| # - uses: Swatinem/rust-cache@v2 | |
| # - name: check-external-types | |
| # run: | | |
| # cargo install cargo-check-external-types | |
| # ./scripts/check_external_types.sh | |
| ################################################################################# | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write # to upload sarif results | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup pnpm | |
| # Installs the pnpm CLI tool | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: ui/package.json | |
| - name: Setup Node.js | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| cache-dependency-path: ui/pnpm-lock.yaml | |
| - name: Verify pnpm is available | |
| run: pnpm --version | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "stable" | |
| components: clippy | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Install SARIF tools | |
| run: cargo install clippy-sarif --locked | |
| - name: Install SARIF tools | |
| run: cargo install sarif-fmt --locked | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0 | |
| - name: Install UI dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: ./ui | |
| - name: Build UI | |
| run: pnpm build | |
| working-directory: ./ui | |
| - name: Check | |
| # [workaround] removed --all-features due to an issue in one of the dependency in Tantity (zstd-safe) | |
| # [ToDo LQ] Re-enable --all-features once the issue is resolved | |
| run: > | |
| cargo clippy --workspace --all-targets --message-format=json -- -D warnings --allow deprecated | |
| | clippy-sarif | |
| | tee clippy-results.sarif | |
| | sarif-fmt | |
| continue-on-error: true | |
| - name: Upload | |
| uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2 | |
| with: | |
| sarif_file: clippy-results.sarif | |
| wait-for-processing: true | |
| - name: Report status | |
| run: cargo clippy --workspace --all-targets -- -D warnings --allow deprecated | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Install cargo-tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Gather coverage | |
| run: cargo tarpaulin --workspace --output-dir coverage --out lcov -e xtask -e weaver --exclude-files 'crates/weaver_forge/codegen_examples/expected_codegen/*' | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: open-telemetry/weaver |