-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (68 loc) · 2.14 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
name: ci
on:
pull_request:
branches: [ main ]
paths:
- '**'
- '!website/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./api ./vault ./logger
- name: Check code formatting
run: |
if [ -n "$(gofmt -l .)" ]; then echo "Go code is not properly formatted:"; gofmt -d .; exit 1; fi
# The below is a hack because the golangci-lint-action doesn't support go.work yet: https://github.com/golangci/golangci-lint/issues/2654
- name: Run Go linter on vault
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.1
working-directory: vault
- name: Run Go linter on api
uses: golangci/golangci-lint-action@v3
with:
skip-pkg-cache: true
version: v1.54.1
working-directory: api
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run tests
uses: isbang/compose-action@v1.5.1
with:
compose-file: "./docker-compose.ci.yml"
up-flags: "--remove-orphans --abort-on-container-exit"
down-flags: "--volumes --remove-orphans"
services: |
postgres
tests
- name: Run simulations
uses: isbang/compose-action@v1.5.1
with:
compose-file: "./docker-compose.ci.yml"
up-flags: "--remove-orphans --abort-on-container-exit"
down-flags: "--volumes --remove-orphans"
services: |
postgres
api
simulations