# Run cargo-llvm-cov and upload to codecov.io name: Pacquet Code Coverage permissions: contents: read on: workflow_dispatch: pull_request: types: [opened, synchronize] paths: - 'pacquet/**/*.rs' push: branches: - main paths: - 'pacquet/**/*.rs' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref_name != 'main' }} jobs: coverage: name: Code Coverage runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: submodules: true # Pull submodules for `cargo coverage` persist-credentials: false - name: Install Rust Toolchain uses: ./.github/actions/rustup - name: Install cargo-llvm-cov uses: taiki-e/install-action@e1c4cd42111751368541a7cb5db3522bd1f846a4 # v2.78.0 with: tool: cargo-llvm-cov - name: Install cargo-nextest uses: taiki-e/install-action@e1c4cd42111751368541a7cb5db3522bd1f846a4 # v2.78.0 with: tool: cargo-nextest - name: Install llvm-tools-preview for llvm-cov run: rustup component add llvm-tools-preview - name: Install pnpm (for compatibility check) uses: pnpm/setup@b1cac37306e39c21283b9dd6cb0ac288fb35ba6b with: install: false - name: Cache pnpm uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: key: codecov-pnpm-v11-${{ runner.os }} path: | ${{ env.PNPM_HOME }}/store/v11 ${{ env.HOME }}/.local/share/pnpm/store/v11 timeout-minutes: 1 continue-on-error: true - name: Install just uses: taiki-e/install-action@e1c4cd42111751368541a7cb5db3522bd1f846a4 # v2.78.0 with: tool: just - name: Install dependencies run: just install - name: Run run: | just registry-mock launch # removing env vars is a temporary workaround for unit tests in pacquet relying on external environment # this should be removed in the future unset PNPM_HOME unset XDG_DATA_HOME cargo codecov --lcov --output-path lcov.info just registry-mock end - name: Upload Artifact uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: codecov path: lcov.info # codecov often fails, use another workflow for retry upload-codecov: name: Upload coverage file runs-on: ubuntu-latest needs: coverage steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Download coverage file uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 with: name: codecov - name: Upload to codecov.io uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true files: lcov.info