From 0d9a1d9c9fb14af23f073768540dc76fb75e9236 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Sun, 6 Aug 2023 19:41:51 +1000 Subject: [PATCH] fix: integration tests (hopefully) (#191) --- .github/workflows/ci.yml | 2 +- Makefile | 16 ++++++++++++---- Procfile.integration | 3 +++ bin/.ktfmt-0.44.pkg | 1 + bin/ktfmt | 1 + bin/packages/ktfmt.hcl | 32 ++++++++++++++++++++++++++++++++ bin/packages/ktfmt/ktfmt.sh | 4 ++++ scripts/ftl-dev | 1 - scripts/integration-tests | 5 ++--- 9 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 Procfile.integration create mode 120000 bin/.ktfmt-0.44.pkg create mode 120000 bin/ktfmt create mode 100644 bin/packages/ktfmt.hcl create mode 100755 bin/packages/ktfmt/ktfmt.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9881967c9..286968158 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: run: shellcheck -e SC2016 scripts/* integration: name: Integration tests - if: startsWith(github.ref, 'refs/heads/gh-readonly-queue/') || github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/Makefile b/Makefile index 4f2bf9c2c..f0a67261c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ VERSION = $(shell git describe --tags --always --dirty) -BINARIES=ftl ftl-controller ftl-runner - COMMON_LOG_IN = backend/common/log/api.go COMMON_LOG_OUT = backend/common/log/log_level_string.go @@ -25,13 +23,14 @@ PROTO_IN = protos/buf.yaml \ PROTO_OUT = protos/xyz/block/ftl/v1/ftlv1connect/ftl.connect.go \ protos/xyz/block/ftl/v1/schema/schema.pb.go \ protos/xyz/block/ftl/v1/console/console.pb.go \ + protos/xyz/block/ftl/v1/schema/runtime.pb.go \ protos/xyz/block/ftl/v1/ftl.pb.go \ console/client/src/protos/xyz/block/ftl/v1/ftl_connect.ts \ console/client/src/protos/xyz/block/ftl/v1/schema/schema_pb.ts \ console/client/src/protos/xyz/block/ftl/v1/schema/runtime_pb.ts \ console/client/src/protos/xyz/block/ftl/v1/ftl_pb.ts \ console/client/src/protos/xyz/block/ftl/v1/console/console_pb.ts - +RELEASE_OUT = build/release/ftl build/release/ftl-controller build/release/ftl-runner .DEFAULT_GOAL := help @@ -39,6 +38,15 @@ PROTO_OUT = protos/xyz/block/ftl/v1/ftlv1connect/ftl.connect.go \ help: ## This help. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' +.PHONY: all +all: generate release ## Generate source and build binaries. + +.PHONY: clean +clean: ## Clean build artifacts. + rm -rf build $(SQLC_OUT) $(SCHEMA_OUT) $(PROTO_OUT) $(COMMON_LOG_OUT) $(RELEASE_OUT) + cd kotlin-runtime/ftl-runtime && gradle clean + cd kotlin-runtime/ftl-plugin && gradle clean + .PHONY: release release: build/release/ftl-controller build/release/ftl-runner build/release/ftl ## Build release binaries. @@ -55,7 +63,7 @@ console/client/dist/index.html: cd console/client && npm install && npm run build .PHONY: generate -generate: $(SQLC_OUT) $(SCHEMA_OUT) $(PROTO_OUT) $(COMMON_LOG_OUT) ## Regenerate source. +generate: $(PROTO_OUT) $(COMMON_LOG_OUT) $(SQLC_OUT) $(SCHEMA_OUT) ## Regenerate source. .PHONY: docker-runner: ## Build ftl-runner docker images. diff --git a/Procfile.integration b/Procfile.integration new file mode 100644 index 000000000..62f55f638 --- /dev/null +++ b/Procfile.integration @@ -0,0 +1,3 @@ +controller: build/release/ftl-controller --key C01H5BRT09Y07547SETZ4HWRA09 --bind http://localhost:8892 +runner0: build/release/ftl-runner --key R01H5BTS6ABP1EHGZSAGJMBV50A --language go --language kotlin --bind http://localhost:8894 --template-dir build/template --deployment-dir build/runner0 +runner1: build/release/ftl-runner --key R01H5BTSGKQ8AZ9S22N9N1SM9HV --language go --language kotlin --bind http://localhost:8895 --template-dir build/template --deployment-dir build/runner1 diff --git a/bin/.ktfmt-0.44.pkg b/bin/.ktfmt-0.44.pkg new file mode 120000 index 000000000..383f4511d --- /dev/null +++ b/bin/.ktfmt-0.44.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/ktfmt b/bin/ktfmt new file mode 120000 index 000000000..680bd7ae7 --- /dev/null +++ b/bin/ktfmt @@ -0,0 +1 @@ +.ktfmt-0.44.pkg \ No newline at end of file diff --git a/bin/packages/ktfmt.hcl b/bin/packages/ktfmt.hcl new file mode 100644 index 000000000..6fa937349 --- /dev/null +++ b/bin/packages/ktfmt.hcl @@ -0,0 +1,32 @@ +description = "ktfmt is a program that pretty-prints (formats) Kotlin code, based on google-java-format." +binaries = ["ktfmt"] +source = "https://repo1.maven.org/maven2/com/facebook/ktfmt/${version}/ktfmt-${version}-jar-with-dependencies.jar" +dont-extract = true + +on "unpack" { + rename { + from = "${root}/ktfmt-${version}-jar-with-dependencies.jar" + to = "${root}/ktfmt.jar" + } + + copy { + from = "ktfmt/ktfmt.sh" + to = "${root}/ktfmt" + mode = 448 + } +} + +version "0.41" "0.40" "0.39" "0.42" "0.43" "0.44" { + auto-version { + github-release = "facebook/ktfmt" + } +} + +sha256sums = { + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.39/ktfmt-0.39-jar-with-dependencies.jar": "72bd918f3e36c18561eefa7eba08221ae80086deccbaf81305710ec421041d8d", + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.40/ktfmt-0.40-jar-with-dependencies.jar": "d6ba1dc635b30dfab0203555d4ebcade78d537cb550402c820c44be43f64c8dd", + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.41/ktfmt-0.41-jar-with-dependencies.jar": "a763c2b24a7dfe3f270ebe652938cf76b1a13fec98b97589f2f788bd152a72d7", + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.42/ktfmt-0.42-jar-with-dependencies.jar": "67901bf2b267750f55422c2ce706224741000cf401f2f202d7070afd4d697a4d", + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.43/ktfmt-0.43-jar-with-dependencies.jar": "ed79f177ac714cf6cf7be4730a2ed061562f02bdb42bbf4bfa9ef2226d82ca45", + "https://repo1.maven.org/maven2/com/facebook/ktfmt/0.44/ktfmt-0.44-jar-with-dependencies.jar": "1d1823ea8943449e8205374fa5e458d9e665e14e4e19c949633f8e94439f919e", +} diff --git a/bin/packages/ktfmt/ktfmt.sh b/bin/packages/ktfmt/ktfmt.sh new file mode 100755 index 000000000..7199e78d9 --- /dev/null +++ b/bin/packages/ktfmt/ktfmt.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +KTFMT_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" +exec java --add-opens java.base/java.lang=ALL-UNNAMED -Xmx512m -jar "${KTFMT_DIR}/ktfmt.jar" "$@" diff --git a/scripts/ftl-dev b/scripts/ftl-dev index 908ff7955..6652502e2 100755 --- a/scripts/ftl-dev +++ b/scripts/ftl-dev @@ -3,7 +3,6 @@ set -euo pipefail prepare_template() ( mkdir -p build/template/ftl/jars build/runner0 build/runner1 - test -d build/libs/ftl-runtime.jar && return 0 cd kotlin-runtime/ftl-runtime gradle jar cp build/libs/ftl-runtime.jar ../../build/template/ftl/jars diff --git a/scripts/integration-tests b/scripts/integration-tests index 74cbe55cb..666b1769d 100755 --- a/scripts/integration-tests +++ b/scripts/integration-tests @@ -1,5 +1,6 @@ #!/bin/bash set -euo pipefail +export PATH="$PWD/build/release:$PATH" info() { echo -e "\033[1;32m$*\033[0m" @@ -13,7 +14,6 @@ error() { build_release() { info "Building release" make release - export PATH="$PWD/build/release:$PATH" } wipe_database() { @@ -35,8 +35,7 @@ wait_for() { start_cluster() { info "Starting cluster" - overmind start -D - overmind echo & + overmind start --procfile Procfile.integration & wait_for "cluster to become ready" "ftl status" trap "overmind quit" EXIT INT TERM }