BUILD/MINOR: go.mod: update Go packages #721
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: CI | |
on: [push, pull_request] | |
jobs: | |
check: | |
if: ${{ github.event_name == 'pull_request' }} | |
name: HAProxy check commit message | |
runs-on: ubuntu-latest | |
steps: | |
- name: commit-check | |
uses: docker://ghcr.io/haproxytech/commit-check:3.0.0 | |
env: | |
API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
generate-specification: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
id: go | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Compare | |
run: | | |
go run specification/build/build.go -file specification/haproxy-spec.yaml > specification/build/haproxy_spec_to_compare.yaml | |
diff -u specification/build/haproxy_spec_to_compare.yaml specification/build/haproxy_spec.yaml | |
- name: YAML script validation | |
run: | | |
chmod +x ./specification/scripts/lint-yaml.sh | |
./specification/scripts/lint-yaml.sh | |
generate-models: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version-file: 'go.mod' | |
- name: generating models | |
run: make models | |
- name: changes | |
run: test -z "$(git diff 2> /dev/null)" || exit "Models are not generated, issue \`make models\` and commit the result" | |
- name: untracked files | |
run: test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "Models generation created untracked files, cannot proceed" | |
lint: | |
name: golangci-lint | |
needs: ["generate-specification","generate-models"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Lint | |
run: | | |
make lint | |
lint-spec: | |
needs: ["generate-specification","generate-models"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: yaml-lint | |
uses: ibiqlik/action-yamllint@master | |
with: | |
file_or_dir: . | |
config_file: .yamllint.yml | |
tidy: | |
name: go mod tidy | |
needs: ["generate-specification","generate-models"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
- name: tidy | |
run: go mod tidy | |
- name: changes | |
run: test -z "$(git diff 2> /dev/null)" || exit "Go modules not tidied, issue \`go mod tidy\` and commit the result" | |
build: | |
name: Build | |
needs: ["generate-specification","generate-models"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build | |
run: | | |
go build -v . | |
go-test: | |
name: Tests | |
needs: ["tidy","build"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Test | |
run: | | |
go test -v ./... | |
e2e: | |
name: e2e on HAProxy | |
needs: ["go-test"] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
haproxyVersion: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7] | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
file: ./e2e/Dockerfile | |
build-args: | | |
HAPROXY_VERSION=${{ matrix.haproxyVersion }} | |
tags: client-native-test:${{ matrix.haproxyVersion }} | |
- uses: addnab/docker-run-action@v2 | |
with: | |
image: client-native-test:${{ matrix.haproxyVersion }} | |
run: go test -tags integration ./... |