-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mark Wentowski
authored and
Mark Wentowski
committed
Mar 7, 2024
1 parent
885c1a8
commit 4754713
Showing
1 changed file
with
42 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,43 @@ | ||
name: Test examples | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
name: "Test examples" | ||
on: push | ||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: bash test/findExamplesWithTests.sh | ||
- id: set-matrix | ||
run: echo "::set-output name=matrix::{\"include\":$(bash test/findExamplesWithTests.sh)}" | ||
|
||
test: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | ||
fail-fast: false | ||
env: | ||
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.example_testing_supabase_public_url }} | ||
NEXT_PUBLIC_SUPABASE_KEY: ${{ secrets.example_testing_supabase_public_key }} | ||
SUPABASE_SIGNING_SECRET: ${{ secrets.example_testing_supabase_signing_secret }} | ||
defaults: | ||
run: | ||
working-directory: ${{ matrix.examplePath }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: bash ../../test/updateExampleAppDeps.sh . | ||
- run: npm install [email protected] [email protected] puppeteer@^11.0.0 isomorphic-fetch@^3.0.0 | ||
- run: npm run build || true | ||
- name: Run tests | ||
run: | | ||
HOST= npm start & bash ../../test/waitForServerStartup.sh | ||
echo "=========== Running JavaScript tests ============" | ||
(npx mocha --no-config --timeout 80000 test/**/*.test.js && exit 0) || \ | ||
(echo "=========== Test attempt 2 ===========" && npx mocha --no-config --timeout 80000 test/**/*.test.js && exit 0) || \ | ||
(echo "=========== Test attempt 3 ===========" && npx mocha --no-config --timeout 80000 test/**/*.test.js) | ||
echo "=========== Running CommonJS tests ============" | ||
(npx mocha --no-config --timeout 80000 test/**/*.test.cjs && exit 0) || \ | ||
(echo "=========== Test attempt 2 ===========" && npx mocha --no-config --timeout 80000 test/**/*.test.cjs && exit 0) || \ | ||
(echo "=========== Test attempt 3 ===========" && npx mocha --no-config --timeout 80000 test/**/*.test.cjs) | ||
- name: Upload screenshots on failure | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: screenshots | ||
path: ./**/*screenshot.jpeg | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: bash test/findExamplesWithTests.sh | ||
- id: set-matrix | ||
run: echo "::set-output name=matrix::{\"include\":$(bash test/findExamplesWithTests.sh)}" | ||
test: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: ${{fromJson(needs.setup.outputs.matrix)}} | ||
fail-fast: false | ||
env: | ||
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.example_testing_supabase_public_url }} | ||
NEXT_PUBLIC_SUPABASE_KEY: ${{ secrets.example_testing_supabase_public_key }} | ||
SUPABASE_SIGNING_SECRET: ${{ secrets.example_testing_supabase_signing_secret }} | ||
defaults: | ||
run: | ||
working-directory: ${{ matrix.examplePath }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: bash ../../test/updateExampleAppDeps.sh . | ||
- run: npm install [email protected] [email protected] puppeteer@^11.0.0 isomorphic-fetch@^3.0.0 | ||
- run: npm run build || true | ||
- run: | | ||
(HOST= npm start & bash ../../test/waitForServerStartup.sh) && ( \ | ||
(echo "=========== Test attempt 1 ===========" && npx mocha --no-config --timeout 80000 test/**/*.{test.js,test.cjs}) || \ | ||
(echo "=========== Test attempt 2 ===========" && npx mocha --no-config --timeout 80000 test/**/*.{test.js,test.cjs}) || \ | ||
(echo "=========== Test attempt 3 ===========" && npx mocha --no-config --timeout 80000 test/**/*.{test.js,test.cjs}) \ | ||
) | ||
) | ||
- name: The job has failed | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: screenshots | ||
path: ./**/*screenshot.jpeg |