generated from IWANABETHATGUY/tower-lsp-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (89 loc) · 2.99 KB
/
test.yml
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
name: test
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
e2e-testing:
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Create dummy tag
run: git tag -f CI
# copied from https://github.com/BamPeers/rust-ci-github-actions-workflow
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-dependencies
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
- name: Generate test result and coverage report
id: cargo-testcov
if: matrix.runs-on == "ubuntu-latest"
continue-on-error: true
run: |
cargo install cargo2junit grcov;
cargo test $CARGO_OPTIONS -- -Z unstable-options --format json | cargo2junit > results.xml;
zip -0 ccov.zip `find . \( -name "odoo_lsp*.gc*" \) -print`;
grcov ccov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" --ignore "tests/*" -o lcov.info;
- name: Upload test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: steps.cargo-testcov.outcome == 'success'
with:
check_name: Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: results.xml
- name: Upload to CodeCov
uses: codecov/codecov-action@v1
if: steps.cargo-testcov.outcome == 'success'
with:
# required for private repositories:
# token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
fail_ci_if_error: true
- name: Run unit tests
id: cargo-test
if: matrix.runs-on != "ubuntu-latest"
continue-on-error: true
run: cargo test
- name: Run tests
working-directory: testing
run: |
pip install -U uv
uv venv
. ${{ matrix.runs-on == 'windows-latest' && '.venv/Scripts/activate' || '.venv/bin/activate'}}
uv pip compile requirements.in -o requirements.txt
uv pip sync requirements.txt
pytest -vv --junitxml=.results.xml --color=yes
- name: Report failures
if: always()
uses: pmeier/pytest-results-action@main
with:
path: testing/.results.xml
summary: true
fail-on-empty: false
title: E2E Test Results
- name: Fail if unit tests failed
if: steps.cargo-test.outcome == 'failure' || steps.cargo-testcov.outcome == 'failure'
run: exit 1