forked from stadust/pointercrate
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (76 loc) · 2.39 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
name: Tests
on:
pull_request:
push:
branches:
- master
jobs:
# Label of the container job
container-job:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: pointercrate
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: llvm-tools-preview
- name: Install sqlx-cli
uses: actions-rs/cargo@v1
with:
command: install
args: sqlx-cli
- name: Load pointercrate schema
uses: actions-rs/cargo@v1
with:
command: sqlx
args: migrate run
env:
DATABASE_URL: postgresql://pointercrate:postgres@localhost/postgres
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
env:
DATABASE_URL: postgresql://pointercrate:postgres@localhost/postgres
RUST_BACKTRACE: 1
RUSTFLAGS: -Cinstrument-coverage
LIST_SIZE: 75
EXNTEDED_LIST_SIZE: 150
- name: Install grcov
uses: actions-rs/cargo@v1
with:
command: install
args: grcov
- name: Generate coverage report
run: grcov . -s . --binary-path ./target/debug/ -t lcov --ignore-not-existing -o ./target/debug/coverage.lcov --ignore "pointercrate-test/*" --ignore "pointercrate-example/*" --keep-only "pointercrate-*"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./target/debug/coverage.lcov