name: Code Coverage on: ["push", "pull_request"] env: CARGO_TERM_COLOR: always RUST_TOOLCHAIN: 1.86.0 jobs: coverage: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v5 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN }} components: llvm-tools-preview - name: Rust Cache uses: Swatinem/rust-cache@v2 - name: Cache vcpkg uses: actions/cache@v4 with: path: target/vcpkg key: A-vcpkg-${{ runner.os }}-${{ hashFiles('Cargo.toml', 'Cargo.lock') }} restore-keys: | A-vcpkg-${{ runner.os }}- - name: Vcpkg Linux Dependencies run: | sudo apt-get update sudo apt-get install -y libltdl-dev - name: Vcpkg run: | cargo install cargo-vcpkg cargo vcpkg -v build - uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@nextest - uses: taiki-e/install-action@just - name: Generate coverage report run: | just coverage - name: Download Coveralls CLI run: | # use GitHub Releases URL instead of coveralls.io because they can't maintain their own files; it 404s curl -L https://github.com/coverallsapp/coverage-reporter/releases/download/v0.6.15/coveralls-linux-x86_64.tar.gz | tar -xz -C /usr/local/bin - name: Upload coverage to Coveralls env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} run: | if [ ! -f "lcov.info" ]; then echo "Error: lcov.info file not found. Coverage generation may have failed." exit 1 fi for i in {1..10}; do echo "Attempt $i: Uploading coverage to Coveralls..." if coveralls -n report lcov.info; then echo "Successfully uploaded coverage report." exit 0 fi if [ $i -lt 10 ]; then delay=$((2**i)) echo "Attempt $i failed. Retrying in $delay seconds..." sleep $delay fi done echo "Failed to upload coverage report after 10 attempts." exit 1