Skip to content

Commit 899fb1c

Browse files
authored
Merge pull request #3692 from wasp-lang/filip-release-0.20.1
Reintroduce 0.20.1 changes to release: #3692
2 parents 021f8e7 + 801e316 commit 899fb1c

File tree

240 files changed

+5835
-5823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+5835
-5823
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Prepare for Deploy Test
2+
description: |
3+
Sets up the environment for deployment testing by:
4+
- Setting up Haskell toolchain
5+
- Setting up Node.js
6+
- Installing the Wasp CLI
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Setup Haskell
12+
uses: ./.github/actions/setup-haskell
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v6
16+
with:
17+
cache: "npm"
18+
node-version: lts/*
19+
20+
- name: Install Wasp CLI
21+
working-directory: waspc
22+
shell: bash
23+
run: ./run install
Lines changed: 93 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: "Test - Wasp Deploy"
22

33
on:
4+
push:
5+
# TODO: remove before merging this PR
6+
branches:
7+
- miho-railway-deployment-test-ci
48
workflow_call:
59
secrets:
610
FLY_GITHUB_TESTING_TOKEN:
@@ -10,114 +14,138 @@ on:
1014

1115
env:
1216
WASP_TELEMETRY_DISABLE: 1
13-
14-
APP_PREFIX: ci-${{ github.sha }}
17+
# - We use run_id because it's shorter than commit SHA since
18+
# the max length for project name in Railway is 25 characters.
19+
# - We append run_attempt to avoid name collisions on job retries,
20+
# becuase run_id is the same across retries.
21+
APP_PREFIX: ci-${{ github.run_id }}-${{ github.run_attempt }}
22+
APP_TO_DEPLOY: examples/kitchen-sink
1523
FLY_API_TOKEN: ${{ secrets.FLY_GITHUB_TESTING_TOKEN }}
1624
FLY_REGION: dfw
17-
APP_TO_DEPLOY: examples/kitchen-sink
25+
FLY_ORG: wasp-testing
26+
RAILWAY_API_TOKEN: ${{ secrets.RAILWAY_GITHUB_TESTING_TOKEN }}
27+
RAILWAY_WASP_WORKSPACE_ID: ${{ secrets.RAILWAY_WASP_WORKSPACE_ID }}
1828

1929
jobs:
20-
fly_deploy_app:
21-
name: Deploy Wasp app
22-
30+
test_fly_deployment:
31+
name: Test Fly deployment
2332
runs-on: ubuntu-latest
24-
2533
environment:
2634
name: fly-deploy-test
2735

2836
steps:
2937
- uses: actions/checkout@v6
3038

31-
- uses: ./.github/actions/setup-haskell
32-
33-
- uses: actions/setup-node@v6
34-
with:
35-
cache: "npm"
36-
node-version: "22"
37-
38-
- name: Install Wasp CLI
39-
working-directory: waspc
40-
run: ./run install
39+
- uses: ./.github/actions/prepare-deploy-test
4140

41+
- name: Install Fly CLI
4242
# NOTE: We tell users to install the latest version of Fly CLI,
4343
# so we use it here too.
44-
- uses: superfly/flyctl-actions/setup-flyctl@v1
44+
uses: superfly/flyctl-actions/setup-flyctl@v1
4545

46-
- name: Deploy App to Fly.io
46+
- name: Deploy app to Fly
4747
working-directory: ${{ env.APP_TO_DEPLOY }}
4848
run: |
49-
set -e
50-
5149
# `fly launch` fails if Fly toml files already exist.
52-
rm -f fly-server.toml fly-client.toml
53-
54-
# NOTE: This assumes env var values don't contain:
55-
# - The character `#`.
56-
# - An empty line (i.e., there are no multiline env values).
57-
mapfile -t ENV_VAR_ARGUMENTS < <(
58-
cat .env.server.example |
59-
sed -E 's/#.*//' |
60-
awk 'NF {$1=$1;print}' |
61-
sed -E 's/^/--server-secret\n/'
62-
)
50+
rm -f fly-server.toml fly-client.toml
6351
6452
echo "Deploying with prefix: $APP_PREFIX"
53+
mapfile -d $'\0' -t ENV_VAR_ARGUMENTS < <(node ../../scripts/deploy-test/prepare-deploy-secrets.mjs .env.server.example)
6554
# NOTE:
6655
# - The `yes` command is necessary because the `fly launch` command
6756
# prompts for confirmation.
6857
# - We use a Bash array for `$ENV_VAR_ARGUMENTS` to ensure proper
6958
# word splitting (i.e., force Bash to interpret the flags separately
7059
# instead of passing it as a single string value).
71-
yes | wasp-cli deploy fly launch "$APP_PREFIX" "$FLY_REGION" --org wasp-testing "${ENV_VAR_ARGUMENTS[@]}"
60+
yes | wasp-cli deploy fly launch "$APP_PREFIX" "$FLY_REGION" --org "$FLY_ORG" "${ENV_VAR_ARGUMENTS[@]}"
7261
73-
- name: Save deployed app hostnames
74-
id: save_hostnames
62+
- name: Smoke test deployed app
7563
working-directory: ${{ env.APP_TO_DEPLOY }}
7664
run: |
77-
echo "server_hostname=$(flyctl status -j -c fly-server.toml | jq -r '.Hostname')" >> "$GITHUB_OUTPUT"
78-
echo "client_hostname=$(flyctl status -j -c fly-client.toml | jq -r '.Hostname')" >> "$GITHUB_OUTPUT"
79-
80-
outputs:
81-
server_hostname: ${{ steps.save_hostnames.outputs.server_hostname }}
82-
client_hostname: ${{ steps.save_hostnames.outputs.client_hostname }}
83-
84-
smoke_test_app:
85-
name: Run smoke tests on deployed app
86-
87-
runs-on: ubuntu-latest
88-
needs: fly_deploy_app
89-
env:
90-
SERVER_HOSTNAME: ${{ needs.fly_deploy_app.outputs.server_hostname }}
91-
CLIENT_HOSTNAME: ${{ needs.fly_deploy_app.outputs.client_hostname }}
92-
93-
steps:
94-
- name: Smoke test the server
95-
run: |
96-
curl --fail --silent -X POST https://$SERVER_HOSTNAME/operations/get-date | jq '.json'
97-
98-
- name: Smoke test the client
99-
run: |
100-
curl --fail --silent https://$CLIENT_HOSTNAME | grep 'Wasp Kitchen Sink'
101-
102-
fly_destroy_app:
65+
# Get deployed app hostnames
66+
function get_fly_app_hostname() {
67+
config_file="$1"
68+
flyctl status -j -c "$config_file" | jq -r '.Hostname'
69+
}
70+
SERVER_HOSTNAME=$(get_fly_app_hostname fly-server.toml)
71+
CLIENT_HOSTNAME=$(get_fly_app_hostname fly-client.toml)
72+
73+
# Run smoke test
74+
../../scripts/deploy-test/smoke-test-deployed-test-app.sh "https://$SERVER_HOSTNAME" "https://$CLIENT_HOSTNAME"
75+
76+
cleanup_fly_deploy_test:
77+
name: Clean up Fly deployment test apps
10378
runs-on: ubuntu-latest
104-
name: Clean up deployed Fly app
105-
needs: [fly_deploy_app, smoke_test_app]
79+
needs: test_fly_deployment
10680
# NOTE: Fly deployments can sometimes "fail" but still deploy the apps. We
10781
# want to always clean them up.
10882
if: always()
10983

11084
steps:
11185
- uses: superfly/flyctl-actions/setup-flyctl@v1
11286
with:
113-
# NOTE: We pinned the Fly because we don't want the changes in the
87+
# NOTE: We pinned the Fly version because we don't want the changes in the
11488
# Fly CLI to affect our cleanup procedure. `fly destroy` isn't a part
11589
# of Wasp, we're just incidentally using the same tool Wasp uses.
11690
version: v0.3.164
11791

118-
- name: Clean up testing app from Fly.io
92+
- name: Clean up test apps
11993
run: |
12094
# NOTE: We are relying on Wasp's naming conventions here
12195
flyctl apps destroy -y $APP_PREFIX-server || true
12296
flyctl apps destroy -y $APP_PREFIX-client || true
12397
flyctl apps destroy -y $APP_PREFIX-db || true
98+
99+
test_railway_deployment:
100+
name: Test Railway deployment
101+
runs-on: ubuntu-latest
102+
environment:
103+
name: railway-deploy-test
104+
105+
steps:
106+
- uses: actions/checkout@v5
107+
108+
- uses: ./.github/actions/prepare-deploy-test
109+
110+
- name: Install Railway CLI
111+
run: npm install -g @railway/cli@4.11.1
112+
113+
- name: Deploy app to Railway
114+
working-directory: ${{ env.APP_TO_DEPLOY }}
115+
run: |
116+
echo "Deploying with prefix: $APP_PREFIX"
117+
mapfile -d $'\0' -t ENV_VAR_ARGUMENTS < <(node ../../scripts/deploy-test/prepare-deploy-secrets.mjs .env.server.example)
118+
# NOTE:
119+
# - We use a Bash array for `$ENV_VAR_ARGUMENTS` to ensure proper
120+
# word splitting (i.e., force Bash to interpret the flags separately
121+
# instead of passing it as a single string value).
122+
wasp-cli deploy railway launch "$APP_PREFIX" --workspace $RAILWAY_WASP_WORKSPACE_ID "${ENV_VAR_ARGUMENTS[@]}"
123+
124+
- name: Smoke test deployed app
125+
working-directory: ${{ env.APP_TO_DEPLOY }}
126+
run: |
127+
# Get deployed app hostnames
128+
function get_railway_service_hostname() {
129+
service_name="$1"
130+
railway status --json | jq -r --arg NAME "$service_name" '.services.edges[] | select(.node.name == $NAME) | .node.serviceInstances.edges[0].node.domains.serviceDomains[0].domain'
131+
}
132+
server_service_name="${APP_PREFIX}-server"
133+
client_service_name="${APP_PREFIX}-client"
134+
SERVER_HOSTNAME=$(get_railway_service_hostname "$server_service_name")
135+
CLIENT_HOSTNAME=$(get_railway_service_hostname "$client_service_name")
136+
137+
# Run smoke test
138+
../../scripts/deploy-test/smoke-test-deployed-test-app.sh "https://$SERVER_HOSTNAME" "https://$CLIENT_HOSTNAME"
139+
140+
cleanup_railway_deploy_test:
141+
name: Clean up Railway deployment project
142+
runs-on: ubuntu-latest
143+
needs: test_railway_deployment
144+
# NOTE: Railway deployments can sometimes "fail" but still deploy the apps. We
145+
# want to always clean them up.
146+
if: always()
147+
steps:
148+
- uses: actions/checkout@v5
149+
150+
- name: Clean up test project
151+
run: node ./scripts/deploy-test/cleanup-railway-project.mjs "$APP_PREFIX"

.github/workflows/ci-examples-test.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ jobs:
5555
DATABASE_PROVIDER=$($GITHUB_WORKSPACE/scripts/get-wasp-database-provider.sh wasp-cli)
5656
echo "provider=$DATABASE_PROVIDER" >> $GITHUB_OUTPUT
5757
58+
- name: Prepare wasp-app-runner
59+
working-directory: wasp-app-runner
60+
run: npm install && npm run build
61+
5862
- name: Run DEV e2e tests for ${{ matrix.example }}
5963
working-directory: examples/${{ matrix.example }}
6064
env:
65+
WASP_APP_RUNNER_CLI_CMD: ${{ github.workspace }}/wasp-app-runner/bin/index.js
6166
WASP_CLI_CMD: wasp-cli
6267
WASP_RUN_MODE: dev
6368
run: npm run test
@@ -67,6 +72,7 @@ jobs:
6772
if: steps.extract-db-provider.outputs.provider != 'sqlite'
6873
working-directory: examples/${{ matrix.example }}
6974
env:
75+
WASP_APP_RUNNER_CLI_CMD: ${{ github.workspace }}/wasp-app-runner/bin/index.js
7076
WASP_CLI_CMD: wasp-cli
7177
WASP_RUN_MODE: build
7278
run: npm run test
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: "Build - Wasp npm packages"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build-outputs:
7+
description: "The returned outputs from the build workflow, as a JSON string"
8+
required: true
9+
type: string
10+
11+
env:
12+
WASP_TELEMETRY_DISABLE: 1
13+
14+
jobs:
15+
make-npm-packages:
16+
runs-on: ubuntu-latest
17+
18+
name: Make npm packages
19+
steps:
20+
- uses: actions/checkout@v6
21+
22+
- name: Compute artifact names for download
23+
uses: ./.github/actions/compute-artifact-names
24+
id: compute-download-artifact-names
25+
with:
26+
build-name: all
27+
28+
- uses: actions/download-artifact@v6
29+
with:
30+
path: "./download/"
31+
pattern: ${{ steps.compute-download-artifact-names.outputs.artifact-name }}
32+
33+
- name: Copy artifacts to input folder
34+
run: |
35+
mkdir -p ./input/
36+
cp ./download/${{ steps.compute-download-artifact-names.outputs.artifact-name }}/* ./input/
37+
38+
- name: Create build metadata file
39+
env:
40+
INPUT_DATA: ${{ inputs.build-outputs}}
41+
JQ_PROGRAM:
42+
# The schema for this file is at `scripts/make-npm-packages/src/schema/input-data.ts`.
43+
# We'll wrangle the data from the build jobs into that schema here.
44+
|
45+
{
46+
version: .waspc_version,
47+
tarballs:
48+
with_entries(select(.key | startswith("output_")))
49+
| map(
50+
fromjson
51+
| {
52+
fileName: .["tarball-name"],
53+
target: (.["npm-target"] | fromjson)
54+
}
55+
)
56+
}
57+
run: echo "$INPUT_DATA" | jq "$JQ_PROGRAM" > ./input/data.json
58+
59+
- uses: actions/setup-node@v6
60+
with:
61+
node-version: "22"
62+
cache: npm
63+
64+
- name: Install dependencies for script
65+
working-directory: ./scripts/make-npm-packages
66+
run: npm ci
67+
68+
- name: Run packager script
69+
run: node ./scripts/make-npm-packages/src/index.ts --input-dir ./input/ --output-dir ./output/
70+
71+
- uses: actions/upload-artifact@v5
72+
with:
73+
name: wasp-npm-packages
74+
path: ./output/

.github/workflows/ci-npm-package-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
path: packages/
1818

1919
- name: Publish Wasp npm packages
20-
run: npx pkg-pr-new publish --bin ./packages/*
20+
run: npx pkg-pr-new publish --bin --compact ./packages/*

.github/workflows/ci-tsspec-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
node-version: lts/*
1919

2020
- name: Install wasp-config dependencies
21-
working-directory: waspc/packages/wasp-config
21+
working-directory: waspc/data/packages/wasp-config
2222
run: npm ci
2323

2424
- name: Run wasp-config tests
25-
working-directory: waspc/packages/wasp-config
25+
working-directory: waspc/data/packages/wasp-config
2626
run: npm run test

0 commit comments

Comments
 (0)