Merge pull request #477 from akutz/feature/update-setup-python-gh-action #22
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.21.9 | |
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 | |
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 | |
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-manager: | |
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 Manager | |
run: make manager-only | |
build-web-console-validator: | |
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 Web Console Validator | |
run: make web-console-validator-only | |
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: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- 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 |