This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
196 lines (184 loc) · 5.58 KB
/
ci-build.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: ci-build
on:
push:
branches: [ main, release/** ]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
facilitator-build:
defaults:
run:
working-directory: facilitator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Lint
run: cargo fmt --message-format human -- --check
- name: clippy
run: cargo clippy --all-targets -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
facilitator-coverage:
defaults:
run:
working-directory: facilitator
runs-on: ubuntu-latest
env:
GRCOV_VERSION: 0.8.13
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install lcov
run: sudo apt install lcov -y
- name: Install rust
uses: dtolnay/rust-toolchain@stable
- name: Cache grcov
uses: actions/cache@v3
with:
path: ${{ runner.tool_cache }}/grcov
key: grcov-bin-${{ env.GRCOV_VERSION }}
- name: Add the tool cache directory to the search path
run: echo "${{ runner.tool_cache }}/grcov/bin/" >> $GITHUB_PATH
- name: Install grcov
run: cargo install --root ${{ runner.tool_cache }}/grcov --version ${{ env.GRCOV_VERSION }} --locked grcov
- name: Test
run: cargo test --all-features --no-fail-fast
env:
RUSTC_BOOTSTRAP: '1' # https://github.com/mozilla/grcov#usage
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- name: Get code coverage
run: grcov ./target/debug -s . --llvm --branch --guess-directory-when-missing --ignore-not-existing -t lcov -o coverage.txt
- name: Clean lcov file
run: lcov --extract coverage.txt -o coverage.txt 'src/*'
- name: Upload test coverage
if: success()
uses: codecov/codecov-action@v3.1.4
with:
fail_ci_if_error: false
file: ./facilitator/coverage.txt
flags: facilitator_tests
name: facilitator tests
terraform:
defaults:
run:
working-directory: terraform
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ~1.3.1
- name: Terraform fmt
run: terraform fmt --check --recursive
- name: Terraform init
run: terraform init --backend=false
- name: Terraform validate
run: terraform validate
facilitator-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker build
uses: docker/setup-buildx-action@v2
- name: build
uses: docker/build-push-action@v4
with:
file: ./facilitator/Dockerfile
workflow-manager-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker build
uses: docker/setup-buildx-action@v2
- name: build
run: ./workflow-manager/build.sh
workflow-manager-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: workflow-manager
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.19.1
- name: Test
run: go test -race --coverprofile=cover.out --covermode=atomic ./...
- name: Upload test coverage
if: success()
uses: codecov/codecov-action@v3.1.4
with:
fail_ci_if_error: false
file: "workflow-manager/cover.out"
flags: workflow_manager_tests
name: workflow-manager tests
key-rotator-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker build
uses: docker/setup-buildx-action@v2
- name: build
uses: docker/build-push-action@v4
with:
file: ./key-rotator/Dockerfile
key-rotator-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: key-rotator
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.19.1
- name: Test
run: go test -race -coverprofile=cover.out --covermode=atomic ./...
- name: Upload test coverage
if: success()
uses: codecov/codecov-action@v3.1.4
with:
fail_ci_if_error: false
file: "key-rotator/cover.out"
flags: key_rotator_tests
name: key-rotator tests
key-rotator-golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.19.1
- name: Run golangci-lint on key-rotator
uses: golangci/golangci-lint-action@v3.6.0
with:
working-directory: key-rotator
version: "v1.50.1"
args: "--config ../.golangci.yml --timeout 10m"
workflow-manager-golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.19.1
- name: Run golangci-lint on workflow-manager
uses: golangci/golangci-lint-action@v3.6.0
with:
working-directory: workflow-manager
version: "v1.50.1"
args: "--config ../.golangci.yml --timeout 10m"