-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (73 loc) · 2.1 KB
/
rust.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
85
86
87
88
name: Test and Build Rust
on:
push:
pull_request:
# schedule:
# Check if it works with current dependencies (weekly on Friday 00:00 UTC)
# - cron: '0 0 * * 5'
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_DB: vinted-rs
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
components: clippy
override: true
profile: minimal
toolchain: stable
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --verbose --all-targets --all-features -- -D warnings
- name: Install diesel-cli
uses: actions-rs/cargo@v1
with:
command: install
args: diesel_cli --no-default-features --features "postgres"
- name: Setup db
run: diesel setup --database-url=postgres://postgres:postgres@localhost/vinted-rs
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --all-features
release:
name: Release x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
target: x86_64-unknown-linux-gnu
toolchain: stable
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose --all-features --target x86_64-unknown-linux-gnu