-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (94 loc) · 3.02 KB
/
rust.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
100
101
102
103
104
105
106
107
108
109
110
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: "true"
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/head/main' }}
shared-key: "main"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run unit tests
run: cargo llvm-cov test --verbose --lib --lcov --output-path lcov.unit-tests.info
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lcov.unit-tests.info
path: lcov.unit-tests.info
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/head/main' }}
shared-key: "main"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Start containers
run: docker compose up -d
- name: Install self signed certificate
run: |
until [ -f ./resources/test/certs/cert.pem ]; do sleep 1; done
sudo cp ./resources/test/certs/cert.pem /usr/local/share/ca-certificates/localhost.crt && sudo update-ca-certificates
timeout-minutes: 1
- name: Run integration tests
run: cargo llvm-cov test --verbose --test '*' --lcov --output-path lcov.integration-tests.info
env:
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
AWS_REGION: us-east-1
RUSTFLAGS: "-C instrument-coverage"
- name: Stop containers
if: always()
run: docker compose down
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lcov.integration-tests.info
path: lcov.integration-tests.info
coverage:
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs: [unit-tests, integration-tests]
steps:
- uses: actions/checkout@v3
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- uses: actions/download-artifact@master
with:
name: lcov.integration-tests.info
path: lcov
- uses: actions/download-artifact@master
with:
name: lcov.unit-tests.info
path: lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.unit-tests.info,lcov.integration-tests.info
fail_ci_if_error: true
build-release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Build final release binary
run: ./scripts/release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: terrashine-binary
path: target/release/terrashine