-
-
Notifications
You must be signed in to change notification settings - Fork 7
62 lines (47 loc) · 1.32 KB
/
go.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
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
COMPOSE_FILE: e2e_test/docker-compose.yaml
jobs:
build:
name: "Lint and test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
- name: Test
run: go test -v ./...
- name: Build salt-exporter
run: go build -v ./cmd/salt-exporter
- name: Build salt-live
run: go build -v ./cmd/salt-live
e2e:
name: "End-to-end tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: Set up environment
run: docker compose -f $COMPOSE_FILE up -d --wait --wait-timeout 60
- name: Run some Salt commands
run: docker compose -f $COMPOSE_FILE exec salt_master sh /test/exec_commands.sh
- name: Test
run: go test -v -tags=e2e ./e2e_test/...
- name: Print metrics if failed
if: failure()
run: curl 127.0.0.1:2112/metrics | grep salt_
- name: "Clean up environment"
if: always()
run: docker compose -f $COMPOSE_FILE down