-
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (45 loc) · 1.56 KB
/
ci.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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy, llvm-tools-preview
- uses: Swatinem/rust-cache@v2
# cargo build before check to speed up check
- run: cargo build --no-default-features && cargo check --no-default-features
if: matrix.os == 'windows-latest'
- run: cargo build && cargo check
if: matrix.os != 'windows-latest'
- run: cargo fmt && cargo clippy --no-default-features
if: matrix.os == 'windows-latest'
- run: cargo fmt && cargo clippy
if: matrix.os != 'windows-latest'
- run: cargo test --no-default-features
if: matrix.os == 'windows-latest'
- run: cargo test
if: matrix.os != 'windows-latest'
- name: Run server
shell: bash # for windows
run: |
cp .env.example .env
./target/debug/clean-axum &
while ! curl --output /dev/null --silent --head --fail http://localhost:3000; do sleep 0.5; done; echo ok;
- name: Check server
run: |
curl -sX POST http://localhost:3000/users -H "Content-Type: application/json" -d '{"username":"abc"}'
curl -s http://localhost:3000/users?username=