Skip to content

Commit 2aa7232

Browse files
authored
Merge pull request #4 from wasp-lang/main
Merge from upstream
2 parents 992d6c7 + 8a64bbc commit 2aa7232

File tree

648 files changed

+53193
-26726
lines changed

Some content is hidden

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

648 files changed

+53193
-26726
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
/examples/** linguist-documentation
77

88
**/package-lock.json linguist-generated=true
9+
10+
*.snap linguist-generated
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Compute artifact names
2+
description: Central place for computing the artifact names in the CI builds.
3+
4+
inputs:
5+
build-name:
6+
description: >
7+
The build name (e.g., linux-x86_64, macos-aarch64, etc.). The special
8+
value "all" can be used to receive a glob that matches all of the build
9+
names.
10+
required: true
11+
12+
runs:
13+
using: composite
14+
15+
steps:
16+
- name: Check valid build name
17+
if: >
18+
! contains(
19+
fromJson('[
20+
"all",
21+
"linux-x86_64",
22+
"linux-x86_64-static",
23+
"macos-x86_64",
24+
"macos-aarch64",
25+
"macos-universal"
26+
]'),
27+
inputs.build-name
28+
)
29+
shell: sh
30+
run: |
31+
echo '::error::Invalid build name provided: ${{ inputs.build-name }}.'
32+
exit 1
33+
34+
- name: Set artifact names
35+
id: set-artifact-names
36+
shell: sh
37+
env:
38+
BUILD_NAME: ${{ inputs.build-name == 'all' && '*' || inputs.build-name }}
39+
run: |
40+
echo "artifact-name=wasp-cli-${BUILD_NAME}" >> $GITHUB_OUTPUT
41+
echo "tarball-name=wasp-${BUILD_NAME}.tar.gz" >> $GITHUB_OUTPUT
42+
43+
- name: Set npm target
44+
id: set-npm-target
45+
if: inputs.build-name != 'all' && inputs.build-name != 'macos-universal'
46+
shell: sh
47+
run: |
48+
case '${{ inputs.build-name }}' in
49+
linux-x86_64) npm_target='{"os":"linux","cpu":"x64","libc":"glibc"}' ;;
50+
linux-x86_64-static) npm_target='{"os":"linux","cpu":"x64","libc":"musl"}' ;;
51+
macos-x86_64) npm_target='{"os":"darwin","cpu":"x64"}' ;;
52+
macos-aarch64) npm_target='{"os":"darwin","cpu":"arm64"}' ;;
53+
esac
54+
55+
echo "npm-target=$npm_target" >>"$GITHUB_OUTPUT"
56+
57+
outputs:
58+
artifact-name:
59+
value: ${{ steps.set-artifact-names.outputs.artifact-name }}
60+
description: "The name of the artifact attached to the CI build."
61+
tarball-name:
62+
value: ${{ steps.set-artifact-names.outputs.tarball-name }}
63+
description: "The name of the tarball inside the artifact."
64+
npm-target:
65+
value: ${{ steps.set-npm-target.outputs.npm-target }}
66+
description: "A JSON-encoded object of {os, cpu, libc?} for this build."
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# `fetch-nightly-cli` action
2+
3+
A GitHub Action that fetches the latest nightly CLI build from Wasp's CI runs. This action enables testing against the latest version of Wasp from `main` or from a specific branch/PR.
4+
5+
> [!TIP]
6+
> This action is intended for internal usage only. If you have a Wasp app and you're just looking to install Wasp in your CI, you can use this step instead:
7+
>
8+
> ```yaml
9+
> - run: curl -sSL https://get.wasp.sh/installer.sh | sh -- -v [version]
10+
> ```
11+
12+
## Background
13+
14+
This action provides an internal "nightly" system for Wasp, allowing other repositories and workflows to download and install the binary from the latest successful CI run. The action:
15+
16+
- Fetches the most recent successful build from the specified branch (defaults to `main`).
17+
- Downloads the appropriate binary for the current OS and architecture.
18+
- Can be used to test against PRs by specifying a different branch.
19+
20+
## Usage
21+
22+
### Basic example
23+
24+
Fetch the latest nightly build from `main` and install it:
25+
26+
```yaml
27+
- uses: wasp-lang/wasp/.github/actions/fetch-nightly-cli@main
28+
- run: curl -sSL https://get.wasp.sh/installer.sh | sh -- -f wasp-*.tar.gz
29+
```
30+
31+
The wildcard `wasp-*.tar.gz` is used because the artifact has a different name depending on the OS and architecture. The `-f` flag tells the installer to use the locally downloaded file.
32+
33+
### Fetch from a specific branch
34+
35+
To test against a specific branch or PR:
36+
37+
```yaml
38+
- uses: wasp-lang/wasp/.github/actions/fetch-nightly-cli@main
39+
with:
40+
branch: my-feature-branch
41+
- run: curl -sSL https://get.wasp.sh/installer.sh | sh -- -f wasp-*.tar.gz
42+
```
43+
44+
### Custom output directory
45+
46+
Download the CLI package to a specific directory:
47+
48+
```yaml
49+
- uses: wasp-lang/wasp/.github/actions/fetch-nightly-cli@main
50+
with:
51+
output-dir: ./bin
52+
- run: curl -sSL https://get.wasp.sh/installer.sh | sh -- -f bin/wasp-*.tar.gz
53+
```

.github/actions/fetch-nightly-cli/action.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ runs:
1919
using: composite
2020

2121
steps:
22+
- name: Compute artifact names
23+
uses: ./.github/actions/compute-artifact-names
24+
id: compute-artifact-names
25+
with:
26+
build-name: ${{ runner.os == 'Linux' && 'linux' || 'macos' }}-${{ runner.arch == 'ARM64' && 'aarch64' || 'x86_64' }}
27+
2228
- name: Get latest successful run ID
2329
id: get_run_id
2430
shell: bash
@@ -32,6 +38,14 @@ runs:
3238
--json databaseId \
3339
--jq '.[0].databaseId'
3440
)
41+
42+
if [ -z "$run_id" ]; then
43+
# Using the ::error:: prefix lets GitHub handle it as a special string, and shows up as a red error in the logs.
44+
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-an-error-message
45+
echo "::error::No successful workflow runs found for branch '$BRANCH'."
46+
exit 1
47+
fi
48+
3549
echo "run_id=$run_id" >> $GITHUB_OUTPUT
3650
env:
3751
GH_REPO: wasp-lang/wasp
@@ -53,7 +67,9 @@ runs:
5367
GH_TOKEN: ${{ inputs.token }}
5468
RUN_ID: ${{ steps.get_run_id.outputs.run_id }}
5569
OUTPUT_DIR: ${{ inputs.output-dir }}
56-
ARTIFACT_NAME:
57-
# This is the name of the artifact (not the file), which must be in sync with:
58-
# /.github/workflows/ci-waspc-build.yaml
59-
"wasp-cli-${{ runner.os == 'Linux' && 'linux' || 'macos' }}-${{ runner.arch == 'ARM64' && 'aarch64' || 'x86_64' }}"
70+
ARTIFACT_NAME: ${{ steps.compute-artifact-names.outputs.artifact-name }}
71+
72+
outputs:
73+
artifact-path:
74+
description: "The path to the downloaded artifact directory."
75+
value: ${{ inputs.output-dir }}/${{ steps.compute-artifact-names.outputs.artifact-name }}

.github/actions/setup-haskell/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ inputs:
99
description: |
1010
The version of GHC to install.
1111
required: false
12-
default: "9.0.2"
12+
default: "9.6.7"
1313

1414
cabal-version:
1515
description: |
1616
The version of Cabal to install.
1717
required: false
18-
default: "3.10.2.0"
18+
default: "3.12.1.0"
1919

2020
cabal-project-dir:
2121
description: |

.github/pull_request_template.md

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,59 @@
1-
### Description
1+
<!--
2+
Thanks for contributing to Wasp!
3+
Make sure to follow this PR template, so that we can speed up the review process.
4+
It will also help you not forget important steps when making a change.
5+
If you don't know how to fill any of the sections below, it's okay to leave
6+
them blank and ask for help.
7+
-->
28

3-
> Describe your PR! If this PR closes an issue, use “Fixes #(issue_number)" syntax so GitHub will auto-close it when merged.
9+
## Description
410

5-
### Select what type of change this PR introduces:
11+
Replace this message here, and write a high-level overview with any additional
12+
context (motivation, trade-offs, approaches considered, concerns, ...).
613

7-
1. [ ] **Just code/docs improvement** (no functional change).
8-
2. [ ] **Bug fix** (non-breaking change which fixes an issue).
9-
3. [ ] **New feature** (non-breaking change which adds functionality).
10-
4. [ ] **Breaking change** (fix or feature that would cause existing functionality to not work as expected).
14+
## Type of change
1115

12-
### Update Waspc ChangeLog and version if needed
16+
<!-- Select just one with [x] -->
1317

14-
If you did a **bug fix, new feature, or breaking change**, that affects `waspc`, make sure you satisfy the following:
18+
- [ ] **🔧 Just code/docs improvement** <!-- no functional change -->
19+
- [ ] **🐞 Bug fix** <!-- non-breaking change which fixes an issue -->
20+
- [ ] **🚀 New/improved feature** <!-- non-breaking change which adds functionality -->
21+
- [ ] **💥 Breaking change** <!-- fix or feature that would cause existing functionality to not work as expected -->
1522

16-
1. [ ] I updated [`ChangeLog.md`](https://github.com/wasp-lang/wasp/blob/main/waspc/ChangeLog.md) with description of the change this PR introduces.
17-
2. [ ] I bumped `waspc` version in [`waspc.cabal`](https://github.com/wasp-lang/wasp/blob/main/waspc/waspc.cabal) to reflect changes I introduced, with regards to the version of the latest wasp release, if the bump was needed.
23+
## Checklist
1824

19-
### Add a regression test if needed
25+
<!--
26+
Check all the applicable boxes with [x], and leave the rest empty.
27+
If you're unsure about any of them, don't hesitate to ask for help.
28+
-->
2029

21-
If you did a **bug fix**, make sure you satisfy the following:
30+
- [ ] I tested my change in a Wasp app to verify that it works as intended.
2231

23-
1. [ ] I added a regression test that reproduces the bug and verifies the fix.
32+
- 🧪 Tests and apps:
2433

25-
If you're unable to add a regression test, please explain why.
26-
This likely indicates that our current testing setup needs improvement.
34+
- [ ] I added **unit tests** for my change. <!-- If not, explain why. -->
35+
- [ ] _(if you fixed a bug)_ I added a **regression test** for the bug I fixed. <!-- If not, explain why. -->
36+
- [ ] _(if you added/updated a feature)_ I added/updated **e2e tests** in `examples/kitchen-sink/e2e-tests`.
37+
- [ ] _(if you added/updated a feature)_ I updated the **starter templates** in `waspc/data/Cli/templates`, as needed.
38+
- [ ] _(if you added/updated a feature)_ I updated the **example apps** in `examples/`, as needed.
39+
- [ ] _(if you updated `examples/tutorials`)_ I updated the tutorial in the docs (and vice versa).
2740

28-
### Test Coverage
41+
- 📜 Documentation:
2942

30-
Please ensure your changes are adequately tested:
43+
- [ ] _(if you added/updated a feature)_ I **added/updated the documentation** in `web/docs/`.
3144

32-
1. [ ] **My changes are covered by tests** (unit, integration, or e2e tests as appropriate).
45+
- 🆕 Changelog: _(if change is more than just code/docs improvement)_
46+
- [ ] I updated `waspc/ChangeLog.md` with a **user-friendly** description of the change.
47+
- [ ] _(if you did a breaking change)_ I added a step to the current **migration guide** in `web/docs/migration-guides/`.
48+
- [ ] I **bumped the `version`** in `waspc/waspc.cabal` to reflect the changes I introduced.
3349

34-
If you're unable to add tests or if coverage is partial, please explain why below:
50+
<!--
51+
Bumping the version on `waspc/waspc.cabal`:
3552
36-
<!-- Provide explanation here if tests are missing or incomplete -->
53+
We still haven't reached 1.0, so the version bumping follows these rules:
54+
- Bug fix: 0.X.+1 (e.g. 0.16.3 bumps to 0.16.4)
55+
- New feature: 0.X.+1 (e.g. 0.16.3 bumps to 0.16.4)
56+
- Breaking change: 0.+1.0 (e.g. 0.16.3 bumps to 0.17.0)
3757
38-
### Update example apps if needed
39-
40-
If you did code changes and **added a new feature**, make sure you satisfy the following:
41-
42-
1. [ ] I updated [`waspc/examples/todoApp`](https://github.com/wasp-lang/wasp/tree/main/waspc/examples/todoApp) and its e2e tests as needed and manually checked it works correctly.
43-
44-
If you did code changes and **updated an existing feature**, make sure you satisfy the following:
45-
46-
1. [ ] I updated [`waspc/examples/todoApp`](https://github.com/wasp-lang/wasp/tree/main/waspc/examples/todoApp) and its e2e tests as needed and manually checked it works correctly.
47-
48-
### Update starter apps if needed
49-
50-
If you did code changes and **updated an existing feature**, make sure you satisfy the following:
51-
52-
1. [ ] I updated [starter skeleton](https://github.com/wasp-lang/wasp/tree/main/waspc/data/Cli/templates/skeleton) as needed and manually checked it works correctly.
53-
2. [ ] I updated [`basic` starter](https://github.com/wasp-lang/wasp/tree/main/waspc/data/Cli/templates/basic) as needed and manually checked it works correctly.
54-
3. [ ] I updated [`todo-ts` starter](https://github.com/wasp-lang/starters/tree/dev/todo-ts) as needed and manually checked it works correctly.
55-
4. [ ] I updated [`embeddings` starter](https://github.com/wasp-lang/starters/tree/dev/embeddings) as needed and manually checked it works correctly.
56-
5. [ ] I updated [`saas` starter](https://github.com/wasp-lang/open-saas/tree/main/template) as needed and manually checked it works correctly.
57-
58-
### Update e2e tests if needed
59-
60-
If you did code changes and changed Wasp's code generation logic, make sure you satisfy the following:
61-
62-
1. [] I updated [e2e tests](https://github.com/wasp-lang/wasp/tree/main/waspc#end-to-end-e2e-tests) as needed and manually checked they are correct.
58+
If the version has already been bumped on `main` since the last release, skip this.
59+
-->

.github/workflows/automation-cache-evict.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- uses: actions/checkout@v5
25+
- uses: actions/checkout@v6
2626

2727
- name: Evict caches
2828
shell: bash
Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,39 @@
11
name: "Automation - Label external PRs"
22

3+
############################################################
4+
# CAUTION: This workflow should not check out the PR code! #
5+
############################################################
6+
# The `pull_request_target` event is only intended for simple automations on the
7+
# PRs themselves (e.g., labeling, commenting). If we checked out the PR code here,
8+
# we would be running untrusted code and giving it access to our repository
9+
# secrets, which is a major security risk.
10+
#
11+
# More info at:
12+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
13+
314
on:
4-
pull_request:
15+
pull_request_target:
516
types:
617
- opened
718
- reopened
8-
9-
env:
10-
internal_team_name: "eng"
11-
external_label_name: "external"
19+
- ready_for_review
1220

1321
jobs:
14-
label-external-pr:
22+
label-external-prs:
1523
name: Label external PRs
16-
1724
runs-on: ubuntu-latest
1825

1926
permissions:
2027
pull-requests: write
2128

22-
steps:
23-
# We're dealing with untrusted input, so we pass inputs as environment
24-
# variables instead of interpolation, following GitHub's advice:
25-
# https://docs.github.com/en/actions/reference/security/secure-use#use-an-intermediate-environment-variable
26-
27-
- name: Check if PR is internal
28-
id: check_pr
29-
run: |
30-
pr_is_internal=$(
31-
gh api "/orgs/$GITHUB_ORG/teams/$TEAM_NAME/members" |
32-
jq --arg author "$AUTHOR_LOGIN" 'map(.login) | contains([$author])'
33-
)
34-
35-
# Output is a JSON boolean
36-
echo "pr_is_internal=$pr_is_internal" >>"$GITHUB_OUTPUT"
37-
38-
env:
39-
AUTHOR_LOGIN: ${{ github.event.sender.login }}
40-
GITHUB_ORG: ${{ github.repository_owner }}
41-
TEAM_NAME: ${{ env.internal_team_name }}
42-
GH_TOKEN: ${{ secrets.WASP_LANG_READ_MEMBERS }}
29+
# We check if the PR comes from a different repo than ours:
30+
if: github.event.pull_request.head.repo.full_name != github.repository
4331

32+
steps:
4433
- name: Label external PR
45-
if: steps.check_pr.outputs.pr_is_internal == 'false'
4634
run: gh pr edit "$PR_NUMBER" --add-label "$LABEL_NAME"
4735
env:
36+
LABEL_NAME: "external"
4837
PR_NUMBER: ${{ github.event.pull_request.number }}
49-
LABEL_NAME: ${{ env.external_label_name }}
5038
GH_TOKEN: ${{ github.token }}
39+
GH_REPO: ${{ github.repository }}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
name: fly-deploy-test
2727

2828
steps:
29-
- uses: actions/checkout@v5
29+
- uses: actions/checkout@v6
3030

3131
- uses: ./.github/actions/setup-haskell
3232

33-
- uses: actions/setup-node@v5
33+
- uses: actions/setup-node@v6
3434
with:
3535
cache: "npm"
3636
node-version: "22"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
- kitchen-sink
2424

2525
steps:
26-
- uses: "actions/checkout@v5"
26+
- uses: "actions/checkout@v6"
2727

2828
- uses: ./.github/actions/setup-haskell
2929
with:
3030
cabal-project-dir: waspc
3131

32-
- uses: actions/setup-node@v5
32+
- uses: actions/setup-node@v6
3333
with:
3434
node-version: lts/*
3535

0 commit comments

Comments
 (0)