Skip to content

Commit

Permalink
fix: re-enable kube test when run-all is present (#2701)
Browse files Browse the repository at this point in the history
fixes: #2689
  • Loading branch information
stuartwdouglas authored Sep 17, 2024
1 parent 53f1e8b commit 8f78ebf
Show file tree
Hide file tree
Showing 54 changed files with 3,085 additions and 35 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,51 @@ jobs:
set -euo pipefail
# shellcheck disable=SC2046
go test -v -race -tags integration -run '^${{ matrix.test }}$' $(git grep -l '^//go:build integration' | xargs grep -l '^func ${{ matrix.test }}' | xargs -I {} dirname ./{})
infrastructure-shard:
name: Shard Infrastructure Tests
if: github.event_name != 'pull_request' || github.event.action == 'enqueued' || contains( github.event.pull_request.labels.*.name, 'run-all')
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extract-tests.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Extract test cases
id: extract-tests
run: |
set -euo pipefail
# shellcheck disable=SC2046
echo "matrix={\"test\":$(jq -c -n '$ARGS.positional' --args $(git grep -l '^//go:build infrastructure' | xargs grep '^func Test' | awk '{print $2}' | cut -d'(' -f1))}" >> "$GITHUB_OUTPUT"
infrastructure-run:
name: Infrastructure Test
if: github.event_name != 'pull_request' || github.event.action == 'enqueued' || contains( github.event.pull_request.labels.*.name, 'run-all')
needs: infrastructure-shard
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.infrastructure-shard.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
cache: true
- name: Build Cache
uses: ./.github/actions/build-cache
- name: Docker Compose
run: docker compose --profile integration up -d --wait
- name: Create DB
run: just init-db
- name: Download Go Modules
run: go mod download
- name: Run ${{ matrix.test }}
run: |
set -euo pipefail
# shellcheck disable=SC2046
go test -v -race -tags infrastructure -run '^${{ matrix.test }}$' $(git grep -l '^//go:build infrastructure' | xargs grep -l '^func ${{ matrix.test }}' | xargs -I {} dirname ./{})
integration-success:
name: Integration Success
needs: [integration-run]
Expand Down
17 changes: 14 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ dev *args:
watchexec -r {{WATCHEXEC_ARGS}} -- "just build-sqlc && ftl dev {{args}}"

# Build everything
build-all: build-protos-unconditionally build-backend build-backend-tests build-frontend build-generate build-sqlc build-zips lsp-generate build-java
build-all: build-protos-unconditionally build-backend build-backend-tests build-frontend build-generate build-sqlc build-zips lsp-generate build-java generate-kube-migrations

# Update the kube config map with the latest schema migrations
generate-kube-migrations:
just k8s update-schema

# Run "go generate" on all packages
build-generate:
Expand All @@ -55,7 +59,7 @@ build +tools: build-protos build-zips build-frontend
if [ "${FTL_DEBUG:-}" = "true" ]; then
for tool in $@; do go build -o "{{RELEASE}}/$tool" -tags release -gcflags=all="-N -l" -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./cmd/$tool"; done
else
for tool in $@; do mk "{{RELEASE}}/$tool" : !(build|integration|node_modules|Procfile*|Dockerfile*) -- go build -o "{{RELEASE}}/$tool" -tags release -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./cmd/$tool"; done
for tool in $@; do mk "{{RELEASE}}/$tool" : !(build|integration|infrastructure|node_modules|Procfile*|Dockerfile*) -- go build -o "{{RELEASE}}/$tool" -tags release -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./cmd/$tool"; done
fi

# Build all backend binaries
Expand All @@ -64,7 +68,7 @@ build-backend:

# Build all backend tests
build-backend-tests:
go test -run ^NONE -tags integration ./...
go test -run ^NONE -tags integration,infrastructure ./...

build-java *args:
mvn -f jvm-runtime/ftl-runtime install {{args}}
Expand Down Expand Up @@ -133,6 +137,13 @@ integration-tests *test:
testName=${1:-}
for i in {1..3}; do go test -fullpath -count 1 -v -tags integration -run "$testName" -p 1 $(find . -type f -name '*_test.go' -print0 | xargs -0 grep -r -l "$testName" | xargs grep -l '//go:build integration' | xargs -I {} dirname './{}') && break; done

# Run integration test(s)
infrastructure-tests *test:
#!/bin/bash
set -euo pipefail
testName=${1:-}
for i in {1..3}; do go test -fullpath -count 1 -v -tags infrastructure -run "$testName" -p 1 $(find . -type f -name '*_test.go' -print0 | xargs -0 grep -r -l "$testName" | xargs grep -l '//go:build infrastructure' | xargs -I {} dirname './{}') && break; done

# Run README doc tests
test-readme *args:
mdcode run {{args}} README.md -- bash test.sh
Expand Down
64 changes: 64 additions & 0 deletions backend/controller/console/testdata/go/console/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f78ebf

Please sign in to comment.