Repository navigation
102 lines (90 loc) · 3.65 KB
/
Copy pathscripts-coverage.yml
File metadata and controls
102 lines (90 loc) · 3.65 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: scripts coverage
# Measures which statements and branches of the Python host tooling in scripts/
# the unit tests that validate-nvx runs reach, with scripts/scripts_coverage.py
# (doc/ci.md, "scripts coverage"). It runs for the pushes to dev that change the
# tooling, its tests, or how they are measured, and on demand, never for pull
# requests, so no required check depends on it.
on:
push:
branches:
- dev
paths:
- scripts/**
- requirements-dev.txt
- .github/actions/validate-nvx/action.yml
- .github/workflows/scripts-coverage.yml
workflow_dispatch:
permissions:
contents: read
# A push replaces the measurement of an earlier push that is still running.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# The tests run as the NVX CLI / Linux job of ci.yml runs them, with the
# OpenVMM checkout, the Python release, and the nvx build that it has.
measure:
name: measure
runs-on: ubuntu-latest
timeout-minutes: 45
env:
NVX: ${{ github.workspace }}/nvx/target/release/nvx
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
persist-credentials: false
- name: Checkout OpenVMM
uses: ./.github/actions/checkout-openvmm
with:
ssh-key: ${{ secrets.OPENVMM_DEPLOY_KEY }}
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.12"
# As the nvx binary / Linux musl job of ci.yml builds it.
- name: Build nvx
shell: bash
run: |
set -euo pipefail
toolchain=$(sed -n 's/^channel = "\([^"]*\)".*/\1/p' rust-toolchain.toml)
test -n "${toolchain}"
rustup toolchain install "${toolchain}" --profile minimal --no-self-update \
--target x86_64-unknown-linux-musl
cargo "+${toolchain}" build --release --locked --features cli \
--manifest-path nvx/Cargo.toml --target x86_64-unknown-linux-musl
install -D -m 0755 nvx/target/x86_64-unknown-linux-musl/release/nvx \
nvx/target/release/nvx
- name: Record nvx provenance
shell: bash
run: >-
python3 scripts/nvx.py record-nvx-provenance
--target x86_64-unknown-linux-musl
# The requirements that validate-nvx installs, and the coverage.py
# release that requirements-dev.txt pins.
- name: Install coverage.py
shell: bash
run: |
set -euo pipefail
coverage=$(grep -E '^coverage==' requirements-dev.txt)
test -n "${coverage}"
python3 -m pip install --requirement scripts/setup/azure/requirements.txt \
"${coverage}"
# Fails when the tests of a command fail, after it writes the reports.
- name: Measure
shell: bash
run: python3 scripts/scripts_coverage.py --output build/scripts-coverage
- name: Write the summary
if: ${{ !cancelled() && hashFiles('build/scripts-coverage/summary.md') != '' }}
shell: bash
run: cat build/scripts-coverage/summary.md >> "${GITHUB_STEP_SUMMARY}"
# A rerun of the job replaces the reports of its earlier attempt.
- name: Upload the reports
if: ${{ !cancelled() && hashFiles('build/scripts-coverage/**') != '' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: scripts-coverage-${{ github.run_id }}
path: build/scripts-coverage
if-no-files-found: error
overwrite: true
retention-days: 30