BUILD/MINOR: go.mod: update Go packages #497
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: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- 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@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
- name: clearing models | |
run: rm -rf models/* | |
- name: generating models | |
run: make models equal | |
- name: changes | |
run: test -z "$(git diff 2> /dev/null)" || exit "Models are not generated, issue \`make models equal\` 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 | |
license: | |
name: license-check | |
needs: ["generate-specification","generate-models"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
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: go-licenses install | |
run: go install github.com/google/go-licenses@latest | |
- name: Check Licenses | |
run: | | |
PROJECT="$(go list -m)" | |
ALLOWED_LICENSES="$(<.allowed_license_types)" | |
go-licenses report --ignore "$PROJECT" . | |
go-licenses check --allowed_licenses="$ALLOWED_LICENSES" --ignore "$PROJECT" . | |
tidy: | |
name: go mod tidy | |
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' | |
- 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: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- name: Build | |
run: | | |
go build -v . | |
go-test: | |
name: Tests | |
needs: ["tidy","build"] | |
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' | |
id: go | |
- name: Test | |
run: | | |
go test -race -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, 2.8] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: e2e Test | |
run: DOCKER_HAPROXY_VERSION=${{ matrix.haproxyVersion }} make e2e-docker |