diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index 44a7913e8..950642abd 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -27,25 +27,6 @@ jobs: - name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass. run: exit 1 - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version: "1.22" - - name: setup env - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash - - name: Run linters - run: make install-golangci-lint lint - - name: Run tests - run: make test - test-integration: runs-on: ubuntu-latest steps: @@ -63,8 +44,8 @@ jobs: - uses: replicatedhq/action-k3s@main id: k3s with: - version: v1.24.1-k3s1 - + version: v1.31.2-k3s1 + # test-integration includes unit tests - run: make test-integration ensure-schemas-are-generated: @@ -104,54 +85,6 @@ jobs: name: preflight path: bin/preflight - validate-preflight: - runs-on: ubuntu-latest - needs: compile-preflight - steps: - - uses: replicatedhq/action-k3s@main - id: k3s - with: - version: v1.23.6-k3s1 - - name: Download preflight binary - uses: actions/download-artifact@v4 - with: - name: preflight - path: bin/ - - run: chmod +x bin/preflight - - run: | - set +e - ./bin/preflight --interactive=false --format=json https://preflight.replicated.com > result.json - EXIT_CODE=$? - cat result.json - - EXIT_STATUS=0 - if [ $EXIT_CODE -ne 3 ]; then - echo "Expected exit code of 3 (some checks failed), got $EXIT_CODE" - EXIT_STATUS=1 - fi - - if grep -q "was not collected" result.json; then - echo "Some files were not collected" - EXIT_STATUS=1 - fi - - if (( `jq '.pass | length' result.json` < 1 )); then - echo "No passing preflights found" - EXIT_STATUS=1 - fi - - if (( `jq '.warn | length' result.json` < 1 )); then - echo "No warnings found" - EXIT_STATUS=1 - fi - - if (( `jq '.fail | length' result.json` < 1 )); then - echo "No failed preflights found" - EXIT_STATUS=1 - fi - - exit $EXIT_STATUS - validate-preflight-e2e: runs-on: ubuntu-latest needs: compile-preflight @@ -160,7 +93,7 @@ jobs: - uses: replicatedhq/action-k3s@main id: k3s with: - version: v1.23.6-k3s1 + version: v1.31.2-k3s1 - name: Download preflight binary uses: actions/download-artifact@v4 with: @@ -193,25 +126,6 @@ jobs: name: support-bundle path: bin/support-bundle - validate-supportbundle: - runs-on: ubuntu-latest - needs: compile-supportbundle - steps: - - uses: actions/checkout@v4 - - uses: replicatedhq/action-k3s@main - id: k3s - with: - version: v1.23.6-k3s1 - - name: Download support-bundle binary - uses: actions/download-artifact@v4 - with: - name: support-bundle - path: bin/ - - run: chmod +x bin/support-bundle - - run: ./bin/support-bundle ./examples/support-bundle/sample-collectors.yaml - - run: ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml - - run: ./bin/support-bundle https://kots.io - validate-supportbundle-e2e: runs-on: ubuntu-latest needs: compile-supportbundle @@ -220,7 +134,7 @@ jobs: - uses: replicatedhq/action-k3s@main id: k3s with: - version: v1.23.6-k3s1 + version: v1.31.2-k3s1 - name: Download support bundle binary uses: actions/download-artifact@v4 with: @@ -228,19 +142,12 @@ jobs: path: bin/ - run: chmod +x bin/support-bundle - run: make support-bundle-e2e-test - - validate-supportbundle-e2e-go-test: - runs-on: ubuntu-latest - needs: compile-supportbundle - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.22" - - name: setup env - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash + + # Additional e2e tests for support bundle that run in Go, these create a Kind cluster + validate-supportbundle-e2e-go: + runs-on: ubuntu-latest + needs: compile-supportbundle + steps: - uses: actions/checkout@v4 - name: Download support bundle binary uses: actions/download-artifact@v4 @@ -308,9 +215,8 @@ jobs: goreleaser: runs-on: ubuntu-latest needs: - - validate-preflight - validate-preflight-e2e - - validate-supportbundle + - validate-supportbundle-e2e if: startsWith(github.ref, 'refs/tags/v') steps: - name: Checkout @@ -367,15 +273,12 @@ jobs: validate-pr-tests: runs-on: ubuntu-latest needs: - - test - test-integration - run-examples - compile-collect - - validate-preflight - validate-preflight-e2e - - validate-supportbundle - validate-supportbundle-e2e - - validate-supportbundle-e2e-go-test + - validate-supportbundle-e2e-go - ensure-schemas-are-generated steps: - run: echo "All PR tests passed" diff --git a/Makefile b/Makefile index 391daa8ad..6dbbe16f3 100644 --- a/Makefile +++ b/Makefile @@ -59,8 +59,8 @@ test: generate fmt vet # Go tests that require a K8s instance # TODOLATER: merge with test, so we get unified coverage reports? it'll add 21~sec to the test job though... .PHONY: test-integration -test-integration: - go test -v --tags "integration exclude_graphdriver_devicemapper exclude_graphdriver_btrfs" ${BUILDPATHS} +test-integration: generate fmt vet + go test -v --tags="integration exclude_graphdriver_devicemapper exclude_graphdriver_btrfs" ${BUILDPATHS} .PHONY: preflight-e2e-test preflight-e2e-test: @@ -237,18 +237,6 @@ scan: --ignore-unfixed \ ./ -.PHONY: lint -lint: vet - golangci-lint run --new -c .golangci.yaml --build-tags ${BUILDTAGS} ${BUILDPATHS} - -.PHONY: lint-and-fix -lint-and-fix: fmt vet - golangci-lint run --new --fix -c .golangci.yaml --build-tags ${BUILDTAGS} ${BUILDPATHS} - -.PHONY: install-golangci-lint -install-golangci-lint: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} - .PHONY: watch watch: npm-install bin/watch.js