Skip to content

Commit

Permalink
ci: make test runs into a matrix job
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Oct 11, 2023
1 parent 18e431a commit 978b4a2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,22 @@ on:
required: true
type: string
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- run: bash test/listTestsFiles.sh
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":$(bash test/findExamplesWithTests.sh)}"
test_job:
name: Run tests
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.setup.outputs.matrix)}}
fail-fast: false
container: rishabhpoddar/supertokens_website_sdk_testing
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -72,4 +84,4 @@ jobs:
- name: Setting up supertokens-root test environment
run: cd ../supertokens-root && bash ./utils/setupTestEnvLocal
- name: Run tests
run: INSTALL_PATH=../supertokens-root npm run test
run: INSTALL_PATH=../supertokens-root npm run test -- --ignore "./test/**/*.test.js" ${{ matrix.testPath }}
9 changes: 9 additions & 0 deletions test/listTestFiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
matrixEntries=""
delim=""
while IFS= read -r -d $'\0'; do
matrixEntries+=$delim"{\"testPath\": \""$(echo "$REPLY" )\""}"; # or however you want to process each file
delim=", "
done < <(find ./examples -name *.test.js -print0)

matrixEntries="[$matrixEntries]"
echo $matrixEntries

0 comments on commit 978b4a2

Please sign in to comment.