From 3c996974db52d206c2edeaf29bbe110275283705 Mon Sep 17 00:00:00 2001 From: Drew Malin Date: Fri, 14 Aug 2026 12:12:21 -0700 Subject: [PATCH 1/2] Add Verda validation, remove cron for other validations, move to specific validation run --- .github/workflows/validation-aws.yml | 12 +----- .github/workflows/validation-nebius.yml | 12 +----- .github/workflows/validation-shadeform.yml | 12 +----- .github/workflows/validation-verda.yml | 50 ++++++++++++++++++++++ Makefile | 21 ++++++++- v1/providers/verda/validation_test.go | 12 ------ 6 files changed, 73 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/validation-verda.yml diff --git a/.github/workflows/validation-aws.yml b/.github/workflows/validation-aws.yml index 154edfaa..0f7eecf1 100644 --- a/.github/workflows/validation-aws.yml +++ b/.github/workflows/validation-aws.yml @@ -1,23 +1,13 @@ name: AWS Validation Tests on: - schedule: - # Run daily at 2 AM UTC - - cron: "0 2 * * *" workflow_dispatch: - # Allow manual triggering - pull_request: - paths: - - "v1/providers/aws/**" - - "internal/validation/**" - - "v1/**" - branches: [main] + # Run explicitly from the Actions UI, GitHub CLI, or API. jobs: aws-validation: name: AWS Provider Validation runs-on: ubuntu-latest - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/validation-nebius.yml b/.github/workflows/validation-nebius.yml index 781cd3bf..9f9c3e3c 100644 --- a/.github/workflows/validation-nebius.yml +++ b/.github/workflows/validation-nebius.yml @@ -1,23 +1,13 @@ name: Nebius Validation Tests on: - schedule: - # Run daily at 2 AM UTC - - cron: "0 2 * * *" workflow_dispatch: - # Allow manual triggering - pull_request: - paths: - - "v1/providers/nebius/**" - - "internal/validation/**" - - "v1/**" - branches: [main] + # Run explicitly from the Actions UI, GitHub CLI, or API. jobs: nebius-validation: name: Nebius Provider Validation runs-on: ubuntu-latest - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/validation-shadeform.yml b/.github/workflows/validation-shadeform.yml index e9ead9a8..40d24bf0 100644 --- a/.github/workflows/validation-shadeform.yml +++ b/.github/workflows/validation-shadeform.yml @@ -1,23 +1,13 @@ name: Shadeform Validation Tests on: - schedule: - # Run daily at 2 AM UTC - - cron: '0 2 * * *' workflow_dispatch: - # Allow manual triggering - pull_request: - paths: - - 'v1/providers/shadeform/**' - - 'internal/validation/**' - - 'v1/**' - branches: [ main ] + # Run explicitly from the Actions UI, GitHub CLI, or API. jobs: shadeform-validation: name: Shadeform Provider Validation runs-on: ubuntu-latest - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/validation-verda.yml b/.github/workflows/validation-verda.yml new file mode 100644 index 00000000..b743690e --- /dev/null +++ b/.github/workflows/validation-verda.yml @@ -0,0 +1,50 @@ +name: Verda Validation Tests + +on: + workflow_dispatch: + # Run explicitly from the Actions UI, GitHub CLI, or API. + +jobs: + verda-validation: + name: Verda Provider Validation + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + + - 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: Install dependencies + run: make deps + + - name: Run Verda validation tests + env: + VERDA_CLIENT_ID: ${{ secrets.VERDA_CLIENT_ID }} + VERDA_CLIENT_SECRET: ${{ secrets.VERDA_CLIENT_SECRET }} + TEST_PRIVATE_KEY_BASE64: ${{ secrets.TEST_PRIVATE_KEY_BASE64 }} + TEST_PUBLIC_KEY_BASE64: ${{ secrets.TEST_PUBLIC_KEY_BASE64 }} + VALIDATION_TEST: true + run: | + cd v1/providers/verda + go test -v -short=false -timeout=30m ./... + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: verda-validation-results + path: | + v1/providers/verda/coverage.out diff --git a/Makefile b/Makefile index ad1fbb54..6de6d3ac 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ BINARY_NAME=compute MODULE_NAME=github.com/brevdev/cloud BUILD_DIR=build COVERAGE_DIR=coverage +VALIDATION_REF?=$(shell git branch --show-current) # Load environment variables from .env file if it exists ifneq (,$(wildcard .env)) @@ -79,6 +80,23 @@ test-validation: @echo "Running validation tests..." $(GOTEST) -v -short=false ./... +# Trigger a provider validation workflow in GitHub Actions +.PHONY: trigger-validation +trigger-validation: + @if [ -z "$(PROVIDER)" ]; then \ + echo "Usage: make trigger-validation PROVIDER= [VALIDATION_REF=]"; \ + exit 1; \ + fi + @case "$(PROVIDER)" in \ + aws|nebius|shadeform|verda) ;; \ + *) echo "Unsupported provider: $(PROVIDER). Expected aws, nebius, shadeform, or verda."; exit 1 ;; \ + esac + @if [ -z "$(VALIDATION_REF)" ]; then \ + echo "VALIDATION_REF is required when Git is in a detached HEAD state."; \ + exit 1; \ + fi + gh workflow run validation-$(PROVIDER).yml --ref "$(VALIDATION_REF)" + # Run all tests including validation .PHONY: test-all test-all: @@ -205,6 +223,7 @@ help: @echo " build-all - Build for Linux, macOS, and Windows" @echo " test - Run tests (with -short flag)" @echo " test-validation - Run validation tests (without -short flag)" + @echo " trigger-validation - Trigger one provider validation workflow in GitHub Actions" @echo " test-all - Run all tests including validation" @echo " test-coverage - Run tests with coverage report" @echo " test-race - Run tests with race detection" @@ -221,4 +240,4 @@ help: @echo " docs - Generate documentation" @echo " check - Run all checks (lint, vet, fmt-check, test)" @echo " install-tools - Install development tools" - @echo " help - Show this help message" \ No newline at end of file + @echo " help - Show this help message" diff --git a/v1/providers/verda/validation_test.go b/v1/providers/verda/validation_test.go index 29588f1c..a8f7cb18 100644 --- a/v1/providers/verda/validation_test.go +++ b/v1/providers/verda/validation_test.go @@ -21,18 +21,6 @@ func TestValidationFunctions(t *testing.T) { }) } -func TestGetInstance(t *testing.T) { - checkValidationCredentials(t) - credential := validationCredential() - - client, err := credential.MakeClient(context.Background(), "") - require.NoError(t, err) - - instance, err := client.GetInstance(context.Background(), v1.CloudProviderInstanceID("b395e9e7-9a21-4ff1-a4b5-fb06d9652942")) - require.NoError(t, err) - require.NotNil(t, instance) -} - func TestInstanceLifecycleValidation(t *testing.T) { checkValidationCredentials(t) From f1780bccd3c67ae7c05e9d901125175c4a40540e Mon Sep 17 00:00:00 2001 From: Drew Malin Date: Fri, 14 Aug 2026 12:13:45 -0700 Subject: [PATCH 2/2] cleanup makefile --- Makefile | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 6de6d3ac..f064f9f3 100644 --- a/Makefile +++ b/Makefile @@ -219,25 +219,25 @@ install-tools: .PHONY: help help: @echo "Available targets:" - @echo " build - Build the project" - @echo " build-all - Build for Linux, macOS, and Windows" - @echo " test - Run tests (with -short flag)" - @echo " test-validation - Run validation tests (without -short flag)" + @echo " build - Build the project" + @echo " build-all - Build for Linux, macOS, and Windows" + @echo " test - Run tests (with -short flag)" + @echo " test-validation - Run validation tests (without -short flag)" @echo " trigger-validation - Trigger one provider validation workflow in GitHub Actions" - @echo " test-all - Run all tests including validation" - @echo " test-coverage - Run tests with coverage report" - @echo " test-race - Run tests with race detection" - @echo " bench - Run benchmarks" - @echo " lint - Run linter (golangci-lint)" - @echo " vet - Run go vet" - @echo " fmt - Format code" - @echo " fmt-check - Check if code is formatted" - @echo " security - Run security scan (gosec)" - @echo " clean - Clean build artifacts" - @echo " deps - Install dependencies" - @echo " deps-update - Update dependencies" - @echo " deps-verify - Verify dependencies" - @echo " docs - Generate documentation" - @echo " check - Run all checks (lint, vet, fmt-check, test)" - @echo " install-tools - Install development tools" - @echo " help - Show this help message" + @echo " test-all - Run all tests including validation" + @echo " test-coverage - Run tests with coverage report" + @echo " test-race - Run tests with race detection" + @echo " bench - Run benchmarks" + @echo " lint - Run linter (golangci-lint)" + @echo " vet - Run go vet" + @echo " fmt - Format code" + @echo " fmt-check - Check if code is formatted" + @echo " security - Run security scan (gosec)" + @echo " clean - Clean build artifacts" + @echo " deps - Install dependencies" + @echo " deps-update - Update dependencies" + @echo " deps-verify - Verify dependencies" + @echo " docs - Generate documentation" + @echo " check - Run all checks (lint, vet, fmt-check, test)" + @echo " install-tools - Install development tools" + @echo " help - Show this help message"