-
-
Notifications
You must be signed in to change notification settings - Fork 14
143 lines (121 loc) · 3.89 KB
/
cicd.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: CICD
on: [push, pull_request]
env:
TARDIS_TEST_DISABLED_DOCKER: true
jobs:
tardis-macros:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Init rust envrionment
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cargo login
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Cargo package macros
working-directory: tardis-macros
run: cargo package
- name: Cargo publish macros dry run
working-directory: tardis-macros
run: cargo publish --dry-run
- name: Cargo publish macros
if: ${{ startsWith(github.ref, 'refs/tags/') }}
working-directory: tardis-macros
run: cargo publish
tardis:
if: startsWith(github.ref, 'refs/tags/')
needs: [tardis-macros]
runs-on: ubuntu-latest
services:
mysql:
image: mysql
ports:
- 3306:3306
options: -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=test
postgres:
image: postgres:alpine
ports:
- 5432:5432
options: -e POSTGRES_PASSWORD=123456 -e POSTGRES_DB=test
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
rabbit:
image: rabbitmq:management
ports:
- 15672:15672
- 25672:25672
- 5671:5671
- 5672:5672
- 4369:4369
options: -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest
es:
image: rapidfort/elasticsearch:7.17
ports:
- 9200:9200
options: -e ELASTICSEARCH_HEAP_SIZE=128m
# https://github.com/minio/minio/issues/10745
minio:
image: minio/minio:edge-cicd
ports:
- 9000:9000
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Init rust envrionment
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Cache rust
uses: Swatinem/rust-cache@v2
- name: Check format
run: cargo fmt --all -- --check
- name: Check clippy
run: cargo clippy --all --all-features
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
docker-images: false
swap-storage: false
android: true
dotnet: true
haskell: true
large-packages: true
- name: Run test
run: cargo test --all-features
env:
RUSTFLAGS: --cfg tokio_unstable
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: cobertura.xml
- name: Cargo login
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Cargo package tardis
working-directory: tardis
run: cargo package
- name: Cargo publish tardis dry run
working-directory: tardis
run: cargo publish --dry-run
- name: Cargo publish macros
if: ${{ startsWith(github.ref, 'refs/tags/') }}
working-directory: tardis
run: cargo publish