adding end to end testing #400
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-static-analysis | |
on: [push, pull_request] | |
jobs: | |
golangci: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: remove deployer container from dockerfile | |
run: sed -ie '/End of builder/,+5d' ./docker/userspacecni/Dockerfile | |
- name: Build the Docker image | |
run: docker build . -f ./docker/userspacecni/Dockerfile -t userspacecni:latest | |
- name: run container | |
run: docker run --name userspacecni -itd userspacecni:latest bash | |
- name: docker copy generated bin api files | |
run: docker cp userspacecni:/root/userspace-cni-network-plugin/cnivpp ./ | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 | |
with: | |
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | |
version: v1.52.2 | |
args: --timeout=20m | |
shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # master | |
hadolint: | |
runs-on: ubuntu-latest | |
name: Hadolint | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- uses: hadolint/[email protected] | |
name: Run Hadolint | |
with: | |
dockerfile: ./docker/userspacecni/Dockerfile | |
ignore: DL3008,DL3059 | |
go-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.2 | |
- name: remove deployer container from dockerfile | |
run: sed -ie '/End of builder/,+5d' ./docker/userspacecni/Dockerfile | |
- name: Build the Docker image | |
run: docker build . -f ./docker/userspacecni/Dockerfile -t userspacecni:latest | |
- name: run container | |
run: docker run --name userspacecni -itd userspacecni:latest bash | |
- name: docker copy generated bin api files | |
run: docker cp userspacecni:/root/userspace-cni-network-plugin/cnivpp ./ | |
- name: Set up Go | |
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | |
with: | |
go-version: 1.20.1 | |
- name: checkout dockerfile to avoid false diff | |
run: git checkout ./docker/userspacecni/Dockerfile | |
# if this fails, run go mod tidy | |
- name: Check if module files are consistent with code | |
run: go mod tidy && go get go.fd.io/govpp/binapigen/[email protected] && git diff --exit-code #need package for bin api but not working with tidy | |
# if this fails, run go mod vendor | |
- name: Check if vendor directory is consistent with go modules | |
run: go mod vendor && git diff --exit-code |