Skip to content

Commit

Permalink
build: improve tilt file waits (#3976)
Browse files Browse the repository at this point in the history
* fix: change back integration upload action to always

* build: add separate build args for check action

* fix: adjust readiness_probe's in Tiltfile

* ci: add readiness_probe to consent

* ci: add readiness_probe to other apps

* build: add price-history-pg healthcheck
  • Loading branch information
vindard authored Feb 11, 2024
1 parent a010255 commit edf3a00
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/check-code-and-unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
id: prepare_args
run: |
ARGS=""
BUILD_ARGS=""
cat <<EOF > labels.json
${{ toJSON(github.event.pull_request.labels.*.name) }}
Expand All @@ -40,21 +41,26 @@ jobs:
case "$LABEL" in
dashboard|consent|pay|admin-panel|map)
ARGS+=" //apps/$LABEL:test"
BUILD_ARGS+=" //apps/$LABEL:node_modules"
;;
core)
ARGS+=" //core/api:test"
BUILD_ARGS+=" //core/api:prod_build"
;;
api-keys|notifications)
ARGS+=" //core/$LABEL:$LABEL"
BUILD_ARGS+=" //core/$LABEL:$LABEL"
;;
esac
done
echo "Prepared args: $ARGS"
echo "Prepared build_args: $BUILD_ARGS"
echo "args=$ARGS" >> "$GITHUB_OUTPUT"
echo "build_args=$BUILD_ARGS" >> "$GITHUB_OUTPUT"
- name: Build via buck2
if: steps.prepare_args.outputs.args != ''
run: nix develop -c buck2 build ${{ steps.prepare_args.outputs.args }}
run: nix develop -c buck2 build ${{ steps.prepare_args.outputs.build_args }}
- name: Run checks and tests via buck2
if: steps.prepare_args.outputs.args != ''
run: nix develop -c buck2 test ${{ steps.prepare_args.outputs.args }}
5 changes: 2 additions & 3 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ jobs:
echo "Prepared args: $ARGS"
echo "args=$ARGS" >> "$GITHUB_OUTPUT"
- name: Build/start deps and run tests via tilt
id: tilt_test
if: steps.prepare_args.outputs.args != ''
run: nix develop -c xvfb-run ./dev/bin/tilt-ci.sh ${{ steps.prepare_args.outputs.args }}
- name: Rename Tilt log
if: steps.tilt_test.outcome == 'success' || steps.tilt_test.outcome == 'failure'
if: always()
run: mv dev/.e2e-tilt.log dev/e2e-tilt.log
- name: Upload Tilt log
if: steps.tilt_test.outcome == 'success' || steps.tilt_test.outcome == 'failure'
if: always()
uses: actions/upload-artifact@v2
with:
name: Tilt log
Expand Down
39 changes: 37 additions & 2 deletions dev/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ local_resource(
"NEXTAUTH_SECRET": "secret",
"PORT": "3001",
},
readiness_probe = probe(
period_secs = 5,
http_get = http_get_action(
path = "/",
port = 3001,
),
),
deps = _buck2_dep_inputs(dashboard_target),
allow_parallel = True,
auto_init = run_apps,
Expand Down Expand Up @@ -91,6 +98,13 @@ local_resource(
serve_cmd = "buck2 run {}".format(pay_target),
env = pay_env,
serve_env = pay_env,
readiness_probe = probe(
period_secs = 5,
http_get = http_get_action(
path = "/",
port = 3002,
),
),
deps = _buck2_dep_inputs(pay_target),
allow_parallel = True,
resource_deps = [
Expand All @@ -117,6 +131,13 @@ local_resource(
serve_cmd = "buck2 run {}".format(admin_panel_target),
env = admin_panel_env,
serve_env = admin_panel_env,
readiness_probe = probe(
period_secs = 5,
http_get = http_get_action(
path = "/",
port = 3004,
),
),
deps = _buck2_dep_inputs(admin_panel_target),
allow_parallel = True,
resource_deps = [
Expand All @@ -142,6 +163,13 @@ local_resource(
serve_cmd = "buck2 run {}".format(map_target),
env = map_env,
serve_env = map_env,
readiness_probe = probe(
period_secs = 5,
http_get = http_get_action(
path = "/",
port = 3005,
),
),
deps = _buck2_dep_inputs(map_target),
allow_parallel = True,
resource_deps = [
Expand Down Expand Up @@ -284,6 +312,13 @@ local_resource(
labels = ["auth"],
cmd = "buck2 build {}".format(consent_target),
serve_cmd = "buck2 run {}".format(consent_target),
readiness_probe = probe(
period_secs = 5,
http_get = http_get_action(
path = "/",
port = 3000,
),
),
deps = _buck2_dep_inputs(consent_target),
allow_parallel = True,
auto_init = run_apps,
Expand Down Expand Up @@ -420,7 +455,7 @@ local_resource(
period_secs = 5,
http_get = http_get_action(
path = "healthz",
port = 4012,
port = 8888,
),
),
deps = _buck2_dep_inputs(api_trigger_target),
Expand Down Expand Up @@ -449,7 +484,7 @@ local_resource(
period_secs = 5,
http_get = http_get_action(
path = "healthz",
port = 4012,
port = 3003,
),
),
deps = _buck2_dep_inputs(api_exporter_target),
Expand Down
5 changes: 5 additions & 0 deletions dev/docker-compose.deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ services:
- POSTGRES_USER=galoy-price-usr
- POSTGRES_PASSWORD=galoy-price-pwd
- POSTGRES_DB=galoy-price-history
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 30s
retries: 5
api-keys-pg:
image: postgres:14.1
environment:
Expand Down

0 comments on commit edf3a00

Please sign in to comment.