Skip to content

refactor(api-headless-cms-tasks): make delete-model operations a DI class #1479

refactor(api-headless-cms-tasks): make delete-model operations a DI class

refactor(api-headless-cms-tasks): make delete-model operations a DI class #1479

# This file was automatically generated by github-actions-wac.
# DO NOT MODIFY IT BY HAND. Instead, modify the source *.wac.ts file(s)
# and run "github-actions-wac build" (or "ghawac build") to regenerate this file.
# For more information, run "github-actions-wac --help".
name: 💬 PR Command - Vitest
'on': issue_comment
env:
NODE_OPTIONS: '--max_old_space_size=4096'
AWS_REGION: eu-central-1
jobs:
checkComment:
name: Check comment for /vitest
if: >-
${{ github.event.issue.pull_request && (github.event.comment.body ==
'/vitest' || startsWith(github.event.comment.body, '/vitest ')) }}
permissions:
contents: read
actions: write
pull-requests: write
issues: write
outputs:
comment-id: ${{ steps.create-comment.outputs.comment-id }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Check permission and react to comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
PERMISSION=$(gh api "/repos/${{ github.repository }}/collaborators/${{
github.event.comment.user.login }}/permission" -q .permission)
if [ "$PERMISSION" != "write" ] && [ "$PERMISSION" != "admin" ]; then
echo "::error::User ${{ github.event.comment.user.login }} does not have write permission (has: $PERMISSION)."
exit 1
fi
gh api --silent -X POST "/repos/${{ github.repository
}}/issues/comments/${{ github.event.comment.id }}/reactions" -f
content=eyes
- name: Create comment
id: create-comment
uses: >-
peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9
with:
issue-number: ${{ github.event.issue.number }}
body: >-
Vitest tests have been initiated (for more information, click
[here](https://github.com/webiny/webiny-js/actions/runs/${{
github.run_id }})). :sparkles:
| Group | Status |
| --- | --- |
| No storage | ⏳ Queued |
| DDB | ⏳ Queued |
| DDB+OS | ⏳ Queued |
| SQL | ⏳ Queued |
| PGlite | ⏳ Queued |
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
baseBranch:
needs: checkComment
name: Get base branch
outputs:
base-branch: ${{ steps.base-branch.outputs.base-branch }}
pr-sha: ${{ steps.pr-sha.outputs.pr-sha }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
- name: Get base branch
id: base-branch
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: >-
echo "base-branch=$(gh pr view ${{ github.event.issue.number }} --json
baseRefName -q .baseRefName)" >> $GITHUB_OUTPUT
- name: Get PR head SHA
id: pr-sha
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: >-
echo "pr-sha=$(gh pr view ${{ github.event.issue.number }} --json
headRefOid -q .headRefOid)" >> $GITHUB_OUTPUT
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
constants:
needs: baseBranch
name: Create constants
outputs:
global-cache-key: ${{ steps.global-cache-key.outputs.global-cache-key }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Create global cache key
id: global-cache-key
run: >-
echo "global-cache-key=${{ needs.baseBranch.outputs.base-branch }}-${{
runner.os }}-$(/bin/date -u "+%m%d")-${{ vars.RANDOM_CACHE_KEY_SUFFIX
}}" >> $GITHUB_OUTPUT
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
build:
name: Build
needs:
- baseBranch
- constants
runs-on: webiny-build-packages
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Resolve Yarn cache folder
id: yarn-cache-folder
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages
key: ${{ needs.constants.outputs.global-cache-key }}
- name: Install dependencies
run: yarn --immutable
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Build packages
run: yarn build
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Compress build cache
run: >-
tar -cf run-build-cache.tzst --use-compress-program=zstdmt -C
"${WEBINY_JS_DIR:-.}" .webiny/cached-packages
env:
WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }}
- name: Upload build cache
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: run-build-cache
path: run-build-cache.tzst
retention-days: 1
compression-level: 0
if-no-files-found: error
overwrite: true
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-constants:
needs:
- baseBranch
- build
- checkComment
name: Vitest (No storage) - Constants
outputs:
vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Mark "No storage" as running
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
run: >-
STATUS="🔄 Running"
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| No storage |.*@| No storage | $STATUS |@"
/tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- id: list-vitest-test-commands
name: List Vitest Test Commands
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: >-
echo "vitest-test-commands=$(node
.github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js
'[""]')" >> "$GITHUB_OUTPUT"
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-result:
needs:
- vitest-run
- checkComment
name: Vitest (No storage) - Report status
if: always() && needs.checkComment.result == 'success'
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Report "No storage" result
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
RESULT: ${{ needs.vitest-run.result }}
run: >-
mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository
}}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] |
select(.name | startswith("No storage / ")) | .conclusion')
TOTAL=${#CONCS[@]}
PASSED=0
for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then
PASSED=$((PASSED + 1)); fi; done
if [ "$TOTAL" -eq 0 ]; then
case "$RESULT" in
cancelled) STATUS="⚪ Cancelled" ;;
skipped) STATUS="⏭️ Skipped" ;;
*) STATUS="❌ Failed" ;;
esac
elif [ "$PASSED" -eq "$TOTAL" ]; then
STATUS="✅ $PASSED/$TOTAL passed"
else
STATUS="❌ $PASSED/$TOTAL passed"
fi
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| No storage |.*@| No storage | $STATUS |@"
/tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-run:
needs:
- baseBranch
- constants
- vitest-constants
name: No storage / ${{ matrix.testCommand.title }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- 24
testCommand: ${{ fromJSON(needs.vitest-constants.outputs.vitest-test-commands) }}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Resolve Yarn cache folder
id: yarn-cache-folder
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- name: Download build cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: run-build-cache
- name: Extract build cache
run: >-
tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C
"${WEBINY_JS_DIR:-.}"
env:
WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }}
- name: Install dependencies
run: yarn --immutable
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Build packages
run: yarn build
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Run tests
run: ${{ matrix.testCommand.cmd }}
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
permissions:
contents: read
actions: write
vitest-ddb-constants:
needs:
- baseBranch
- build
- checkComment
name: Vitest (DDB) - Constants
outputs:
vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Mark "DDB" as running
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
run: >-
STATUS="🔄 Running"
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| DDB |.*@| DDB | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- id: list-vitest-test-commands
name: List Vitest Test Commands
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: >-
echo "vitest-test-commands=$(node
.github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js
'["ddb"]')" >> "$GITHUB_OUTPUT"
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-ddb-result:
needs:
- vitest-ddb-run
- checkComment
name: Vitest (DDB) - Report status
if: always() && needs.checkComment.result == 'success'
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Report "DDB" result
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
RESULT: ${{ needs.vitest-ddb-run.result }}
run: >-
mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository
}}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] |
select(.name | startswith("DDB / ")) | .conclusion')
TOTAL=${#CONCS[@]}
PASSED=0
for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then
PASSED=$((PASSED + 1)); fi; done
if [ "$TOTAL" -eq 0 ]; then
case "$RESULT" in
cancelled) STATUS="⚪ Cancelled" ;;
skipped) STATUS="⏭️ Skipped" ;;
*) STATUS="❌ Failed" ;;
esac
elif [ "$PASSED" -eq "$TOTAL" ]; then
STATUS="✅ $PASSED/$TOTAL passed"
else
STATUS="❌ $PASSED/$TOTAL passed"
fi
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| DDB |.*@| DDB | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-ddb-run:
needs:
- baseBranch
- constants
- vitest-ddb-constants
name: DDB / ${{ matrix.testCommand.title }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- 24
testCommand: >-
${{ fromJSON(needs.vitest-ddb-constants.outputs.vitest-test-commands)
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
WEBINY_STORAGE: ddb
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Resolve Yarn cache folder
id: yarn-cache-folder
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- name: Download build cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: run-build-cache
- name: Extract build cache
run: >-
tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C
"${WEBINY_JS_DIR:-.}"
env:
WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }}
- name: Install dependencies
run: yarn --immutable
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Build packages
run: yarn build
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Run tests
run: ${{ matrix.testCommand.cmd }}
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
permissions:
contents: read
actions: write
vitest-ddb-os-constants:
needs:
- baseBranch
- build
- checkComment
name: Vitest (DDB+OS) - Constants
outputs:
vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Mark "DDB+OS" as running
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
run: >-
STATUS="🔄 Running"
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| DDB+OS |.*@| DDB+OS | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- id: list-vitest-test-commands
name: List Vitest Test Commands
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: >-
echo "vitest-test-commands=$(node
.github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js
'["ddb-os,ddb"]')" >> "$GITHUB_OUTPUT"
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-ddb-os-result:
needs:
- vitest-ddb-os-run
- checkComment
name: Vitest (DDB+OS) - Report status
if: always() && needs.checkComment.result == 'success'
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Report "DDB+OS" result
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
RESULT: ${{ needs.vitest-ddb-os-run.result }}
run: >-
mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository
}}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] |
select(.name | startswith("DDB+OS / ")) | .conclusion')
TOTAL=${#CONCS[@]}
PASSED=0
for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then
PASSED=$((PASSED + 1)); fi; done
if [ "$TOTAL" -eq 0 ]; then
case "$RESULT" in
cancelled) STATUS="⚪ Cancelled" ;;
skipped) STATUS="⏭️ Skipped" ;;
*) STATUS="❌ Failed" ;;
esac
elif [ "$PASSED" -eq "$TOTAL" ]; then
STATUS="✅ $PASSED/$TOTAL passed"
else
STATUS="❌ $PASSED/$TOTAL passed"
fi
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| DDB+OS |.*@| DDB+OS | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-ddb-os-run:
needs:
- baseBranch
- constants
- vitest-ddb-os-constants
name: DDB+OS / ${{ matrix.testCommand.title }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- 24
testCommand: >-
${{
fromJSON(needs.vitest-ddb-os-constants.outputs.vitest-test-commands)
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
WEBINY_STORAGE: ddb-os,ddb
AWS_OPENSEARCH_DOMAIN_NAME: ${{ secrets.OPENSEARCH_DOMAIN_NAME }}
OPENSEARCH_ENDPOINT: ${{ secrets.OPENSEARCH_ENDPOINT }}
OPENSEARCH_USERNAME: ${{ secrets.OPENSEARCH_USERNAME }}
OPENSEARCH_PASSWORD: ${{ secrets.OPENSEARCH_PASSWORD }}
OPENSEARCH_INDEX_PREFIX: ${{ matrix.testCommand.id }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Configure AWS Credentials
uses: >-
aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
with:
role-to-assume: arn:aws:iam::726952677045:role/GitHubActionsWebinyJs
aws-region: eu-central-1
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Resolve Yarn cache folder
id: yarn-cache-folder
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- name: Download build cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: run-build-cache
- name: Extract build cache
run: >-
tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C
"${WEBINY_JS_DIR:-.}"
env:
WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }}
- name: Install dependencies
run: yarn --immutable
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Build packages
run: yarn build
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Run tests
run: ${{ matrix.testCommand.cmd }}
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
permissions:
contents: read
actions: write
id-token: write
vitest-sql-constants:
needs:
- baseBranch
- build
- checkComment
name: Vitest (SQL) - Constants
outputs:
vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Mark "SQL" as running
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
run: >-
STATUS="🔄 Running"
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| SQL |.*@| SQL | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- id: list-vitest-test-commands
name: List Vitest Test Commands
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: >-
echo "vitest-test-commands=$(node
.github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js
'["sql,ddb"]')" >> "$GITHUB_OUTPUT"
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-sql-result:
needs:
- vitest-sql-run
- checkComment
name: Vitest (SQL) - Report status
if: always() && needs.checkComment.result == 'success'
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Report "SQL" result
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
RESULT: ${{ needs.vitest-sql-run.result }}
run: >-
mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository
}}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] |
select(.name | startswith("SQL / ")) | .conclusion')
TOTAL=${#CONCS[@]}
PASSED=0
for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then
PASSED=$((PASSED + 1)); fi; done
if [ "$TOTAL" -eq 0 ]; then
case "$RESULT" in
cancelled) STATUS="⚪ Cancelled" ;;
skipped) STATUS="⏭️ Skipped" ;;
*) STATUS="❌ Failed" ;;
esac
elif [ "$PASSED" -eq "$TOTAL" ]; then
STATUS="✅ $PASSED/$TOTAL passed"
else
STATUS="❌ $PASSED/$TOTAL passed"
fi
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| SQL |.*@| SQL | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-sql-run:
needs:
- baseBranch
- constants
- vitest-sql-constants
name: SQL / ${{ matrix.testCommand.title }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- 24
testCommand: >-
${{ fromJSON(needs.vitest-sql-constants.outputs.vitest-test-commands)
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
WEBINY_STORAGE: sql,ddb
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Resolve Yarn cache folder
id: yarn-cache-folder
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- name: Download build cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: run-build-cache
- name: Extract build cache
run: >-
tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C
"${WEBINY_JS_DIR:-.}"
env:
WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }}
- name: Install dependencies
run: yarn --immutable
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Build packages
run: yarn build
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Run tests
run: ${{ matrix.testCommand.cmd }}
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
permissions:
contents: read
actions: write
vitest-pglite-constants:
needs:
- baseBranch
- build
- checkComment
name: Vitest (PGlite) - Constants
outputs:
vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Mark "PGlite" as running
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
run: >-
STATUS="🔄 Running"
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| PGlite |.*@| PGlite | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- id: list-vitest-test-commands
name: List Vitest Test Commands
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: >-
echo "vitest-test-commands=$(node
.github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js
'["sql,ddb"]')" >> "$GITHUB_OUTPUT"
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-pglite-result:
needs:
- vitest-pglite-run
- checkComment
name: Vitest (PGlite) - Report status
if: always() && needs.checkComment.result == 'success'
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Report "PGlite" result
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
RESULT: ${{ needs.vitest-pglite-run.result }}
run: >-
mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository
}}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] |
select(.name | startswith("PGlite / ")) | .conclusion')
TOTAL=${#CONCS[@]}
PASSED=0
for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then
PASSED=$((PASSED + 1)); fi; done
if [ "$TOTAL" -eq 0 ]; then
case "$RESULT" in
cancelled) STATUS="⚪ Cancelled" ;;
skipped) STATUS="⏭️ Skipped" ;;
*) STATUS="❌ Failed" ;;
esac
elif [ "$PASSED" -eq "$TOTAL" ]; then
STATUS="✅ $PASSED/$TOTAL passed"
else
STATUS="❌ $PASSED/$TOTAL passed"
fi
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq
'.body' > /tmp/vitest-comment.txt
sed -i "s@^| PGlite |.*@| PGlite | $STATUS |@" /tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write
vitest-pglite-run:
needs:
- baseBranch
- constants
- vitest-pglite-constants
name: PGlite / ${{ matrix.testCommand.title }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- 24
testCommand: >-
${{
fromJSON(needs.vitest-pglite-constants.outputs.vitest-test-commands)
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
WEBINY_STORAGE: sql,ddb
WEBINY_SQL_CLIENT: pglite
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
path: ${{ needs.baseBranch.outputs.base-branch }}
- name: Checkout Pull Request
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: |-
gh pr checkout ${{ github.event.issue.number }}
git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Resolve Yarn cache folder
id: yarn-cache-folder
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- name: Download build cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: run-build-cache
- name: Extract build cache
run: >-
tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C
"${WEBINY_JS_DIR:-.}"
env:
WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }}
- name: Install dependencies
run: yarn --immutable
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Build packages
run: yarn build
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
- name: Run tests
run: ${{ matrix.testCommand.cmd }}
working-directory: ${{ needs.baseBranch.outputs.base-branch }}
permissions:
contents: read
actions: write
vitestStatusSummary:
name: Vitest status summary
needs:
- checkComment
- vitest-run
- vitest-ddb-run
- vitest-ddb-os-run
- vitest-sql-run
- vitest-pglite-run
if: always() && needs.checkComment.result == 'success'
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }}
COMMENT_INTRO: >-
Vitest tests have been initiated (for more information, click
[here](https://github.com/webiny/webiny-js/actions/runs/${{
github.run_id }})). :sparkles:
PR_NUMBER: ${{ github.event.issue.number }}
R_NONE: ${{ needs.vitest-run.result }}
R_DDB: ${{ needs.vitest-ddb-run.result }}
R_DDB_OS: ${{ needs.vitest-ddb-os-run.result }}
R_SQL: ${{ needs.vitest-sql-run.result }}
R_PGLITE: ${{ needs.vitest-pglite-run.result }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Heal PR comment and update PR description
continue-on-error: true
run: >-
gh api --paginate "repos/${{ github.repository }}/actions/runs/${{
github.run_id }}/jobs" --jq '.jobs[] | [.name, .conclusion] | @tsv' >
/tmp/jobs.tsv
status_for() {
local prefix="$1" fallback="$2" total passed
total=$(awk -F'\t' -v p="$prefix" 'index($1,p)==1{n++} END{print n+0}' /tmp/jobs.tsv)
if [ "$total" -eq 0 ]; then
case "$fallback" in
success) echo "✅ Passed" ;;
cancelled) echo "⚪ Cancelled" ;;
skipped) echo "⏭️ Skipped" ;;
*) echo "❌ Failed" ;;
esac
return
fi
passed=$(awk -F'\t' -v p="$prefix" 'index($1,p)==1 && $2=="success"{n++} END{print n+0}' /tmp/jobs.tsv)
if [ "$passed" -eq "$total" ]; then echo "✅ $passed/$total passed"; else echo "❌ $passed/$total passed"; fi
}
: > /tmp/failed.txt
add_failed() {
local list
list=$(awk -F'\t' -v p="$1" 'index($1,p)==1 && $2=="failure"{ x=substr($1,length(p)+1); sub(/^\[[^]]*\] /,"",x); print "- " x }' /tmp/jobs.tsv)
if [ -n "$list" ]; then { echo "**$2**"; echo "$list"; echo ""; } >> /tmp/failed.txt; fi
}
add_failed "No storage / " "No storage"
add_failed "DDB / " "DDB"
add_failed "DDB+OS / " "DDB+OS"
add_failed "SQL / " "SQL"
add_failed "PGlite / " "PGlite"
S_NONE=$(status_for "No storage / " "$R_NONE")
S_DDB=$(status_for "DDB / " "$R_DDB")
S_DDB_OS=$(status_for "DDB+OS / " "$R_DDB_OS")
S_SQL=$(status_for "SQL / " "$R_SQL")
S_PGLITE=$(status_for "PGlite / " "$R_PGLITE")
render_table() {
echo "| Group | Status |"
echo "| --- | --- |"
echo "| No storage | $S_NONE |"
echo "| DDB | $S_DDB |"
echo "| DDB+OS | $S_DDB_OS |"
echo "| SQL | $S_SQL |"
echo "| PGlite | $S_PGLITE |"
if [ -s /tmp/failed.txt ]; then
echo ""
echo "<details><summary>❌ Failed packages</summary>"
echo ""
cat /tmp/failed.txt
echo "</details>"
fi
}
# Heal the PR comment with the authoritative final status.
{ echo "$COMMENT_INTRO"; echo ""; render_table; } >
/tmp/vitest-comment.txt
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X
PATCH --field body=@/tmp/vitest-comment.txt
# Build the PR description status block (idempotent via markers).
{ echo "<!-- vitest-status:start -->"; echo "### 🧪 Vitest results";
echo ""; render_table; echo "<!-- vitest-status:end -->"; } >
/tmp/vitest-status.md
gh pr view "$PR_NUMBER" -R ${{ github.repository }} --json body -q
.body > /tmp/pr-body-raw.txt
# Drop any existing status block, then trailing blank lines, so
re-runs don't stack separators.
sed '/<!-- vitest-status:start -->/,/<!-- vitest-status:end -->/d'
/tmp/pr-body-raw.txt > /tmp/pr-body-noblock.txt
awk 'NF{p=NR} {a[NR]=$0} END{for(i=1;i<=p;i++) print a[i]}'
/tmp/pr-body-noblock.txt > /tmp/pr-body-trimmed.txt
{ cat /tmp/pr-body-trimmed.txt; echo ""; cat /tmp/vitest-status.md; }
> /tmp/pr-body.txt
gh pr edit "$PR_NUMBER" -R ${{ github.repository }} --body-file
/tmp/pr-body.txt
runs-on: ubuntu-latest
permissions:
contents: read
actions: write