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

chore(CI): test webpack in tutorial e2e #8602

Merged
merged 2 commits into from
Jun 13, 2023
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
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ jobs:

tutorial-e2e:
needs: check

strategy:
matrix:
os: [ubuntu-latest]
fail-fast: true
name: 🌲 Tutorial E2E / ${{ matrix.os }} / node 18 latest
runs-on: ${{ matrix.os }}
bundler: [vite, webpack]

name: 🌲 Tutorial E2E / ${{ matrix.bundler }} / node 18 latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included the bundler in the check's name so I'll have to change the branch protection rules to accommodate

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

Expand All @@ -153,7 +155,10 @@ jobs:
echo "::set-output name=framework_path::$framework_path"

- name: 🌲 Create a Redwood App
run: ./tasks/run-e2e ${{ steps.createpath.outputs.project_path }} --no-start
run: |
./tasks/run-e2e ${{ steps.createpath.outputs.project_path }} \
--no-start \
--bundler ${{ matrix.bundler }}
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false

Expand Down
22 changes: 20 additions & 2 deletions tasks/run-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const buildRedwoodFramework = () => {
}
}

const createRedwoodJSApp = ({ typescript }) => {
const createRedwoodJSApp = ({ typescript, bundler }) => {
try {
execa.sync(
'yarn node dist/create-redwood-app.js',
Expand Down Expand Up @@ -86,6 +86,18 @@ const createRedwoodJSApp = ({ typescript }) => {
}

fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, 2))

if (bundler === 'webpack') {
const redwoodTOMLPath = path.join(
REDWOOD_PROJECT_DIRECTORY,
'redwood.toml'
)
const redwoodTOML = fs.readFileSync(redwoodTOMLPath, 'utf-8')
fs.writeFileSync(
redwoodTOMLPath,
redwoodTOML.replace('[web]\n', '[web]\n bundler = "webpack"\n')
)
}
} catch (e) {
if (e.signal !== 'SIGINT') {
console.error('Error: Could not create Redwood Project')
Expand Down Expand Up @@ -232,6 +244,11 @@ const args = yargs(hideBin(process.argv))
.option('typescript', { default: false, type: 'boolean', alias: 'ts' })
.option('auto-start', { default: true, type: 'boolean', alias: 'start' })
.option('clean-files', { default: true, type: 'boolean' })
.option('bundler', {
default: 'vite',
type: 'string',
choices: ['vite', 'webpack'],
})
.scriptName('run-e2e')
.example('run-e2e')
.example('run-e2e /tmp/redwood-app --ts')
Expand Down Expand Up @@ -260,12 +277,13 @@ let {
copyFramework,
createProject,
typescript,
bundler,
autoStart,
cleanFiles,
} = args
const tasks = [
buildFramework && buildRedwoodFramework,
createProject && (() => createRedwoodJSApp({ typescript })),
createProject && (() => createRedwoodJSApp({ typescript, bundler })),
copyFramework && addFrameworkDepsToProject,
copyFramework && runYarnInstall,
copyFramework && copyFrameworkPackages,
Expand Down