Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
110 changes: 110 additions & 0 deletions .github/actions/prepare-e2e-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: 'Prepare E2E test application'
description:
'Sets up the runtimes for an E2E test application, restores the built tarballs and copies the application to
`runner.temp/test-application` with pnpm overrides pointing at the tarballs.'
inputs:
test-application:
description: 'The name of the test application in dev-packages/e2e-tests/test-applications.'
required: true
runtime:
description: 'The `runtime` of a runtime variant, see dev-packages/e2e-tests/README.md.'
default: ''
deno-version:
description: 'The Deno version to install, if the application needs Deno.'
default: 'v2.8.3'
artifacts-run-id:
description: 'The workflow run that uploaded the tarball artifacts. Defaults to the current run.'
default: ''
github-token:
description: 'Token to download artifacts from `artifacts-run-id`. Only needed when that is set.'
default: ''

runs:
using: 'composite'
steps:
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version-file: 'dev-packages/e2e-tests/test-applications/${{ inputs.test-application }}/package.json'
- name: Set up Bun
if:
inputs.test-application == 'node-exports-test-app' || contains(inputs.test-application, 'bun') || inputs.runtime
== 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.14'
- name: Set up AWS SAM
if: contains(inputs.test-application, 'aws-serverless')
uses: aws-actions/setup-sam@v3
with:
use-installer: true
token: ${{ github.token }}
- name: Set up Deno
if: contains(inputs.test-application, 'deno') || inputs.runtime == 'deno'
uses: denoland/setup-deno@v2.0.5
with:
deno-version: ${{ inputs.deno-version || 'v2.8.3' }}
# Keeps the pnpm store on the cache volume for the `pnpm install` of the test application
- name: Mount pnpm store
uses: ./.github/actions/mount-pnpm-store
- name: Install pnpm
uses: ./.github/actions/install-pnpm

# upload-artifact strips the path through the first `*`, so the tarballs are stored as <pkg>/*.tgz and have to be
# downloaded into packages/.
- name: Restore tarball artifacts
uses: actions/download-artifact@v8
with:
name: build-tarball-output
path: ${{ github.workspace }}/packages
run-id: ${{ inputs.artifacts-run-id || github.run_id }}
github-token: ${{ inputs.github-token }}

- name: Restore test-utils tarball artifact
uses: actions/download-artifact@v8
with:
name: build-test-utils-tarball-output
path: dev-packages/test-utils
run-id: ${{ inputs.artifacts-run-id || github.run_id }}
github-token: ${{ inputs.github-token }}

- name: Restore build layer artifacts
if: contains(inputs.test-application, 'aws-serverless')
uses: actions/download-artifact@v8
with:
name: build-layer-output
path: ${{ github.workspace }}/packages/aws-serverless/build/aws/dist-serverless
run-id: ${{ inputs.artifacts-run-id || github.run_id }}
github-token: ${{ inputs.github-token }}

# The Lambda functions install the built workspace packages directly (see `src/stack.ts`).
- name: Restore build artifacts
if: inputs.test-application == 'aws-serverless'
uses: actions/download-artifact@v8
with:
name: build-output
run-id: ${{ inputs.artifacts-run-id || github.run_id }}
github-token: ${{ inputs.github-token }}

- name: Prepare E2E tests
run: pnpm run test:prepare
shell: bash
working-directory: dev-packages/e2e-tests

- name: Validate E2E test setup
run: pnpm run test:validate
shell: bash
working-directory: dev-packages/e2e-tests

- name: Copy to temp
run:
pnpm run ci:copy-to-temp ./test-applications/${{ inputs.test-application }} ${{ runner.temp }}/test-application
shell: bash
working-directory: dev-packages/e2e-tests

- name: Add pnpm overrides
run:
pnpm run ci:pnpm-overrides ${{ runner.temp }}/test-application ${{ github.workspace
}}/dev-packages/e2e-tests/packed
shell: bash
working-directory: dev-packages/e2e-tests
77 changes: 5 additions & 72 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1108,79 +1108,12 @@ jobs:
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version-file: 'dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/package.json'
- name: Set up Bun
if:
matrix.test-application == 'node-exports-test-app' || contains(matrix.test-application, 'bun') ||
matrix.runtime == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.14'
- name: Set up AWS SAM
if: matrix.test-application == 'aws-serverless' || matrix.test-application == 'aws-serverless-layer'
uses: aws-actions/setup-sam@v3
with:
use-installer: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Deno
if: contains(matrix.test-application, 'deno') || matrix.runtime == 'deno'
uses: denoland/setup-deno@v2.0.5
with:
deno-version: ${{ matrix.deno-version || 'v2.8.3' }}
# Keeps the pnpm store on the cache volume for the `pnpm install` of the test application
- name: Mount pnpm store
uses: ./.github/actions/mount-pnpm-store
- name: Install pnpm
uses: ./.github/actions/install-pnpm

- name: Restore tarball artifacts
uses: actions/download-artifact@v8
with:
name: build-tarball-output
path: ${{ env.TARBALL_ARTIFACT_DOWNLOAD_PATH }}

- name: Restore test-utils tarball artifact
uses: actions/download-artifact@v8
- name: Prepare E2E test application
uses: ./.github/actions/prepare-e2e-test
with:
name: build-test-utils-tarball-output
path: dev-packages/test-utils

- name: Restore build layer artifacts
uses: actions/download-artifact@v8
if: matrix.test-application == 'aws-serverless' || matrix.test-application == 'aws-serverless-layer'
with:
name: build-layer-output
path: ${{ env.BUILD_LAYER_PATH }}

# The Lambda functions install the built workspace packages directly (see `src/stack.ts`).
- name: Restore build artifacts
uses: actions/download-artifact@v8
if: matrix.test-application == 'aws-serverless'
with:
name: build-output

- name: Prepare e2e tests
run: pnpm run test:prepare
working-directory: dev-packages/e2e-tests

- name: Validate e2e tests setup
run: pnpm run test:validate
working-directory: dev-packages/e2e-tests

- name: Copy to temp
run:
pnpm run ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp
}}/test-application
working-directory: dev-packages/e2e-tests

- name: Add pnpm overrides
run:
pnpm run ci:pnpm-overrides ${{ runner.temp }}/test-application ${{ github.workspace
}}/dev-packages/e2e-tests/packed
working-directory: dev-packages/e2e-tests
test-application: ${{ matrix.test-application }}
runtime: ${{ matrix.runtime }}
deno-version: ${{ matrix.deno-version }}

# Installs Playwright while the app builds. Keep it right before the build: the runner sets up a background
# composite action's steps from the job's shared `github` context, which fails with "Collection was modified" if
Expand Down
62 changes: 6 additions & 56 deletions .github/workflows/optional-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ env:
HEAD_COMMIT: ${{ inputs.commit }}

# See build.yml
TARBALL_ARTIFACT_DOWNLOAD_PATH: ${{ github.workspace }}/packages
DISABLE_V8_COMPILE_CACHE: '1'

jobs:
Expand Down Expand Up @@ -85,64 +84,15 @@ jobs:
uses: actions/checkout@v7
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: actions/setup-node@v7
- name: Prepare E2E test application
uses: ./.github/actions/prepare-e2e-test
with:
node-version-file: 'dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}/package.json'
- name: Set up Bun
if:
matrix.test-application == 'node-exports-test-app' || contains(matrix.test-application, 'bun') ||
matrix.runtime == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.14'
- name: Set up Deno
if: contains(matrix.test-application, 'deno') || matrix.runtime == 'deno'
uses: denoland/setup-deno@v2.0.5
with:
deno-version: ${{ matrix.deno-version || 'v2.8.3' }}
# Keeps the pnpm store on the cache volume for the `pnpm install` of the test application
- name: Mount pnpm store
uses: ./.github/actions/mount-pnpm-store
- name: Install pnpm
uses: ./.github/actions/install-pnpm

- name: Restore tarball artifacts
uses: actions/download-artifact@v8
with:
name: build-tarball-output
path: ${{ env.TARBALL_ARTIFACT_DOWNLOAD_PATH }}
run-id: ${{ inputs.build_run_id }}
test-application: ${{ matrix.test-application }}
runtime: ${{ matrix.runtime }}
deno-version: ${{ matrix.deno-version }}
artifacts-run-id: ${{ inputs.build_run_id }}
github-token: ${{ github.token }}

- name: Restore test-utils tarball artifact
uses: actions/download-artifact@v8
with:
name: build-test-utils-tarball-output
path: dev-packages/test-utils
run-id: ${{ inputs.build_run_id }}
github-token: ${{ github.token }}

- name: Prepare E2E tests
run: pnpm run test:prepare
working-directory: dev-packages/e2e-tests

- name: Validate test setup
run: pnpm run test:validate
working-directory: dev-packages/e2e-tests

- name: Copy to temp
run:
pnpm run ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp
}}/test-application
working-directory: dev-packages/e2e-tests

- name: Add pnpm overrides
run:
pnpm run ci:pnpm-overrides ${{ runner.temp }}/test-application ${{ github.workspace
}}/dev-packages/e2e-tests/packed
working-directory: dev-packages/e2e-tests

# Installs Playwright while the app builds. Keep it right before the build: the runner sets up a background
# composite action's steps from the job's shared `github` context, which fails with "Collection was modified" if
# a foreground step starts at that moment. Starting next to `download-artifact` also made it fail to read the event file.
Expand Down
Loading