2021-07-23 09:00:07 +00:00
|
|
|
name: Validate
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
env:
|
2023-02-23 14:06:05 +00:00
|
|
|
GO_VERSION: '1.20'
|
|
|
|
GOLANGCI_LINT_VERSION: v1.51.2
|
2022-10-11 16:18:09 +00:00
|
|
|
MISSSPELL_VERSION: v0.4.0
|
2022-03-03 14:42:08 +00:00
|
|
|
IN_DOCKER: ""
|
2021-07-23 09:00:07 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
validate:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: go/src/github.com/traefik/traefik
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
2022-10-21 14:08:05 +00:00
|
|
|
uses: actions/cache@v3
|
2021-07-23 09:00:07 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
|
|
|
key: ${{ runner.os }}-validate-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: ${{ runner.os }}-validate-go-
|
|
|
|
|
|
|
|
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
|
|
|
|
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
|
|
|
|
|
|
|
|
- name: Install missspell ${{ env.MISSSPELL_VERSION }}
|
2022-10-11 16:18:09 +00:00
|
|
|
run: curl -sfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSSPELL_VERSION}
|
2021-07-23 09:00:07 +00:00
|
|
|
|
2021-09-15 08:36:14 +00:00
|
|
|
- name: Avoid generating webui
|
2022-02-18 14:44:08 +00:00
|
|
|
run: touch webui/static/index.html
|
2021-09-15 08:36:14 +00:00
|
|
|
|
2021-07-23 09:00:07 +00:00
|
|
|
- name: Validate
|
|
|
|
run: make validate
|
|
|
|
|
|
|
|
validate-generate:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: go/src/github.com/traefik/traefik
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
2022-10-21 14:08:05 +00:00
|
|
|
uses: actions/cache@v3
|
2021-07-23 09:00:07 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
|
|
|
key: ${{ runner.os }}-validate-generate-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: ${{ runner.os }}-validate-generate-go-
|
|
|
|
|
|
|
|
- name: go generate
|
|
|
|
run: |
|
|
|
|
go generate
|
|
|
|
git diff --exit-code
|
|
|
|
|
|
|
|
- name: go mod tidy
|
|
|
|
run: |
|
|
|
|
go mod tidy
|
|
|
|
git diff --exit-code
|
|
|
|
|
|
|
|
- name: make generate-crd
|
|
|
|
run: |
|
|
|
|
make generate-crd
|
|
|
|
git diff --exit-code
|