Skip to content

✨ test: add comprehensive unit tests and improve code quality #6

✨ test: add comprehensive unit tests and improve code quality

✨ test: add comprehensive unit tests and improve code quality #6

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- "v*.*.*"
pull_request:
branches:
- master
permissions:
contents: read
packages: read
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run go vet
run: go vet ./...
- name: Run tests
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
if: success() || failure()
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
fail_ci_if_error: false
verbose: true
helm-lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.16.0
- name: Lint Helm Chart
run: |
helm lint deploy/cert-manager-alidns-webhook
docker-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [test, helm-lint]
uses: ./.github/workflows/docker-release.yaml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
helm-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [test, helm-lint]
uses: ./.github/workflows/helm-release.yaml
secrets: inherit
permissions:
contents: write
packages: write
id-token: write
create-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [docker-release, helm-release]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Extract version without prefix
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: |
## Docker Image
```bash
docker pull ghcr.io/crazygit/cert-manager-alidns-webhook:${{ steps.version.outputs.version }}
```
## Helm Chart
```bash
helm install cert-manager-alidns-webhook oci://ghcr.io/crazygit/helm-charts/cert-manager-alidns-webhook \
--namespace cert-manager \
--create-namespace \
--version ${{ steps.version.outputs.version }}
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}