Skip to content

Commit a34417c

Browse files
authored
remove actions-rs/cargo@v1 and add tests to example project (#12)
* remove `actions-rs/cargo@v1` and add tests to example project * change name * changes * changes * fix clippy in example project * fixes * add back .gitignore * fix yaml test * fmt * tests * fmt
1 parent 0705919 commit a34417c

File tree

12 files changed

+116
-5811
lines changed

12 files changed

+116
-5811
lines changed

.github/workflows/ci.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
env:
9+
RUST_TOOLCHAIN: stable
10+
TOOLCHAIN_PROFILE: minimal
11+
12+
jobs:
13+
rustfmt:
14+
name: Check Style
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
20+
steps:
21+
- name: Checkout the code
22+
uses: actions/checkout@v4
23+
- uses: dtolnay/rust-toolchain@stable
24+
with:
25+
toolchain: ${{ env.RUST_TOOLCHAIN }}
26+
components: rustfmt
27+
- name: Run cargo fmt
28+
run: cargo fmt --all -- --check
29+
30+
clippy:
31+
name: Run Clippy
32+
runs-on: ubuntu-latest
33+
34+
permissions:
35+
contents: read
36+
37+
steps:
38+
- name: Checkout the code
39+
uses: actions/checkout@v4
40+
- uses: dtolnay/rust-toolchain@stable
41+
with:
42+
toolchain: ${{ env.RUST_TOOLCHAIN }}
43+
- name: Setup Rust cache
44+
uses: Swatinem/rust-cache@v2
45+
- name: Run cargo clippy
46+
run: cargo clippy --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms -A clippy::result_large_err
47+
48+
49+
test:
50+
name: Run Tests
51+
runs-on: ubuntu-latest
52+
53+
permissions:
54+
contents: read
55+
56+
steps:
57+
- name: Checkout the code
58+
uses: actions/checkout@v4
59+
- uses: dtolnay/rust-toolchain@stable
60+
with:
61+
toolchain: ${{ env.RUST_TOOLCHAIN }}
62+
- name: Setup Rust cache
63+
uses: Swatinem/rust-cache@v2
64+
- name: Run cargo test
65+
run: cargo test --all-features --all

.github/workflows/example.yaml

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
name: example
1+
name: Example
22
on:
33
push:
44
branches:
5-
- master
65
- main
76
pull_request:
87

@@ -26,10 +25,8 @@ jobs:
2625
toolchain: ${{ env.RUST_TOOLCHAIN }}
2726
components: rustfmt
2827
- name: Run cargo fmt
29-
uses: actions-rs/cargo@v1
30-
with:
31-
command: fmt
32-
args: --all -- --check
28+
run: cargo fmt --all -- --check
29+
working-directory: ./example
3330

3431
clippy:
3532
name: Run Clippy
@@ -47,10 +44,9 @@ jobs:
4744
- name: Setup Rust cache
4845
uses: Swatinem/rust-cache@v2
4946
- name: Run cargo clippy
50-
uses: actions-rs/cargo@v1
51-
with:
52-
command: clippy
53-
args: --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms -A clippy::result_large_err
47+
run: cargo clippy --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms
48+
working-directory: ./example
49+
5450

5551
test:
5652
name: Run Tests
@@ -59,30 +55,6 @@ jobs:
5955
permissions:
6056
contents: read
6157

62-
# services:
63-
# redis:
64-
# image: redis
65-
# options: >-
66-
# --health-cmd "redis-cli ping"
67-
# --health-interval 10s
68-
# --health-timeout 5s
69-
# --health-retries 5
70-
# ports:
71-
# - "6379:6379"
72-
# postgres:
73-
# image: postgres
74-
# env:
75-
# POSTGRES_DB: postgres_test
76-
# POSTGRES_USER: postgres
77-
# POSTGRES_PASSWORD: postgres
78-
# ports:
79-
# - "5432:5432"
80-
# # Set health checks to wait until postgres has started
81-
# options: --health-cmd pg_isready
82-
# --health-interval 10s
83-
# --health-timeout 5s
84-
# --health-retries 5
85-
8658
steps:
8759
- name: Checkout the code
8860
uses: actions/checkout@v4
@@ -92,10 +64,5 @@ jobs:
9264
- name: Setup Rust cache
9365
uses: Swatinem/rust-cache@v2
9466
- name: Run cargo test
95-
uses: actions-rs/cargo@v1
96-
with:
97-
command: test
98-
args: --all-features --all
99-
# env:
100-
# REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
101-
# DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
67+
run: cargo test --all-features --all
68+
working-directory: ./example

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ debug/
44
target/
55

66
# include cargo lock
7-
!Cargo.lock
7+
Cargo.lock
88
example/loco-openapi_test.sqlite-shm
99
example/loco-openapi_test.sqlite-wal

0 commit comments

Comments
 (0)