-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (54 loc) · 1.84 KB
/
Copy pathcoverage.yml
File metadata and controls
66 lines (54 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
coverage:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang llvm ninja-build bc jq
- name: Install Node dependencies
run: pnpm install --frozen-lockfile
- name: Build LIEF library
run: CC=clang CXX=clang++ pnpm build:lief
- name: Run coverage
run: ./scripts/coverage.sh
- name: Read coverage summary
id: coverage
run: |
COVERAGE=$(head -1 coverage/coverage-summary.txt)
COLOR=$(tail -1 coverage/coverage-summary.txt)
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
echo "color=$COLOR" >> $GITHUB_OUTPUT
echo "Coverage: ${COVERAGE}% (${COLOR})"
- name: Download coverage badge
run: |
mkdir -p badges
curl -s "https://img.shields.io/badge/coverage-${{ steps.coverage.outputs.coverage }}%25-${{ steps.coverage.outputs.color }}" > badges/coverage.svg
- name: Commit badge
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add badges/coverage.svg
git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]"
git push