✨ Unifiy build process up and downstream #3050
Workflow file for this run
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 | |
env: | |
GO_VERSION: 1.23 | |
on: | |
pull_request: | |
branches: | |
- main | |
- 'release/**' | |
push: | |
branches: | |
- main | |
#jobs: | |
# | |
# lint-markdown: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v4 | |
# - name: Lint Markdown | |
# run: make lint-markdown | |
# | |
# lint-shell: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v4 | |
# - name: Lint Shell | |
# run: make lint-shell | |
jobs: | |
verify-docs: | |
# needs: | |
# - lint-markdown | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: 'docs/requirements.txt' | |
- name: Install Doc Requirements | |
run: pip install -r docs/requirements.txt | |
- name: Verify Docs | |
run: make docs-build-python | |
verify-go-modules: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Run go mod tidy | |
run: make modules | |
- name: Verify go modules have not changed | |
run: git diff --exit-code | |
- name: Run go mod download | |
run: make modules-download | |
verify-codegen: | |
needs: | |
- verify-go-modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
cache-dependency-path: 'pkg/util/cloudinit/schema/package-lock.json' | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Verify codegen | |
run: make verify-codegen | |
verify-manifests: | |
needs: | |
- verify-go-modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Create kind cluster | |
id: create_kind_cluster | |
run: make kind-up | |
env: | |
KIND_IMAGE: kindest/node:v1.31.1 | |
- name: Verify the manifests | |
run: make verify-wcp-manifests | |
- name: Destroy kind cluster | |
run: make kind-down | |
if: steps.create_kind_cluster.outcome == 'success' | |
lint-go: | |
needs: | |
- verify-go-modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Setup the cache for golangci-lint | |
uses: actions/cache@v4 | |
with: | |
key: golangci-lint-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'hack/tools/go.sum') }} | |
path: | | |
~/.cache/golangci-lint | |
hack/tools/bin/golangci-lint | |
- name: Lint Go | |
run: make lint-go-full | |
vulncheck-go: | |
needs: | |
- verify-go-modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Setup the cache for govulncheck | |
uses: actions/cache@v4 | |
with: | |
key: govulncheck-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'hack/tools/go.sum') }} | |
path: | | |
hack/tools/bin/govulncheck | |
- name: Vulncheck Go | |
run: make vulncheck-go | |
build-image: | |
needs: | |
- verify-go-modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Build Image | |
run: GOOS=linux GOARCH=amd64 make image-build | |
test: | |
needs: | |
- verify-go-modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: true | |
cache-dependency-path: '**/go.sum' | |
- name: Test | |
run: make test | |
- name: Convert coverage to XML report | |
run: make coverage-xml | |
- name: Produce code coverage report | |
uses: irongut/[email protected] | |
with: | |
filename: cover.xml | |
badge: true | |
fail_below_min: true | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '79 89' # really '80 90', but the values are not inclusive | |
- name: Save pull request ID | |
if: github.event_name == 'pull_request' | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
echo "${PR_NUMBER}" >pull_request_id | |
- name: Store code coverage results | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-results | |
path: | | |
code-coverage-results.md | |
pull_request_id |