Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Commit 609079b

Browse files
committed
Add deploy workflow
1 parent 22d4b44 commit 609079b

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

.github/workflows/deploy.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: rust-toolchain
16+
uses: actions-rs/[email protected]
17+
with:
18+
toolchain: nightly
19+
profile: minimal
20+
21+
- name: Install LLVM tools
22+
run: |
23+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
24+
sudo ln -s /usr/bin/llvm-cov-11 /usr/bin/llvm-cov
25+
sudo ln -s /usr/bin/llvm-profdata-11 /usr/bin/llvm-profdata
26+
27+
- name: Generate Coverage
28+
run: |
29+
sh cov.sh --json
30+
sh cov.sh --html
31+
32+
- name: Move to Deploy Directory
33+
run: |
34+
mkdir out
35+
mv cov.json out/cov.json
36+
mv cov/rustc-semver/* out/
37+
38+
- name: Deploy to GitHub Pages
39+
uses: JamesIves/[email protected]
40+
with:
41+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
42+
GITHUB_TOKEN: ${{ github.token }}
43+
BRANCH: gh-pages
44+
FOLDER: out
45+
TARGET_FOLDER: '.'
46+
COMMIT_MESSAGE: 'Automatic deploy of coverage'
47+
GIT_CONFIG_NAME: GHA
48+
GIT_CONFIG_EMAIL: [email protected]

cov.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ rm -rf cov/*
44

55
RUSTFLAGS="-Zinstrument-coverage" \
66
LLVM_PROFILE_FILE="$(pwd)/cov/rustc-semver%m.profraw" \
7-
cargo +nightly test > /dev/null 2>&1
7+
cargo +nightly test
88

99
llvm-profdata merge -sparse cov/rustc-semver*.profraw -o cov/rustc-semver.profdata
1010

@@ -14,10 +14,10 @@ case $1 in
1414
--instr-profile=cov/rustc-semver.profdata \
1515
--summary-only \
1616
--format=text \
17-
$(find target/debug/deps -executable -type f)
17+
$(find target/debug/deps -executable -type f) | python3 -m json.tool > cov.json
1818
;;
1919
"--html")
20-
cargo install rustfilt > /dev/null 2>&1
20+
cargo install rustfilt
2121
llvm-cov show \
2222
--instr-profile=cov/rustc-semver.profdata \
2323
--Xdemangler=rustfilt \

0 commit comments

Comments
 (0)