@@ -59,21 +59,26 @@ jobs:
5959 args : -- -D warnings -D clippy::panic -D clippy::todo
6060
6161 build_and_test :
62+ name : Build, test, and coverage
6263 runs-on : ubuntu-latest
63- container :
64+ container :
6465 image : fedora:latest
6566 options : --user root
67+ env :
68+ CARGO_TERM_COLOR : always
69+ LLVM_COV : /usr/bin/llvm-cov
70+ LLVM_PROFDATA : /usr/bin/llvm-profdata
6671 steps :
6772 - name : Install deps
6873 run : |
69- dnf install -y make gcc git cargo rust git grub2-efi grub2-efi-modules shim
74+ dnf install -y make gcc git cargo rust git grub2-efi grub2-efi-modules shim llvm
7075 - uses : actions/checkout@v4
7176 with :
7277 persist-credentials : false
7378 - name : Fix git trust
7479 run : git config --global --add safe.directory /__w/greenboot-rs/greenboot-rs
7580 - name : Cache
76- uses : actions/cache@v3
81+ uses : actions/cache@v4
7782 with :
7883 path : |
7984 ~/.cargo/bin/
@@ -82,18 +87,36 @@ jobs:
8287 ~/.cargo/git/db/
8388 target/
8489 key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
90+ - name : Install cargo-llvm-cov
91+ run : cargo install cargo-llvm-cov
8592 - name : Build
8693 uses : actions-rs/cargo@v1
8794 with :
8895 command : build
89- - name : Run tests with mock mounts
90- uses : actions-rs/cargo@v1
96+ - name : Run tests with coverage
97+ run : |
98+ cargo llvm-cov test -- --test-threads=1
99+ cargo llvm-cov report --html --output-dir coverage/html
100+ - name : Upload coverage report (HTML artifact)
101+ uses : actions/upload-artifact@v4
91102 with :
92- command : test
93- args : --features test-remount -- --test-threads=1
94- - name : Run mount logic tests
95- uses : actions-rs/cargo@v1
103+ name : coverage-report
104+ path : coverage/html/
105+ retention-days : 14
106+ - name : Upload to GitHub Pages
107+ uses : actions/upload-pages-artifact@v3
96108 with :
97- command : test
98- # matches 2 remount tests
99- args : test_remount_boot
109+ path : coverage/html/
110+
111+ deploy-pages :
112+ name : Deploy coverage to GitHub Pages
113+ needs : build_and_test
114+ if : github.ref == 'refs/heads/greenboot-rs' && github.event_name == 'push'
115+ runs-on : ubuntu-latest
116+ permissions :
117+ pages : write
118+ id-token : write
119+ environment : github-pages
120+ steps :
121+ - name : Deploy to GitHub Pages
122+ uses : actions/deploy-pages@v4
0 commit comments