Skip to content

Commit

Permalink
Merge branch 'main' into renovate/mdx-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidprice authored Mar 18, 2024
2 parents b1ba2ac + 43ca27a commit 3f45fe6
Show file tree
Hide file tree
Showing 121 changed files with 3,448 additions and 1,849 deletions.
8 changes: 8 additions & 0 deletions .changesets/10204.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- chore(dbAuth): restore behavior of checking whether a search query is present

Previously dbAuth would check whether or not query string variables were
present at all before invoking the proper function. During a refactor we
updated this code to assume a query would *always* be present. Which it would be
during normal browser behavior. But, we had a complaint from a user who relied
on this optional check in one of their tests. So we're restoring the optional
check here.
5 changes: 5 additions & 0 deletions .changesets/four-adults-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- PR feat: Send RSC Flight Payload to Studio (10213) by @dthyresson

This PR sends the rendered RSC payload (aka "flight") to Studio to be ingested, persisted, and fetched.

Performance and metadata enrichments are performed in order to visualize in Studio
11 changes: 2 additions & 9 deletions .github/actions/actionsLib.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,8 @@ export async function setUpRscTestProject(
console.log()
fs.cpSync(fixturePath, testProjectPath, { recursive: true })

console.log(`Adding framework dependencies to ${testProjectPath}`)
await projectDeps(testProjectPath)
console.log()

console.log(`Installing node_modules in ${testProjectPath}`)
await execInProject('yarn install')

console.log(`Copying over framework files to ${testProjectPath}`)
await execInProject(`node ${rwfwBinPath} project:copy`, {
console.log('Syncing framework')
await execInProject(`node ${rwfwBinPath} project:tarsync --verbose`, {
env: { RWFW_PATH: REDWOOD_FRAMEWORK_PATH },
})
console.log()
Expand Down
61 changes: 61 additions & 0 deletions .github/actions/set-up-job/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Set up job
description: >
Everything you need to run a job in CI.
Checkout this repo (redwoodjs/redwood), set up Node.js, yarn install, and build.
inputs:
set-up-yarn-cache:
description: >
For some actions, setting up the yarn cache takes longer than it would to just yarn install.
required: false
default: true

yarn-install-directory:
description: >
The directory to run `yarn install` in.
required: false

build:
description: >
Whether or not to run `yarn build` to build all the framework packages.
required: false
default: true

runs:
using: composite

steps:
- name: ⬢ Enable Corepack
shell: bash
run: corepack enable

- name: ⬢ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

# We have to enable Corepack again for Windows. 🤷
# In general, we're waiting on [this issue](https://github.com/actions/setup-node/issues/531)
# to be resolved so that `actions/setup-node@v4` has first-class Corepack support.
- name: ⬢ Enable Corepack
if: runner.os == 'Windows'
shell: bash
run: corepack enable

- name: 🐈 Set up yarn cache
if: inputs.set-up-yarn-cache == 'true'
uses: ./.github/actions/set-up-yarn-cache

# One of our dependencies is on GitHub instead of NPM and without authentication
# we'll get rate limited and this step becomes flaky.
- name: 🐈 Yarn install
shell: bash
working-directory: ${{ inputs.yarn-install-directory }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: yarn install --inline-builds

- name: 🏗️ Build
if: inputs.build == 'true'
shell: bash
run: yarn build
12 changes: 2 additions & 10 deletions .github/actions/set-up-rsc-project/setUpRscProject.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ async function setUpRscProject(
REDWOOD_FRAMEWORK_PATH,
'packages/cli/dist/index.js'
)
const rwfwBinPath = path.join(
REDWOOD_FRAMEWORK_PATH,
'packages/cli/dist/rwfw.js'
)

console.log(`Creating project at ${rscProjectPath}`)
console.log()
Expand All @@ -95,16 +91,12 @@ async function setUpRscProject(
await execInProject(`node ${rwBinPath} experimental setup-rsc`)
console.log()

console.log(`Copying over framework files to ${rscProjectPath}`)
await execInProject(`node ${rwfwBinPath} project:copy`, {
console.log('Syncing framework')
await execInProject('yarn rwfw project:tarsync --verbose', {
env: { RWFW_PATH: REDWOOD_FRAMEWORK_PATH },
})
console.log()

console.log('Installing dependencies')
await execInProject('yarn install')
console.log()

console.log(`Building project in ${rscProjectPath}`)
await execInProject(`node ${rwBinPath} build -v`)
console.log()
Expand Down
49 changes: 5 additions & 44 deletions .github/actions/set-up-test-project/setUpTestProject.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@

import path from 'node:path'

import cache from '@actions/cache'
import core from '@actions/core'

import fs from 'fs-extra'

import {
createCacheKeys,
createExecWithEnvInCwd,
projectCopy,
projectDeps,
execInFramework,
REDWOOD_FRAMEWORK_PATH,
} from '../actionsLib.mjs'

Expand All @@ -35,36 +32,13 @@ console.log({

console.log()

const {
dependenciesKey,
distKey
} = await createCacheKeys({ baseKeyPrefix: 'test-project', distKeyPrefix: bundler, canary })

/**
* @returns {Promise<void>}
*/
async function main() {
const distCacheKey = await cache.restoreCache([TEST_PROJECT_PATH], distKey)

if (distCacheKey) {
console.log(`Cache restored from key: ${distKey}`)
return
}

const dependenciesCacheKey = await cache.restoreCache([TEST_PROJECT_PATH], dependenciesKey)

if (dependenciesCacheKey) {
console.log(`Cache restored from key: ${dependenciesKey}`)
await sharedTasks()
} else {
console.log(`Cache not found for input keys: ${distKey}, ${dependenciesKey}`)
await setUpTestProject({
canary: true
})
}

await cache.saveCache([TEST_PROJECT_PATH], distKey)
console.log(`Cache saved with key: ${distKey}`)
await setUpTestProject({
canary: true
})
}

/**
Expand All @@ -82,23 +56,14 @@ async function setUpTestProject({ canary }) {
console.log()
await fs.copy(TEST_PROJECT_FIXTURE_PATH, TEST_PROJECT_PATH)

console.log(`Adding framework dependencies to ${TEST_PROJECT_PATH}`)
await projectDeps(TEST_PROJECT_PATH)
console.log()

console.log(`Installing node_modules in ${TEST_PROJECT_PATH}`)
await execInProject('yarn install')
console.log()
await execInFramework('yarn project:tarsync --verbose', { env: { RWJS_CWD: TEST_PROJECT_PATH } })

if (canary) {
console.log(`Upgrading project to canary`)
await execInProject('yarn rw upgrade -t canary')
console.log()
}

await cache.saveCache([TEST_PROJECT_PATH], dependenciesKey)
console.log(`Cache saved with key: ${dependenciesKey}`)

await sharedTasks()
}

Expand All @@ -108,10 +73,6 @@ const execInProject = createExecWithEnvInCwd(TEST_PROJECT_PATH)
* @returns {Promise<void>}
*/
async function sharedTasks() {
console.log('Copying framework packages to project')
await projectCopy(TEST_PROJECT_PATH)
console.log()

console.log({ bundler })
console.log()

Expand Down
36 changes: 18 additions & 18 deletions .github/actions/set-up-yarn-cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# See https://github.com/yarnpkg/berry/discussions/2621#discussioncomment-505872.

name: Set up yarn cache
description: |
Sets up caching for yarn install steps.
description: >
Sets up caching for `yarn install` steps.
Caches yarn's cache directory, install state, and node_modules.
Caching the cache directory avoids yarn's fetch step and caching node_modules avoids yarn's link step.
runs:
using: composite

steps:
# We try to cache and restore yarn's cache directory and install state to speed up the yarn install step.
# Caching yarn's cache directory avoids its fetch step.
- name: 📁 Get yarn cache directory
- name: 📁 Get yarn's cache directory
id: get-yarn-cache-directory
run: echo "CACHE_DIRECTORY=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash

# If the primary key doesn't match, the cache will probably be stale or incomplete,
# but still worth restoring for the yarn install step.
- name: ♻️ Restore yarn cache
uses: actions/cache@v3
- name: ♻️ Restore yarn's cache
uses: actions/cache@v4
with:
path: ${{ steps.get-yarn-cache-directory.outputs.CACHE_DIRECTORY }}
key: yarn-cache-${{ runner.os }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-cache-${{ runner.os }}
key: yarn-cache-${{ runner.os }}
save-always: true

# We avoid restore-keys for these steps because it's important to just start from scratch for new PRs.
- name: ♻️ Restore yarn install state
uses: actions/cache@v3
- name: ♻️ Restore yarn's install state
uses: actions/cache@v4
with:
path: .yarn/install-state.gz
key: yarn-install-state-${{ runner.os }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
key: yarn-install-state-${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', '.yarnrc.yml') }}
save-always: true

- name: ♻️ Restore node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: yarn-node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
path: node_modules
key: yarn-node-modules-${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', '.yarnrc.yml') }}
save-always: true
5 changes: 0 additions & 5 deletions .github/actions/update_all_contributors/action.yml

This file was deleted.

This file was deleted.

5 changes: 1 addition & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@
"enabled": false,

"matchPackageNames": [
"@apollo/experimental-nextjs-app-support",
"react",
"react-dom",
"react-server-dom-webpack"
"@apollo/experimental-nextjs-app-support"
]
}
]
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- uses: actions/setup-node@v4
- name: Set up job
uses: ./.github/actions/set-up-job
with:
node-version: 20

- run: yarn install
working-directory: ./.github/actions/check_changesets
set-up-yarn-cache: false
yarn-install-directory: ./.github/actions/check_changesets
build: false

- name: Check changesets
uses: ./.github/actions/check_changesets
Expand Down
Loading

0 comments on commit 3f45fe6

Please sign in to comment.