Skip to content

Commit 992d6c7

Browse files
authored
Merge pull request #3 from wasp-lang/main
Sync from upstream
2 parents 9a2dce5 + 3b2034a commit 992d6c7

File tree

1,972 files changed

+116751
-53742
lines changed

Some content is hidden

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

1,972 files changed

+116751
-53742
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
*.hs linguist-detectable=false
44

5-
/examples/* linguist-documentation
5+
/web/** linguist-documentation
6+
/examples/** linguist-documentation
67

78
**/package-lock.json linguist-generated=true
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Fetch nightly CLI
2+
description: From an outside repo, fetch the latest nightly CLI build from Wasp's CI runs.
3+
4+
inputs:
5+
branch:
6+
description: The branch to fetch the nightly build from. Defaults to 'main'.
7+
required: false
8+
default: main
9+
token:
10+
description: GitHub token to authenticate the request.
11+
required: false
12+
default: ${{ github.token }}
13+
output-dir:
14+
description: Directory to download the CLI build into. Defaults to the current directory.
15+
required: false
16+
default: "."
17+
18+
runs:
19+
using: composite
20+
21+
steps:
22+
- name: Get latest successful run ID
23+
id: get_run_id
24+
shell: bash
25+
run: |
26+
run_id=$(
27+
gh run list \
28+
--workflow "$WORKFLOW_NAME" \
29+
--branch "$BRANCH" \
30+
--status success \
31+
--limit 1 \
32+
--json databaseId \
33+
--jq '.[0].databaseId'
34+
)
35+
echo "run_id=$run_id" >> $GITHUB_OUTPUT
36+
env:
37+
GH_REPO: wasp-lang/wasp
38+
GH_TOKEN: ${{ inputs.token }}
39+
BRANCH: ${{ inputs.branch }}
40+
WORKFLOW_NAME:
41+
# This name must be in sync with the name used in:
42+
# /.github/workflows/ci.yaml
43+
"CI"
44+
45+
- name: Download artifact
46+
shell: bash
47+
run: |
48+
gh run download "$RUN_ID" \
49+
--name "$ARTIFACT_NAME" \
50+
--dir "$OUTPUT_DIR"
51+
env:
52+
GH_REPO: wasp-lang/wasp
53+
GH_TOKEN: ${{ inputs.token }}
54+
RUN_ID: ${{ steps.get_run_id.outputs.run_id }}
55+
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' }}"

.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: "8.10.7"
12+
default: "9.0.2"
1313

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

2020
cabal-project-dir:
2121
description: |

.github/pull_request_template.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ If you did a **bug fix**, make sure you satisfy the following:
2525
If you're unable to add a regression test, please explain why.
2626
This likely indicates that our current testing setup needs improvement.
2727

28+
### Test Coverage
29+
30+
Please ensure your changes are adequately tested:
31+
32+
1. [ ] **My changes are covered by tests** (unit, integration, or e2e tests as appropriate).
33+
34+
If you're unable to add tests or if coverage is partial, please explain why below:
35+
36+
<!-- Provide explanation here if tests are missing or incomplete -->
37+
2838
### Update example apps if needed
2939

3040
If you did code changes and **added a new feature**, make sure you satisfy the following:
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Automation - Restart Algolia crawler"
2+
3+
# Based on https://github.com/wasp-lang/wasp/tree/main/web#deployment.
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- deploy-web
9+
10+
concurrency:
11+
group: "automation-algolia-restart-crawler"
12+
cancel-in-progress: true
13+
14+
jobs:
15+
restart-crawler:
16+
name: Restart Algolia Crawler
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Wait for Wasp web to finish deploying
20+
env:
21+
CLOUDFLARE_ACCOUNT_ID: 75c37602a6b75c790961219411cb1b92
22+
CLOUDFLARE_PROJECT_NAME: wasp-docs
23+
run: |
24+
while true; do
25+
response=$(curl -s "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/$CLOUDFLARE_PROJECT_NAME/deployments?per_page=1&page=1&env=production" \
26+
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_READ_PAGES_API_TOKEN }}" \
27+
-H "Content-Type: application/json")
28+
29+
latest_name=$(echo "$response" | jq -r '.result[0].latest_stage.name')
30+
latest_status=$(echo "$response" | jq -r '.result[0].latest_stage.status')
31+
32+
echo "Latest stage: $latest_name, status: $latest_status"
33+
34+
if [[ "$latest_status" == "active" ]]; then
35+
echo "Deployment is still active, waiting 5 seconds..."
36+
sleep 5
37+
continue
38+
elif [[ "$latest_name" == "deploy" && "$latest_status" == "success" ]]; then
39+
echo "Deployment succeeded!"
40+
break
41+
else
42+
echo "Deployment failed or in unexpected state: stage=$latest_name, status=$latest_status"
43+
exit 1
44+
fi
45+
done
46+
47+
- name: Restart Algolia crawler
48+
run: |
49+
# Based on Algolia API: https://www.algolia.com/doc/rest-api/crawler/#tag/actions/operation/startReindex
50+
curl -X POST \
51+
--user "${{ secrets.ALGOLIA_CRAWLER_USER_ID }}:${{ secrets.ALGOLIA_CRAWLER_API_KEY }}" \
52+
-H "Content-Type: application/json" \
53+
"https://crawler.algolia.com/api/1/crawlers/${{ secrets.ALGOLIA_CRAWLER_ID }}/reindex"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Automation - Evict caches"
2+
3+
# Caches for merged PRs stay around until we bump against our cache limit.
4+
# They are also not shareable between branches. Therefore, once a PR is
5+
# merged, the cache for that branch is immediately not needed anymore, and we
6+
# can remove it. If we remove these caches, we can save space and be more sure
7+
# that the remaining caches are actually useful, and not at danger of being
8+
# evicted.
9+
10+
on:
11+
workflow_dispatch:
12+
push:
13+
branches:
14+
- main
15+
16+
concurrency:
17+
group: "automation-cache-evict"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
evict-cache:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- name: Evict caches
28+
shell: bash
29+
env:
30+
GITHUB_TOKEN: ${{ github.token }}
31+
run: node ./scripts/cache-evict.mjs
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Automation - Warm caches"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# GitHub evicts unused caches after 7 days, so we run this every 6 days
7+
- cron: "0 0 */6 * *"
8+
9+
concurrency:
10+
group: "automation-cache-warm"
11+
cancel-in-progress: false
12+
13+
jobs:
14+
warm-cache-ci:
15+
uses: ./.github/workflows/ci.yaml
16+
secrets: inherit
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Automation - Merge release to main"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- release
8+
9+
env:
10+
SOURCE_BRANCH: release
11+
TARGET_BRANCH: main
12+
13+
USERNAME: ${{ github.actor }}
14+
15+
PR_TITLE: "Merge `release` into `main`"
16+
PR_BODY: |
17+
Automated PR to merge changes from `release` branch back into `main`.
18+
19+
> [!IMPORTANT]
20+
> You should **NOT** "Rebase and merge" or "Squash and merge" this PR, so we avoid conflicts in the future.
21+
22+
jobs:
23+
create-pr:
24+
name: Create Pull Request
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- run: |
29+
existing_pr_number=$(
30+
gh pr list \
31+
--head "$SOURCE_BRANCH" \
32+
--base "$TARGET_BRANCH" \
33+
--json number \
34+
--jq '.[0].number // empty'
35+
)
36+
37+
if [ -n "$existing_pr_number" ]; then
38+
gh pr comment "$existing_pr_number" \
39+
--body "Ping @${USERNAME}"
40+
41+
gh pr edit "$existing_pr_number" \
42+
--add-assignee "$USERNAME" \
43+
--add-reviewer "$USERNAME"
44+
else
45+
gh pr create \
46+
--assignee "$USERNAME" \
47+
--reviewer "$USERNAME" \
48+
--head "$SOURCE_BRANCH" \
49+
--base "$TARGET_BRANCH" \
50+
--title "$PR_TITLE" \
51+
--body "$PR_BODY"
52+
fi
53+
env:
54+
# Env for the `gh` CLI tool
55+
GH_TOKEN: ${{ github.token }}
56+
GH_REPO: ${{ github.repository }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Automation - Label external PRs"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
9+
env:
10+
internal_team_name: "eng"
11+
external_label_name: "external"
12+
13+
jobs:
14+
label-external-pr:
15+
name: Label external PRs
16+
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
pull-requests: write
21+
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 }}
43+
44+
- name: Label external PR
45+
if: steps.check_pr.outputs.pr_is_internal == 'false'
46+
run: gh pr edit "$PR_NUMBER" --add-label "$LABEL_NAME"
47+
env:
48+
PR_NUMBER: ${{ github.event.pull_request.number }}
49+
LABEL_NAME: ${{ env.external_label_name }}
50+
GH_TOKEN: ${{ github.token }}

.github/workflows/cache-evict.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)