-
-
Notifications
You must be signed in to change notification settings - Fork 37
109 lines (91 loc) · 2.57 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Test and Build Rust
on:
push:
pull_request:
schedule:
# Check if it works with current dependencies (weekly on Wednesday 2:32 UTC)
- cron: '32 2 * * 3'
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:15.1
# Provide the password for postgres
env:
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@v3
- 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
- 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@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
target: x86_64-unknown-linux-gnu
toolchain: nightly
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose --all-features --target x86_64-unknown-linux-gnu
build-container:
name: Build and Push image to DockerHub.
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ayratbadykov/el_monitorro:dev