Skip to content

Bump actions/checkout from 3 to 4 #34

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #34

Workflow file for this run

permissions:
contents: write
pull-requests: write
on:
pull_request:
name: coverage
jobs:
coverage:
runs-on: ubuntu-latest
name: ubuntu / nightly / coverage
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview,rust-src
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo llvm-cov
id: gen-coverage
run: |
mkdir -p coverage/coverage
RUSTFLAGS="--cfg NO_UI_TESTS" cargo llvm-cov --locked --all-features --examples --tests --html
mv "target/llvm-cov/html" "coverage/coverage/${{ github.sha }}"
- name: Upload to gh-pages
run: |
cd coverage
git config --global init.defaultBranch gh-pages
git init
git remote add origin "https://github.com/$GITHUB_REPOSITORY"
git fetch origin
git pull origin gh-pages
git config user.name CI
git config user.email ""
git add .
git commit -m "Create coverage of PR #${{ github.event.number }} \`\"${{ github.head_ref }}\"\` (${{ github.sha }})"
git push "https://x-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" HEAD:gh-pages
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '[Coverage](https://rust-for-linux.github.io/pinned-init/coverage/${{ github.sha }}) for ${{ github.sha }}'
})