Merge pull request #70 from kpetremann/ci_goversion #155
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
COMPOSE_FILE: e2e_test/docker-compose.yaml | |
jobs: | |
tests: | |
name: "Lint and test" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Run golangci-lint | |
uses: golangci/[email protected] | |
- 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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- 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 |