Skip to content

Commit

Permalink
Infra: Separate out examples CI steps (#1194)
Browse files Browse the repository at this point in the history
* Separate out examples CI steps

* Hahaha

* Combine start and test

* Set timeout

* chore: fix tsconfig for generated projects

* chore: make jest ignore compiled or cached test files

* chore: increase jest timeout

* chore: comment on timeout-altering line

Co-authored-by: fritz-c <4413963+fritz-c@users.noreply.github.com>
  • Loading branch information
ryan-roemer and fritz-c authored Sep 19, 2022
1 parent 0ee44a7 commit 9f1d40b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/create-spectacle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ on:
branches:
- main
paths:
- ".github/workflows/create-spectacle.yml"
- "packages/create-spectacle/**"
pull_request:
branches:
- main
paths:
- ".github/workflows/create-spectacle.yml"
- "packages/create-spectacle/**"

jobs:
build:
name: Create, build, and install
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -55,15 +58,20 @@ jobs:
# Then, start a background dev server.
- name: Create example - ${{ matrix.create-type }}
working-directory: ./packages/create-spectacle
run: |
pnpm run examples:${{ matrix.create-type }}:create && \
pnpm run examples:${{ matrix.create-type }}:install && \
pnpm run examples:${{ matrix.create-type }}:build && \
pnpm run examples:${{ matrix.create-type }}:start &
run: pnpm run examples:${{ matrix.create-type }}:create

- name: Install example - ${{ matrix.create-type }}
working-directory: ./packages/create-spectacle
run: pnpm run examples:${{ matrix.create-type }}:install

- name: Build example - ${{ matrix.create-type }}
working-directory: ./packages/create-spectacle
run: pnpm run examples:${{ matrix.create-type }}:build

# Wait until the dev server is full up and running and then test.
- name: Test example - ${{ matrix.create-type }}
- name: Start and test example - ${{ matrix.create-type }}
working-directory: ./packages/create-spectacle
run: |
pnpm run examples:${{ matrix.create-type }}:start & \
pnpm exec wait-on http-get://localhost:3000 && \
pnpm run examples:test
7 changes: 6 additions & 1 deletion packages/create-spectacle/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module.exports = {
preset: 'ts-jest/presets/js-with-ts'
preset: 'ts-jest/presets/js-with-ts',
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/bin/',
'<rootDir>/.wireit/'
]
};
1 change: 1 addition & 0 deletions packages/create-spectacle/src/templates/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const tsconfigTemplate = () =>
"jsx": "react-jsx",
"module": "commonjs",
"moduleResolution": "node",
"allowJs": true,
"allowUmdGlobalAccess": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
Expand Down
3 changes: 3 additions & 0 deletions packages/create-spectacle/test/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import type { Browser, Page } from 'puppeteer';
import puppeteer from 'puppeteer';
import { getLaunchOptions } from './util';

// Make the test timeout longer to accomodate Puppeteer startup
jest.setTimeout(20000);

describe('App.js', () => {
let browser: Browser;
let page: Page;
Expand Down

0 comments on commit 9f1d40b

Please sign in to comment.