-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (93 loc) · 2.81 KB
/
ci.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
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
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
jobs:
test:
name: CI
services:
postgres:
image: public.ecr.aws/docker/library/postgres:12-alpine
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
rust: [ 1.76.0, stable, nightly ]
#features: [ --no-default-features, --all-features ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Install sqlx-cli
run: cargo install sqlx-cli --no-default-features --features postgres
- name: Setup DB
working-directory: ./rexecutor-sqlx
run: sqlx database setup
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy
- name: cargo doc
run: cargo doc --no-deps --all-features
- name: Test
run: cargo test
- name: Build
run: cargo build
coverage:
name: coverage
services:
postgres:
image: public.ecr.aws/docker/library/postgres:12-alpine
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install sqlx-cli
run: cargo install sqlx-cli --no-default-features --features postgres
- name: Setup DB
working-directory: ./rexecutor-sqlx
run: sqlx database setup
- name: Test Coverage (over 90%)
run: cargo llvm-cov --doctests --lcov --output-path lcov.info --no-clean --fail-under-lines 90
continue-on-error: false
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: github.event.pull_request.draft == false
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false