diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index cc050d4..357e624 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -73,6 +73,7 @@ jobs: version: latest skip-cache: true args: --timeout=3m --skip-dirs=charts + test-golang: name: Run tests runs-on: ubuntu-24.04 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 2c3698e..5c736f9 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -58,20 +58,7 @@ jobs: - name: Build binaries run: | - for goos in darwin linux windows; do - for goarch in amd64 arm arm64; do - # Skip unsupported combinations - if [[ "$goos" == "darwin" && "$goarch" == "arm" ]]; then continue; fi - if [[ "$goos" == "windows" && ! "$goarch" == "amd64" ]]; then continue; fi - - output_file="${{github.repository}}-$goos-$goarch" - if [[ "$goos" == "windows" ]]; then output_file="$output_file.exe"; fi - - GOOS=$goos GOARCH=$goarch CGO_ENABLED=0 go build -o $output_file cmd/dogkat/main.go - files="$files\n$output_file" - done - done - echo "files=$files" >> $GITHUB_ENV + make all VERSION=${{ github.ref_name }} - name: Release Notes run: | @@ -82,7 +69,13 @@ jobs: with: body_path: ".github/RELEASE-TEMPLATE.md" draft: false - files: ${{ env.files }} + files: + bin/dogkat-linux-amd64 + bin/dogkat-linux-arm64 + bin/dogkat-darwin-amd64 + bin/dogkat-darwin-arm64 + bin/dogkat-windows-amd64 + bin/dogkat-windows-arm64 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0edb6..8e64a5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ ### Deprecated +## [ 2024/10/30 - v0.1.13 ] + +### Changed/Added +* Updated modules +* Updated pipeline +* Updated app and chart versions + ## [ 2024/09/19 - v0.1.12 ] ### Changed/Added diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8be1bd3 --- /dev/null +++ b/Makefile @@ -0,0 +1,79 @@ +# Application version encoded in all the binaries. +VERSION = 0.0.0 + +# Base go module name. +MODULE := $(shell cat go.mod | grep -m1 module | awk '{print $$2}') + +# Git revision. +REVISION := $(shell git rev-parse HEAD) + +# Some sane defaults +SHELL = /usr/bin/env bash +BINDIR := $(CURDIR)/bin +BINNAME ?= dogkat +PREFIX = $(HOME)/bin + +# Sources for building +SOURCES := $(shell find . -type f -name *.go) go.mod go.sum + +# Golang info +GOPATH := $(shell go env GOPATH) +GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin) + +# Some flags for the build to set revision and versions +FLAGS=-trimpath -ldflags "-X $(MODULE)/pkg/constants.Version=$(VERSION) -X $(MODULE)/pkg/constants.Revision=$(REVISION)" + +# The targets to build +TARGET_BINARIES := dogkat-linux-amd64 dogkat-linux-arm64 dogkat-darwin-amd64 dogkat-darwin-arm64 dogkat-windows-amd64 dogkat-windows-arm64 + +.PHONY: all +all: $(TARGET_BINARIES) # Make all depend on the binaries +# Create output directories (this can be simplified) +$(BINDIR): + mkdir -p $@ + +# Build linux-amd64 +.PHONY: dogkat-linux-amd64 +dogkat-linux-amd64: $(SOURCES) | $(BINDIR) + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build $(FLAGS) -o $(BINDIR)/$@ cmd/dogkat/main.go + +# Build linux-arm64 +.PHONY: dogkat-linux-arm64 +dogkat-linux-arm64: $(SOURCES) | $(BINDIR) + GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build $(FLAGS) -o $(BINDIR)/$@ cmd/dogkat/main.go + +# Build darwin-amd64 +.PHONY: dogkat-darwin-amd64 +dogkat-darwin-amd64: $(SOURCES) | $(BINDIR) + GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build $(FLAGS) -o $(BINDIR)/$@ cmd/dogkat/main.go + +# Build darwin-arm64 +.PHONY: dogkat-darwin-arm64 +dogkat-darwin-arm64: $(SOURCES) | $(BINDIR) + GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build $(FLAGS) -o $(BINDIR)/$@ cmd/dogkat/main.go + +# Build windows-amd64 +.PHONY: dogkat-windows-amd64 +dogkat-windows-amd64: $(SOURCES) | $(BINDIR) + GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build $(FLAGS) -o $(BINDIR)/$@.exe cmd/dogkat/main.go + +# Build windows-arm64 +.PHONY: dogkat-windows-arm64 +dogkat-windows-arm64: $(SOURCES) | $(BINDIR) + GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go build $(FLAGS) -o $(BINDIR)/$@.exe cmd/dogkat/main.go + +.PHONY: install +install: + @case $$(uname -s)-$$(uname -m) in \ + Darwin-x86_64) sudo install -o root -g root -m 0755 $(BINDIR)/dogkat-darwin-amd64 $(PREFIX)/dogkat ;; \ + Linux-x86_64) sudo install -o root -g root -m 0755 $(BINDIR)/dogkat-linux-amd64 $(PREFIX)/dogkat ;; \ + Linux-aarch64) sudo install -o root -g root -m 0755 $(BINDIR)/dogkat-linux-arm64 $(PREFIX)/dogkat ;; \ + MINGW64_NT-*) sudo install -o root -g root -m 0755 $(BINDIR)/dogkat-windows-amd64.exe $(PREFIX)/dogkat.exe ;; \ + *) echo "Unsupported platform: $$(uname -s)-$$(uname -m)" ; exit 1 ;; \ + esac + +# Perform license checking. +# This must pass or you will be denied by CI. +.PHONY: license +license: + go run hack/check_license/main.go diff --git a/README.md b/README.md index ef9cd38..30e9ef4 100644 --- a/README.md +++ b/README.md @@ -40,26 +40,32 @@ See below for a comprehensive list of tests and what can be confirmed using this ## Usage -For details on how to use the tool, run `e2e-test --help` +For details on how to use the tool, run `dogkat --help` -## Examples +### Examples -Test core workloads with a defined storage class: +#### Test core workloads with a defined storage class: ```shell -e2e-test validate core --storage-class longhorn +dogkat validate core --storage-class longhorn ``` -Test Ingress with tls: +#### Test Ingress with tls: ```shell -e2e-test validate ingress --storage-class longhorn --ingress-class nginx --enable-tls --annotations cert-manager.io/cluster-issuer=letsencrypt +dogkat validate ingress --storage-class longhorn --ingress-class nginx --enable-tls --annotations cert-manager.io/cluster-issuer=letsencrypt ``` -Test GPU +#### Test GPU ```shell -e2e-test validate gpu --number-of-gpus 1 +dogkat validate gpu --number-of-gpus 1 +``` + +#### Cleanup + +```shell +dogkat delete ``` ## Using The Chart diff --git a/charts/dogkat/Chart.yaml b/charts/dogkat/Chart.yaml index 304afef..b534fd4 100644 --- a/charts/dogkat/Chart.yaml +++ b/charts/dogkat/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: dogkat -version: 0.1.13 -appVersion: 0.1.13 +version: 0.1.14 +appVersion: 0.1.14 type: application maintainers: - name: drew-viles diff --git a/charts/dogkat/README.md b/charts/dogkat/README.md index 3c29813..ba285c8 100644 --- a/charts/dogkat/README.md +++ b/charts/dogkat/README.md @@ -1,6 +1,6 @@ # dogkat -![Version: 0.1.13](https://img.shields.io/badge/Version-0.1.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.13](https://img.shields.io/badge/AppVersion-0.1.13-informational?style=flat-square) +![Version: 0.1.14](https://img.shields.io/badge/Version-0.1.14-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.14](https://img.shields.io/badge/AppVersion-0.1.14-informational?style=flat-square) End-2-End testing for GPUs and some core resources diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 6472d26..6a0026d 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -17,7 +17,6 @@ limitations under the License. package cmd import ( - "fmt" "github.com/drewbernetes/dogkat/pkg/constants" "github.com/spf13/cobra" ) @@ -30,7 +29,7 @@ func NewVersionCmd() *cobra.Command { Short: "Print this command's version", Long: "Print this command's version", Run: func(cmd *cobra.Command, args []string) { - fmt.Println(constants.Version) + constants.VersionPrint() }, } } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 906815b..8db5cb9 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -16,8 +16,25 @@ limitations under the License. package constants +import ( + "fmt" + "os" + "path" +) + +var ( + + // Version is the release version + Version string + + // Revision is the git revision set via the Makefile + Revision string + + // Application is the name of the application set via the Makefile + Application = path.Base(os.Args[0]) +) + const ( - Version = "v0.1.13" ChartName = "dogkat" ReleaseName = "dogkat-testing" RepoURL = "https://drewbernetes.github.io/dogkat" @@ -34,3 +51,7 @@ const ( MetricsPrefix = "dogkat_test" MetricsJobName = "dogkat_workloads" ) + +func VersionPrint() { + fmt.Printf("%s/%s (revision/%s)\n", Application, Version, Revision) +}