Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSC: Rename RSC CI test case #10521

Merged
merged 2 commits into from
Apr 26, 2024
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
4 changes: 2 additions & 2 deletions .github/actions/detect-changes/cases/rsc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export function rscChanged(changedFiles){
changedFile.startsWith('tasks/smoke-tests/rsa/') ||
changedFile.startsWith('tasks/smoke-tests/basePlaywright.config.ts') ||
changedFile.startsWith('.github/actions/set-up-rsa-project/') ||
changedFile.startsWith('.github/actions/set-up-rsc-external-packages-project/') ||
changedFile.startsWith('.github/actions/set-up-rsc-kitchen-sink-project/') ||
changedFile.startsWith('.github/actions/set-up-rsc-project/') ||
changedFile.startsWith('packages/internal/') ||
changedFile.startsWith('packages/project-config/') ||
changedFile.startsWith('packages/web/') ||
changedFile.startsWith('packages/vite/') ||
changedFile.startsWith('__fixtures__/test-project-rsa') ||
changedFile.startsWith('__fixtures__/test-project-rsc-external-packages')
changedFile.startsWith('__fixtures__/test-project-rsc-kitchen-sink')
) {
console.log('RSC change detected:', changedFile)
return true
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
This action copies a RW project with Streaming SSR and RSC support already set
up. It's used for RSC smoke tests.

It copies the `__fixtures__/test-project-rsc-external-packages-and-cells`
It copies the `__fixtures__/test-project-rsc-kitchen-sink`
project, runs `yarn install` and `project:copy`. Finally it builds the rw app.

## Testing/running locally

Go into the github actions folder
`cd .github/actions/set-up-rsc-external-packages-and-cells-project`
`cd .github/actions/set-up-rsc-kitchen-sink-project`

Then run the following command to execute the action
`node setUpRscExternalPackagesProjectLocally.mjs`
`node setUpRscKitchenSinkProjectLocally.mjs`

## Design

The main logic of the action is in the `../actionsLib.mjs` file. To be able to
run that code both on GitHub and locally it uses dependency injection. The
injection is done by `setupRscExternalPackagesProjectLocally.mjs` for when you
injection is done by `setupRscKitchenSinkProjectLocally.mjs` for when you
want to run the action on your own machine and by
`setupRscExternalPackagesProjectGitHib.mjs` when it's triggered by GitHub CI.
`setupRscKitchenSinkProjectGitHib.mjs` when it's triggered by GitHub CI.

When doing further changes to the code here it's very important to keep the
DI scripts as light on logic as possible. Ideally all logic is kept to
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/set-up-rsc-kitchen-sink-project/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Set up RSC kitchen sink test project from fixture
description: Sets up an RSC project that tests all-the-things

runs:
using: node20
main: 'setUpRscKitchenSinkProjectGitHub.mjs'

outputs:
test-project-path:
description: Path to the test project
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "set-up-rsc-external-packages-and-cells-project",
"name": "set-up-rsc-kitchen-sink-project",
"version": "0.0.0",
"private": true,
"type": "module"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import core from '@actions/core'

import { createExecWithEnvInCwd, setUpRscTestProject } from '../actionsLib.mjs'

const testProjectAndFixtureName = 'test-project-rsc-external-packages-and-cells'
const testProjectAndFixtureName = 'test-project-rsc-kitchen-sink'
const testProjectPath = path.join(
path.dirname(process.cwd()),
testProjectAndFixtureName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function getExecaOptions(cwd, env = {}) {
}
}

const testProjectAndFixtureName = 'test-project-rsc-external-packages-and-cells'
const testProjectAndFixtureName = 'test-project-rsc-kitchen-sink'

const testProjectPath = path.join(
os.tmpdir(),
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,18 @@ jobs:
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsa-project.outputs.test-project-path }}
REDWOOD_DISABLE_TELEMETRY: 1

- name: 🌲 Set up RSC external packages and Cells smoke test
id: set-up-rsc-external-packages-and-cells-project
uses: ./.github/actions/set-up-rsc-external-packages-and-cells-project
- name: 🌲 Set up RSC Kitchen Sink smoke test
id: set-up-rsc-kitchen-sink-project
uses: ./.github/actions/set-up-rsc-kitchen-sink-project
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: 🐘 Run RSC external packages and cells smoke tests
working-directory: tasks/smoke-tests/rsc-external-packages-and-cells
- name: 🐘 Run RSC Kitchen Sink smoke tests
working-directory: tasks/smoke-tests/rsc-kitchen-sink
run: npx playwright test
env:
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsc-external-packages-and-cells-project.outputs.test-project-path }}
REDWOOD_TEST_PROJECT_PATH: ${{ steps.set-up-rsc-kitchen-sink-project.outputs.test-project-path }}
REDWOOD_DISABLE_TELEMETRY: 1

rsc-smoke-tests-skip:
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/clientSsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ export function renderFromDist<TProps extends Record<string, any>>(
get(_target, encodedId: string) {
console.log('Proxy get encodedId', encodedId)
const [filePath, name] = encodedId.split('#') as [string, string]
// filePath /Users/tobbe/tmp/test-project-rsc-external-packages-and-cells/web/dist/rsc/assets/rsc-AboutCounter.tsx-1.mjs
// filePath /Users/tobbe/tmp/test-project-rsc-kitchen-sink/web/dist/rsc/assets/rsc-AboutCounter.tsx-1.mjs
// name AboutCounter

const id = resolveClientEntryForProd(filePath, clientEntries)

console.log('clientSsr.ts::Proxy id', id)
// id /Users/tobbe/tmp/test-project-rsc-external-packages-and-cells/web/dist/client/assets/rsc-AboutCounter.tsx-1-4kTKU8GC.mjs
// id /Users/tobbe/tmp/test-project-rsc-kitchen-sink/web/dist/client/assets/rsc-AboutCounter.tsx-1-4kTKU8GC.mjs
return { id, chunks: [id], name, async: true }
},
},
Expand Down
Loading