Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 70 additions & 74 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,79 +64,77 @@
run: npm run test -w @repo/sandbox-container

# E2E tests run in parallel with unit tests
# e2e-tests:
# if: ${{ github.repository_owner == 'cloudflare' }}
# runs-on: ubuntu-latest
# timeout-minutes: 30

# steps:
# - uses: actions/checkout@v4

# - uses: actions/setup-node@v4
# with:
# node-version: 24
# cache: "npm"

# - uses: oven-sh/setup-bun@v2
# with:
# bun-version: latest

# - name: Install dependencies
# run: npm ci

# - name: Build packages
# run: npm run build

# - name: Set worker name
# id: worker-name
# run: |
# # Use git SHA for unique, meaningful naming (not sequential run number)
# SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
# echo "worker_name=sandbox-e2e-test-worker-release-${SHORT_SHA}" >> $GITHUB_OUTPUT

# # Generate unique wrangler config for this release
# - name: Generate wrangler config
# run: |
# cd tests/e2e/test-worker
# ./generate-config.sh ${{ steps.worker-name.outputs.worker_name }}

# - name: Build test worker Docker image
# run: npm run docker:local -w @cloudflare/sandbox

# - name: Deploy test worker
# uses: cloudflare/wrangler-action@v3
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# command: deploy --name ${{ steps.worker-name.outputs.worker_name }}
# workingDirectory: tests/e2e/test-worker

# - name: Get deployment URL
# id: get-url
# run: |
# echo "worker_url=https://${{ steps.worker-name.outputs.worker_name }}.agents-b8a.workers.dev" >> $GITHUB_OUTPUT

# - name: Run E2E tests
# run: npx vitest run --config vitest.e2e.config.ts
# env:
# TEST_WORKER_URL: ${{ steps.get-url.outputs.worker_url }}
# CI: true

# - name: Cleanup test deployment
# if: always()
# continue-on-error: true
# run: |
# cd tests/e2e/test-worker
# ../../../scripts/cleanup-test-deployment.sh ${{ steps.worker-name.outputs.worker_name }}
# env:
# CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
e2e-tests:
if: ${{ github.repository_owner == 'cloudflare' }}
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: "npm"

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: npm ci

- name: Build packages
run: npm run build

- name: Set worker name
id: worker-name
run: |
# Use git SHA for unique, meaningful naming (not sequential run number)
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
echo "worker_name=sandbox-e2e-test-worker-release-${SHORT_SHA}" >> $GITHUB_OUTPUT

# Generate unique wrangler config for this release
- name: Generate wrangler config
run: |
cd tests/e2e/test-worker
./generate-config.sh ${{ steps.worker-name.outputs.worker_name }}

- name: Build test worker Docker image
run: npm run docker:local -w @cloudflare/sandbox

- name: Deploy test worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --name ${{ steps.worker-name.outputs.worker_name }}
workingDirectory: tests/e2e/test-worker

- name: Get deployment URL
id: get-url
run: |
echo "worker_url=https://${{ steps.worker-name.outputs.worker_name }}.agents-b8a.workers.dev" >> $GITHUB_OUTPUT

- name: Run E2E tests
run: npx vitest run --config vitest.e2e.config.ts
env:
TEST_WORKER_URL: ${{ steps.get-url.outputs.worker_url }}
CI: true

- name: Cleanup test deployment
if: always()
continue-on-error: true
run: |
cd tests/e2e/test-worker
../../../scripts/cleanup-test-deployment.sh ${{ steps.worker-name.outputs.worker_name }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

# Prerelease publish - always runs after tests pass
publish-prerelease:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
needs: [unit-tests,
# e2e-tests
]
needs: [unit-tests, e2e-tests]
if: ${{ github.repository_owner == 'cloudflare' }}
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down Expand Up @@ -187,9 +185,7 @@

# Release publish - only runs if changesets exist
publish-release:
needs: [unit-tests,
# e2e-tests
]
needs: [unit-tests, e2e-tests]
if: ${{ github.repository_owner == 'cloudflare' }}
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down Expand Up @@ -236,4 +232,4 @@
env:
GITHUB_TOKEN: ${{ secrets.SANDBOX_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
25 changes: 4 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading