refactoring #1469
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.20" | |
- name: Unit tests | |
run: | | |
go test -v -race ./... -covermode=atomic -coverprofile=coverage.out # Run all the tests with the race detector enabled | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Static analysis | |
run: | | |
go vet ./... # go vet is the official Go static analyzer | |
- name: Cyclomatic complexity | |
run: | | |
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | |
/home/runner/go/bin/gocyclo -over 19 main.go pkg # forbid code with huge/complex functions | |
- name: Dry Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: "1.18.2" | |
args: release --snapshot --rm-dist | |
- name: Test if the Binary is Runnable | |
run: "dist/helm-dashboard_linux_amd64_v1/helm-dashboard --help" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: dist/ | |
retention-days: 1 | |
- name: golangci-lint | |
uses: golangci/[email protected] | |
with: | |
# version: latest | |
# skip-go-installation: true | |
skip-pkg-cache: true | |
skip-build-cache: true | |
# args: --timeout=15m | |
image: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Docker meta | |
uses: docker/metadata-action@v3 | |
id: meta | |
with: | |
images: komodorio/helm-dashboard | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: komodorio/helm-dashboard:unstable | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: VER=0.0.0-dev | |
platforms: linux/amd64,linux/arm64 | |
helm_check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Helm Template Check For Sanity | |
uses: igabaydulin/[email protected] | |
env: | |
CHART_LOCATION: ./charts/helm-dashboard | |
CHART_VALUES: ./charts/helm-dashboard/values.yaml | |
- name: Test if the Helm plugin install script is runnable | |
run: | | |
scripts/install_plugin.sh |