on:
pull_request:
name: Testing
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
test:
name: Test
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: install Dependencies
run: |
sudo apt-get -y install jq
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate line code coverage
run: cargo llvm-cov test --ignore-filename-regex "src/single/tuple.rs" --html
- name: Generate summery code coverage
run: cargo llvm-cov report --summary-only --ignore-filename-regex "src/single/tuple.rs" --json --output-path lcov.info
- name: Download old line coverage from latest release
run: |
curl -s https://api.github.com/repos/wasmcompute/tokactor/releases/latest | jq -r '.assets[] | select(.name == "lcov.info") | .browser_download_url' | xargs curl -L -o old-lcov.info
- name: Generate test summery report
run: ./scripts/gen-summery.sh lcov.info old-lcov.info > summery.txt
- uses: actions/github-script@v6
with:
script: |
const fs = require('fs')
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: fs.readFileSync('summery.txt', 'utf8')
})