-
Notifications
You must be signed in to change notification settings - Fork 20
84 lines (79 loc) · 2.31 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
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Ready env file
run: sh ./scripts/copy-env.sh
- name: Install Clippy
run: rustup component add clippy
- name: Run clippy-check for github comment
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
test_unit:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Ready env file
run: sh ./scripts/copy-env.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
test_e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: realworld-rust-actix-web
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Ready env file
run: sh ./scripts/copy-env.sh
- name: Build
run: cargo build --verbose
- name: Install diesel CLI
run: cargo install diesel_cli
- name: Run server on background
run: |
cargo run &
echo "waiting for server..."
./scripts/wait-for-it.sh 0.0.0.0:8080 --timeout=300 --strict -- echo "Waked up container"
echo "setup diesel..."
diesel setup
echo "check health check..."
curl http://0.0.0.0:8080/api/healthcheck \
--max-time 60 \
--verbose \
--retry 5 \
--retry-delay 0 \
--retry-connrefused
echo "running e2e..."
APIURL=http://localhost:8080/api sh ./e2e/run-api-tests.sh
# - name: Wait for waking server
# run: ./wait-for-it.sh localhost:8080 --timeout=300 --strict -- echo "Waked up container"
# - name: Health check
# run:
# - name: Ready for npx
# uses: actions/setup-node@v2
# with:
# node-version: "14"
# - name: Run e2e test
# run: APIURL=http://localhost:8080/api sh ./e2e/run-api-tests.sh