Repository navigation
117 lines (102 loc) · 2.84 KB
/
Copy pathci.yaml
File metadata and controls
117 lines (102 loc) · 2.84 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Auth CI
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rustfmt:
name: Check Style
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Run Clippy
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms
test:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
services:
postgres:
image: postgres:17.5-alpine
env:
POSTGRES_DB: test_database
POSTGRES_USER: username
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
## Heath checks to wait until postgres has begun
options: --health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:8.6-alpine
ports:
- "6379:6379"
mailer:
image: mailtutan/mailtutan:latest
ports:
- "1080:1080"
- "1025:1025"
steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Generate JWT PEM keys
run: |
mkdir -p secrets/keys/dev
echo "${{ secrets.ACCESS_KEY }}" >> secrets/keys/dev/access_key.pem
echo "${{ secrets.ACCESS_KEY_PUB }}" >> secrets/keys/dev/access_key_pub.pem
echo "${{ secrets.REFRESH_KEY }}" >> secrets/keys/dev/refresh_key.pem
echo "${{ secrets.REFRESH_KEY_PUB }}" >> secrets/keys/dev/refresh_key_pub.pem
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all
env:
TEST_DATABASE_URL: postgresql://username:password@localhost:5432/test_database