-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.27 KB
/
test.yml
File metadata and controls
76 lines (64 loc) · 2.27 KB
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
name: Test
on: [push]
env:
SESSION_SECRET: 1234567890qwertyuiopasdfghjklzxcvbnm
SMTP_PASSWORD: ${{ secrets.TESTING_SMTP_PASSWORD }}
SMTP_SERVER: ${{ secrets.TESTING_SMTP_SERVER }}
SMTP_USERNAME: ${{ secrets.TESTING_SMTP_USERNAME }}
RUSTFLAGS: -Zinstrument-coverage
jobs:
suite:
name: Testing & Coverage
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Auto-cancel redundant jobs
uses: technote-space/auto-cancel-redundant-job@v1
- name: Checkout the repo
uses: actions/checkout@v2
with:
submodules: true
- name: Install rust toolchain
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: nightly
override: true
- name: Install diesel cli
run: cargo install diesel_cli --no-default-features --features "postgres"
- name: Set up the DB
run: cd block-tools && diesel setup && diesel migration run && cd ..
env:
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
- name: Install grcov
run: curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar jxf -
- name: Install llvm tools
run: rustup component add llvm-tools-preview
- name: Run the tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
LLVM_PROFILE_FILE: "api-%p-%m.profraw"
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
- name: Generate coverage
run: ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
fail_ci_if_error: true