Skip to content

Commit fa494ed

Browse files
geofmureithiderekleverenzHicham Azimanijayvdbreneoctavio
authored
chore: streamline the ci pipeline (#23)
* chore: streamline the ci pipeline * fix: include pg service and remove mac and windows as check targets * fix: use sqlx in offline mode * sqlx: prepare * sqlx: prepare + add * fix: test-threads = 1 * fix: add sqlx migrations * fix: binstall has no features * fix: include lockfile, ensure corect env * chore: add cargo-vet * fix: executor solution * chore: fix test threads for code coverage * add: coverage token * add: Changelog.md * migrate list of contributors Co-authored-by: Derek Leverenz <derek@yurts.ai> Co-authored-by: Hicham Azimani <hicham.azimani@owkin.com> Co-authored-by: John Vandenberg <jayvdb@gmail.com> Co-authored-by: Njuguna Mureithi <mureithinjuguna@gmail.com> Co-authored-by: René Octavio Queiroz Dias <reneoctavio@gmail.com> Co-authored-by: Rob Ede <robjtede@icloud.com> Co-authored-by: Vlad Stepanov <8uk.8ak@gmail.com> Co-authored-by: autotaker <autotaker@gmail.com> Co-authored-by: ft-filancore <185073724+ft-filancore@users.noreply.github.com>
1 parent 869cecf commit fa494ed

24 files changed

Lines changed: 4321 additions & 539 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @geofmureithi

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ body:
3333
label: Steps to reproduce
3434
description: Steps to reproduce the behavior
3535
placeholder: |
36-
1. Go to '...'
37-
2. Click on '....'
38-
3. Scroll down to '....'
39-
4. See error
36+
1. Setup with '....'
37+
2. Do '....'
38+
3. See error
4039
validations:
4140
required: true
4241

@@ -51,9 +50,12 @@ body:
5150
id: version
5251
attributes:
5352
label: Version
54-
description: What version of apalis-postgres are you running?
53+
description: What version are you running?
5554
options:
56-
- 1.0.0-alpha.1
55+
- 0.7.x
56+
- 1.0.0-alpha.x
57+
- 1.0.0-beta.x
58+
- 1.0.0-rc.x
5759
- main branch
5860
- Other (specify in additional context)
5961
validations:

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ body:
5151
id: terms
5252
attributes:
5353
label: Code of Conduct
54-
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/apalis-dev/apalis-postgres/blob/main/CODE_OF_CONDUCT.md)
54+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/apalis-dev/apalis/blob/main/CODE_OF_CONDUCT.md)
5555
options:
5656
- label: I agree to follow this project's Code of Conduct
5757
required: true

.github/workflows/bench.yml

Lines changed: 0 additions & 80 deletions
This file was deleted.

.github/workflows/changelog.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Changelog"
2+
permissions:
3+
contents: read
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
# Enforces the update of a changelog file on every pull request
11+
changelog:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: dangoslen/changelog-enforcer@v3

.github/workflows/ci.yml

Lines changed: 42 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, develop]
66
pull_request:
7-
branches: [main]
87

98
env:
109
CARGO_TERM_COLOR: always
1110
RUST_BACKTRACE: 1
1211
DATABASE_URL: postgres://postgres:postgres@localhost/postgres
12+
SQLX_OFFLINE: true
1313

1414
jobs:
1515
test:
@@ -34,10 +34,9 @@ jobs:
3434
include:
3535
- os: ubuntu-latest
3636
rust: nightly
37-
3837
steps:
3938
- name: Checkout sources
40-
uses: actions/checkout@v4
39+
uses: actions/checkout@v6
4140

4241
- name: Install Rust toolchain
4342
uses: dtolnay/rust-toolchain@master
@@ -56,15 +55,27 @@ jobs:
5655
${{ runner.os }}-cargo-${{ matrix.rust }}-
5756
${{ runner.os }}-cargo-
5857
58+
- name: Install cargo-binstall
59+
uses: cargo-bins/cargo-binstall@v1.16.2
60+
61+
- name: Install sqlx-cli
62+
run: cargo binstall sqlx-cli --locked --force
63+
64+
- name: Set up database
65+
run: sqlx database create
66+
67+
- name: Run migrations
68+
run: sqlx migrate run
69+
5970
- name: Run cargo test with all features
60-
run: cargo test --all-features --verbose --test-threads=1
71+
run: cargo test --all-features --verbose -- --test-threads=1
6172

6273
fmt:
6374
name: Rustfmt
6475
runs-on: ubuntu-latest
6576
steps:
6677
- name: Checkout sources
67-
uses: actions/checkout@v4
78+
uses: actions/checkout@v6
6879

6980
- name: Install Rust toolchain
7081
uses: dtolnay/rust-toolchain@stable
@@ -77,21 +88,9 @@ jobs:
7788
clippy:
7889
name: Clippy
7990
runs-on: ubuntu-latest
80-
services:
81-
postgres:
82-
image: postgres:17
83-
env:
84-
POSTGRES_PASSWORD: postgres
85-
ports:
86-
- 5432:5432
87-
options: >-
88-
--health-cmd="pg_isready -U postgres"
89-
--health-interval=10s
90-
--health-timeout=5s
91-
--health-retries=5
9291
steps:
9392
- name: Checkout sources
94-
uses: actions/checkout@v4
93+
uses: actions/checkout@v6
9594

9695
- name: Install Rust toolchain
9796
uses: dtolnay/rust-toolchain@stable
@@ -110,35 +109,15 @@ jobs:
110109
- name: Run cargo clippy
111110
run: cargo clippy --all-targets --all-features
112111

113-
security:
114-
name: Security Audit
115-
runs-on: ubuntu-latest
116-
steps:
117-
- name: Checkout sources
118-
uses: actions/checkout@v4
119-
120-
- name: Install Rust toolchain
121-
uses: dtolnay/rust-toolchain@stable
122-
123-
- name: Install cargo-audit
124-
run: cargo install cargo-audit
125-
126-
- name: Run cargo audit
127-
run: cargo audit
128-
129-
coverage:
130-
name: Code Coverage
112+
docs:
113+
name: Documentation
131114
runs-on: ubuntu-latest
132-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
133115
steps:
134116
- name: Checkout sources
135-
uses: actions/checkout@v4
117+
uses: actions/checkout@v6
136118

137119
- name: Install Rust toolchain
138-
uses: dtolnay/rust-toolchain@stable
139-
140-
- name: Install cargo-tarpaulin
141-
run: cargo install cargo-tarpaulin
120+
uses: dtolnay/rust-toolchain@nightly
142121

143122
- name: Cache cargo registry
144123
uses: actions/cache@v4
@@ -147,13 +126,25 @@ jobs:
147126
~/.cargo/registry
148127
~/.cargo/git
149128
target
150-
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
129+
key: ${{ runner.os }}-cargo-docs-${{ hashFiles('**/Cargo.lock') }}
151130

152-
- name: Generate code coverage
153-
run: cargo tarpaulin --all-features --verbose --workspace --timeout 120 --out xml
131+
- name: Build documentation
132+
run: cargo doc --all-features --no-deps --document-private-items
133+
env:
134+
RUSTDOCFLAGS: "-Dwarnings"
154135

155-
- name: Upload to codecov.io
156-
uses: codecov/codecov-action@v3
157-
with:
158-
file: cobertura.xml
159-
fail_ci_if_error: false
136+
unused-deps:
137+
name: Unused Dependencies
138+
runs-on: ubuntu-latest
139+
steps:
140+
- name: Checkout sources
141+
uses: actions/checkout@v6
142+
143+
- name: Install Rust nightly toolchain
144+
uses: dtolnay/rust-toolchain@nightly
145+
146+
- name: Install cargo-udeps
147+
uses: taiki-e/install-action@cargo-udeps
148+
149+
- name: Check for unused dependencies
150+
run: cargo +nightly udeps --all-targets --all-features

.github/workflows/coverage.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
DATABASE_URL: postgres://postgres:postgres@localhost/postgres
13+
SQLX_OFFLINE: true
14+
15+
jobs:
16+
coverage:
17+
name: Code Coverage
18+
runs-on: ubuntu-latest
19+
services:
20+
postgres:
21+
image: postgres:17
22+
env:
23+
POSTGRES_PASSWORD: postgres
24+
ports:
25+
- 5432:5432
26+
options: >-
27+
--health-cmd="pg_isready -U postgres"
28+
--health-interval=10s
29+
--health-timeout=5s
30+
--health-retries=5
31+
steps:
32+
- name: Checkout sources
33+
uses: actions/checkout@v6
34+
35+
- name: Install Rust toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
38+
- name: Install cargo-tarpaulin
39+
run: cargo install cargo-tarpaulin
40+
41+
- name: Cache cargo registry
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
~/.cargo/registry
46+
~/.cargo/git
47+
target
48+
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
49+
50+
- name: Install cargo-binstall
51+
uses: cargo-bins/cargo-binstall@v1.16.2
52+
53+
- name: Install sqlx-cli
54+
run: cargo binstall sqlx-cli --locked --force
55+
56+
- name: Set up database
57+
run: sqlx database create
58+
59+
- name: Run migrations
60+
run: sqlx migrate run
61+
62+
- name: Generate code coverage
63+
run: cargo tarpaulin --all-features --verbose --workspace --timeout 120 --out xml -- --test-threads=1
64+
65+
- name: Upload to codecov.io
66+
uses: codecov/codecov-action@v5
67+
with:
68+
file: cobertura.xml
69+
fail_ci_if_error: false
70+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)