Skip to content

Commit

Permalink
fix: integration tests (hopefully) (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas authored Aug 6, 2023
1 parent 554bd9b commit 0d9a1d9
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -25,20 +23,30 @@ 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

.PHONY: help
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.

Expand All @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions Procfile.integration
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions bin/.ktfmt-0.44.pkg
1 change: 1 addition & 0 deletions bin/ktfmt
32 changes: 32 additions & 0 deletions bin/packages/ktfmt.hcl
Original file line number Diff line number Diff line change
@@ -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",
}
4 changes: 4 additions & 0 deletions bin/packages/ktfmt/ktfmt.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
1 change: 0 additions & 1 deletion scripts/ftl-dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions scripts/integration-tests
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -euo pipefail
export PATH="$PWD/build/release:$PATH"

info() {
echo -e "\033[1;32m$*\033[0m"
Expand All @@ -13,7 +14,6 @@ error() {
build_release() {
info "Building release"
make release
export PATH="$PWD/build/release:$PATH"
}

wipe_database() {
Expand All @@ -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
}
Expand Down

0 comments on commit 0d9a1d9

Please sign in to comment.