Skip to content

Commit 11261f3

Browse files
author
Dillen Meijboom
committed
feat: run tests in CI
1 parent cb3249a commit 11261f3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/test.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up cargo cache
15+
uses: actions/cache@v3
16+
continue-on-error: false
17+
with:
18+
path: |
19+
~/.cargo
20+
target
21+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
22+
restore-keys: ${{ runner.os }}-cargo-
23+
- uses: dtolnay/rust-toolchain@stable
24+
with:
25+
toolchain: stable-x86_64-unknown-linux-gnu
26+
components: llvm-tools-preview
27+
- name: Setup grcov
28+
run: |
29+
curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
30+
- name: Run tests with coverage
31+
env:
32+
RUSTFLAGS: "-Cinstrument-coverage"
33+
LLVM_PROFILE_FILE: oembed-%p-%m.profraw
34+
run: |
35+
cargo test &&
36+
./grcov . --binary-path ./target/debug/ -s . -t markdown --branch --ignore-not-existing --ignore "/*" -o coverage.md &&
37+
cat coverage.md
38+
- name: Upload coverage
39+
uses: actions/upload-artifact@v3
40+
if: ${{ github.event_name != 'pull_request' }}
41+
with:
42+
name: coverage.md
43+
path: ./coverage.md

0 commit comments

Comments
 (0)