This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
70 lines (68 loc) · 2.41 KB
/
tests.yaml
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
name: Tests
on:
push:
branches:
- main
tags:
- '*'
pull_request:
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install dependencies
run: |
set -eu
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y gcc libpam-dev curl gettext libsqlite3-dev
- name: Rust - Setup Cargo (nightly to get coverage)
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: llvm-tools-preview
- name: Rust - Install grcov
run: cargo install grcov
- name: Go - Run tests
run: |
set -eu
go test -coverpkg=./... -coverprofile=/tmp/coverage.out -covermode=set ./...
# Filter out test utilities
grep -hv -e "testutils" /tmp/coverage.out > /tmp/coverage.filtered.out
- name: Go - Run tests (with race detector)
run: go test -race ./...
- name: Rust - Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cinstrument-coverage'
- name: Rust - Collect coverage
run: |
grcov target/debug/ \
--branch \
--llvm \
--output-type lcov \
--source-dir . \
--output-path /tmp/lcov.info \
--keep-only='**/nss/src/**' \
--ignore='**/**/*_tests.rs' \
--ignore='**/testutils/**' \
--ignore-not-existing \
--excl-line "#\\[derive\\(" \
--excl-br-line "#\\[derive\\(" \
--excl-start "#\\[cfg\\((test|feature = \"integration-tests\")\\)\\)\\]" \
--excl-br-start "#\\[cfg\\((test|feature = \"integration-tests\")\\)\\)\\]" \
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: /tmp/coverage.filtered.out, /tmp/lcov.info
fail_ci_if_error: true