Skip to content

Add a state in cloud account config #1528

Add a state in cloud account config

Add a state in cloud account config #1528

Workflow file for this run

name: Go
on:
pull_request:
branches:
- main
- release-*
- feature/*
push:
branches:
- main
- release-*
- feature/*
workflow_run:
workflows: ["Build"]
types:
- complete
jobs:
check-changes:
name: Check whether tests need to be run based on diff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: antrea-io/has-changes@v2
id: check_diff
with:
paths-ignore: docs/* ci/jenkins/* *.md
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}
test-unit:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
name: Unit test
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run unit tests
run: |
mkdir -p $(go env GOPATH)
mkdir -p $(go env GOCACHE)
sudo make unit-test
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-unit.txt
flags: unit-tests
name: codecov-unit-test
golangci-lint:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Check lint
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run golangci-lint
run: |
mkdir -p $(go env GOPATH)
mkdir -p $(go env GOCACHE)
make golangci-lint
check-gen:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
name: Check generation
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Check generate
run: ./ci/check-gen.sh
- name: Check copyright
run: ./ci/check-copyright.sh
verify:
name: Verify docs and spelling
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Go using version from go.mod
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run verify scripts
run: make verify
- name: Checking for broken Markdown links
if: ${{ github.event_name == 'pull_request' }}
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
# Check modified files only for pull requests. Cronjob "Verify docs" takes care of checking all markdown files.
check-modified-files-only: yes
base-branch: ${{ github.base_ref }}
config-file: 'hack/.md_links_config.json'
- name: Markdownlint
run: |
sudo npm install -g [email protected]
make markdownlint
- name: Checking whether autogenerated Helm chart documentation is up-to-date
working-directory: build/charts/
run: |
make helm-docs
DIFF=$(git diff .)
if [ -n "$DIFF" ]; then
echo "The Helm chart documentation is out-of-date; please run 'make helm-docs' in 'build/charts/' and commit the changes"
exit 1
fi