Skip to content

Commit

Permalink
chore: changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Meissner committed Oct 18, 2024
1 parent 9d79fe5 commit a4a56b1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
File renamed without changes.
8 changes: 3 additions & 5 deletions .github/workflows/check-tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: check-tests
name: Go Unit Tests
on: pull_request

jobs:
check-tests:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: '1.22'
- run: |
E2E_TEST=true
export E2E_TEST
make test
name: Unit Test
name: Run unit tests for go code in pkg/agent
20 changes: 5 additions & 15 deletions .github/workflows/validate-components.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
name: Validate component manifest
on:
pull_request:
branches:
- master
workflow_dispatch: {}
name: Validate Components
on: pull_request

jobs:
build-and-deploy:
cue:
runs-on: ubuntu-latest
environment: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: '1.22'
- name: 'install cue'
- name: Install cue
run: |
go version
GOPATH="$(go env | grep GOPATH | cut -d= -f2 | tr -d '"')"
export PATH="$PATH:$GOPATH/bin"
pushd /tmp
GO111MODULE=on go install cuelang.org/go/cmd/cue@latest
popd
- name: 'validate components.json'
run: |
GOPATH="$(go env | grep GOPATH | cut -d= -f2 | tr -d '"')"
export PATH="$PATH:$GOPATH/bin"
cue vet -c ./schemas/manifest.cue
cue eval ./schemas/manifest.cue
- name: 'validate components.json'
- name: Validate components.json conforms to cue schema
run: |
GOPATH="$(go env | grep GOPATH | cut -d= -f2 | tr -d '"')"
export PATH="$PATH:$GOPATH/bin"
Expand Down
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,26 @@ generate-kubelet-flags:
compile-proto-files:
@./hack/tools/bin/buf generate -o . --path ./pkg/proto/ --template ./pkg/proto/buf.gen.yaml

.PHONY: generate
generate: bootstrap
@echo $(GOFLAGS)
.PHONY: generate-manifest
generate-manifest:
./hack/tools/bin/cue export ./schemas/manifest.cue > ./parts/linux/cloud-init/artifacts/manifest.json
@echo "#EOF" >> ./parts/linux/cloud-init/artifacts/manifest.json
GENERATE_TEST_DATA="true" go test ./pkg/agent...
@echo "running validate-shell to make sure generated cse scripts are correct"

# To replace the old monolithic 'generate' target for running go tests, generating test data, and other validations
.PHONY: validate
validate: generate
@echo "Running validate-shell to make sure generated cse scripts are correct"
@$(MAKE) validate-shell
@echo "Running shellspec tests to validate shell/bash scripts"
@$(MAKE) shellspec
@echo "Validating if components.json conforms to the schema schemas/components.cue."
@echo "Error will be shown if any."
@$(MAKE) validate-components

.PHONY: generate
generate: bootstrap
@echo $(GOFLAGS)
GENERATE_TEST_DATA="true" go test ./pkg/agent...

.PHONY: validate-prefetch
validate-prefetch:
make -C ./vhdbuilder/prefetch generate
Expand Down Expand Up @@ -171,10 +179,9 @@ endif
ginkgoBuild: generate
make -C ./test/e2e ginkgo-build

test: generate
test:
go test ./...


.PHONY: test-style
test-style: validate-go validate-shell validate-copyright-headers

Expand Down

0 comments on commit a4a56b1

Please sign in to comment.