|
1 | | -name: Integration test |
| 1 | +name: Integration test (Next.js) |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
8 | 8 | - cron: '0 0 * * *' # end of each day (UTC) |
9 | 9 | pull_request: |
10 | 10 |
|
11 | | -env: |
12 | | - NEXTJS_FOLDER: next-js-test |
13 | | - |
14 | 11 | jobs: |
15 | 12 | test: |
16 | 13 | if: ${{ github.repository == 'primer/brand' }} |
17 | | - name: Next.js |
| 14 | + name: Next.js (${{ matrix.bundle }}) |
18 | 15 | runs-on: |
19 | 16 | labels: ubuntu-latest-16-cores |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + bundle: [umd, esm] |
| 21 | + include: |
| 22 | + - bundle: umd |
| 23 | + nextjs_folder: next-js-test |
| 24 | + - bundle: esm |
| 25 | + nextjs_folder: next-js-esm-test |
| 26 | + env: |
| 27 | + NEXTJS_FOLDER: ${{ matrix.nextjs_folder }} |
20 | 28 | steps: |
21 | 29 | - name: Checkout repository |
22 | 30 | uses: actions/checkout@v6 |
|
34 | 42 | restore-keys: | |
35 | 43 | ${{ runner.os }}-node- |
36 | 44 |
|
37 | | - # Restore the previous NPM modules and Cypress binary archives. |
38 | | - # Any updated archives will be saved automatically after the entire |
39 | | - # workflow successfully finishes. |
40 | | - # See https://github.com/actions/cache |
41 | 45 | - name: Cache Cypress binary |
42 | 46 | uses: actions/cache@v5 |
43 | 47 | with: |
|
51 | 55 |
|
52 | 56 | - name: install dependencies and verify Cypress |
53 | 57 | env: |
54 | | - # make sure every Cypress install prints minimal information |
55 | 58 | CI: 1 |
56 | | - # print Cypress and OS info |
57 | 59 | run: | |
58 | 60 | npx cypress@15.13.0 install --force |
59 | 61 | npx cypress@15.13.0 verify |
@@ -81,45 +83,40 @@ jobs: |
81 | 83 |
|
82 | 84 | - name: Installing local build |
83 | 85 | run: | |
84 | | - cd ${{env.NEXTJS_FOLDER}} |
85 | | - cp ../packages/react/primer-react-brand-${{ steps.package-version.outputs.current-version}}.tgz ./ |
86 | | - npm install primer-react-brand-${{ steps.package-version.outputs.current-version}}.tgz |
| 86 | + cd ${{ env.NEXTJS_FOLDER }} |
| 87 | + cp ../packages/react/primer-react-brand-${{ steps.package-version.outputs.current-version }}.tgz ./ |
| 88 | + npm install primer-react-brand-${{ steps.package-version.outputs.current-version }}.tgz |
87 | 89 |
|
88 | | - - name: Prefer ESM imports |
| 90 | + - name: Prepare barrel file for bundle type |
89 | 91 | run: | |
90 | | - mv ./packages/e2e/integration-tests/fixtures/index.esm.ts ./packages/e2e/integration-tests/fixtures/index.ts |
91 | | - rm ./packages/e2e/integration-tests/fixtures/index.cjs.ts |
| 92 | + cp ./packages/e2e/integration-tests/fixtures/index.${{ matrix.bundle }}.ts ./packages/e2e/integration-tests/fixtures/index.ts |
| 93 | + rm ./packages/e2e/integration-tests/fixtures/index.umd.ts ./packages/e2e/integration-tests/fixtures/index.esm.ts |
92 | 94 |
|
93 | 95 | - name: Copying required files |
94 | 96 | run: | |
95 | | - rm ./${{env.NEXTJS_FOLDER}}/app/page.tsx |
96 | | - cp ./packages/e2e/integration-tests/nextjs/page.tsx ./${{env.NEXTJS_FOLDER}}/app |
97 | | -
|
98 | | - - name: Copying required files |
99 | | - run: | |
100 | | - cp ./packages/e2e/integration-tests/nextjs/page.tsx ./${{env.NEXTJS_FOLDER}}/app |
101 | | - cp ./packages/e2e/cypress.config.js ./${{env.NEXTJS_FOLDER}} |
102 | | - mkdir ${{env.NEXTJS_FOLDER}}/integration-tests |
103 | | - cp -r ./packages/e2e/integration-tests/fixtures ./${{env.NEXTJS_FOLDER}}/integration-tests |
104 | | - cp -r ./packages/e2e/integration-tests/tests ./${{env.NEXTJS_FOLDER}}/integration-tests |
| 97 | + rm ./${{ env.NEXTJS_FOLDER }}/app/page.tsx |
| 98 | + cp ./packages/e2e/integration-tests/nextjs/page.tsx ./${{ env.NEXTJS_FOLDER }}/app |
| 99 | + cp ./packages/e2e/cypress.config.js ./${{ env.NEXTJS_FOLDER }} |
| 100 | + mkdir ${{ env.NEXTJS_FOLDER }}/integration-tests |
| 101 | + cp -r ./packages/e2e/integration-tests/fixtures ./${{ env.NEXTJS_FOLDER }}/integration-tests |
| 102 | + cp -r ./packages/e2e/integration-tests/tests ./${{ env.NEXTJS_FOLDER }}/integration-tests |
105 | 103 |
|
106 | 104 | - name: Excluded cypress tests in-place |
107 | 105 | # includes temp workaround for cypress bug. remove when fixed |
108 | 106 | # https://github.com/cypress-io/cypress/issues/27448 |
109 | 107 | run: npx json@11.0.0 -I -f ${{env.NEXTJS_FOLDER}}/tsconfig.json -e 'this.exclude=["node_modules", "**/*.cy.ts"]; this.compilerOptions.moduleResolution="node"' |
110 | 108 |
|
111 | 109 | - name: Fix monorepo-related linting issues |
112 | | - run: | |
113 | | - npm run lint -- --fix |
| 110 | + run: npm run lint -- --fix |
114 | 111 |
|
115 | 112 | # Needed to fix compilation errors and conflicts between TS and React type defs. |
116 | 113 | # All subsequent steps should not be dependent on the primer/brand repo contents. |
117 | 114 | - name: Clean workspace before testing |
118 | 115 | run: | |
119 | | - find . -maxdepth 1 -mindepth 1 -not -name ${{env.NEXTJS_FOLDER}} -exec rm -rf {} + |
| 116 | + find . -maxdepth 1 -mindepth 1 -not -name ${{ env.NEXTJS_FOLDER }} -exec rm -rf {} + |
120 | 117 |
|
121 | 118 | - name: Testing compile-time build |
122 | | - run: cd ${{env.NEXTJS_FOLDER}} && npm run build |
| 119 | + run: cd ${{ env.NEXTJS_FOLDER }} && npm run build |
123 | 120 |
|
124 | 121 | - name: Test runtime for errors and warnings |
125 | 122 | run: cd ${{env.NEXTJS_FOLDER}} && npx start-server-and-test@3.0.0 'start' 3000 'npx cypress@15.13.0 run --spec "./integration-tests/tests/*" --config video=false' |
0 commit comments