|
| 1 | +name: Auth-React Tests - L1 |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: |
| 6 | + - opened |
| 7 | + - reopened |
| 8 | + - synchronize |
| 9 | + push: |
| 10 | + tags: |
| 11 | + - dev-v[0-9]+.[0-9]+.[0-9]+ |
| 12 | + |
| 13 | +# Only one instance of this workflow will run on the same ref (PR/Branch/Tag) |
| 14 | +# Previous runs will be cancelled. |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + define-versions: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + fdiVersions: ${{ steps.versions.outputs.fdiVersions }} |
| 24 | + webJsInterfaceVersion: ${{ steps.versions.outputs.webJsInterfaceVersion }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - uses: supertokens/get-supported-versions-action@main |
| 29 | + id: versions |
| 30 | + with: |
| 31 | + has-fdi: true |
| 32 | + has-web-js: true |
| 33 | + |
| 34 | + setup-auth-react: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + needs: define-versions |
| 37 | + strategy: |
| 38 | + fail-fast: true |
| 39 | + matrix: |
| 40 | + fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }} |
| 41 | + |
| 42 | + outputs: |
| 43 | + AUTH_REACT__LOG_DIR: ${{ steps.envs.outputs.AUTH_REACT__LOG_DIR }} |
| 44 | + AUTH_REACT__SCREENSHOT_DIR: ${{ steps.envs.outputs.AUTH_REACT__SCREENSHOT_DIR }} |
| 45 | + AUTH_REACT__NODE_PORT: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }} |
| 46 | + AUTH_REACT__APP_SERVER: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }} |
| 47 | + AUTH_REACT__TEST_MODE: ${{ steps.envs.outputs.AUTH_REACT__TEST_MODE }} |
| 48 | + AUTH_REACT__PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }} |
| 49 | + specs: ${{ steps.envs.outputs.specs }} |
| 50 | + fdiVersions: ${{ needs.define-versions.outputs.fdiVersions }} |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + path: supertokens-web-js |
| 56 | + |
| 57 | + - uses: actions/setup-node@v4 |
| 58 | + with: |
| 59 | + node-version: 20 |
| 60 | + |
| 61 | + - uses: supertokens/get-versions-action@main |
| 62 | + id: versions |
| 63 | + with: |
| 64 | + driver-name: node |
| 65 | + fdi-version: ${{ matrix.fdi-version }} |
| 66 | + fetch-frontend-versions: false |
| 67 | + web-js-interface-version: ${{ needs.define-versions.outputs.webJsInterfaceVersion }} |
| 68 | + env: |
| 69 | + SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} |
| 70 | + |
| 71 | + - uses: supertokens/auth-react-testing-action/setup@main |
| 72 | + id: envs |
| 73 | + with: |
| 74 | + auth-react-version: ${{ steps.versions.outputs.webJsReactVersionXy }} |
| 75 | + node-sdk-version: ${{ steps.versions.outputs.nodeTag }} |
| 76 | + fdi-version: ${{ matrix.fdi-version }} |
| 77 | + use-common-app-and-test-server: "true" |
| 78 | + persist-workspace: "false" |
| 79 | + |
| 80 | + # We will use this in the test run to get the core version |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + repository: supertokens/supertokens-node |
| 84 | + ref: ${{ steps.versions.outputs.nodeTag }} |
| 85 | + path: supertokens-node |
| 86 | + |
| 87 | + - name: Copy over required dependencies |
| 88 | + run: | |
| 89 | + cd supertokens-web-js |
| 90 | + # Create a tarball of the web-js package |
| 91 | + npm pack |
| 92 | +
|
| 93 | + cd ../supertokens-auth-react |
| 94 | + # Extract the tarball to the auth-react package |
| 95 | + tar -xf ../supertokens-web-js/supertokens-web-js-*.tgz --strip-components=1 -C node_modules/supertokens-web-js |
| 96 | + # # Remove existing website package and link to the one from web-js |
| 97 | + # rm -rf node_modules/supertokens-website |
| 98 | + # ln -s "../supertokens-web-js/node_modules/supertokens-website" node_modules |
| 99 | +
|
| 100 | + - name: Set up auth-react with new dependencies |
| 101 | + working-directory: supertokens-auth-react/examples/for-tests |
| 102 | + env: |
| 103 | + # Common |
| 104 | + APP_SERVER: ${{ steps.envs.outputs.AUTH_REACT__APP_SERVER }} |
| 105 | + NODE_PORT: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }} |
| 106 | + TEST_MODE: ${{ steps.envs.outputs.AUTH_REACT__TEST_MODE }} |
| 107 | + # Step-specific |
| 108 | + CI: true |
| 109 | + BROWSER: none |
| 110 | + PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }} |
| 111 | + REACT_APP_API_PORT: ${{ steps.envs.outputs.AUTH_REACT__APP_SERVER }} |
| 112 | + run: | |
| 113 | + npm run prep |
| 114 | +
|
| 115 | + - uses: bissolli/gh-action-persist-workspace@v2 |
| 116 | + with: |
| 117 | + action: persist |
| 118 | + artifactName: auth-react-${{ matrix.fdi-version }} |
| 119 | + |
| 120 | + launch-test-workflow: |
| 121 | + uses: ./.github/workflows/auth-react-test-2.yml |
| 122 | + needs: setup-auth-react |
| 123 | + name: FDI ${{ matrix.fdi-version }} |
| 124 | + strategy: |
| 125 | + max-parallel: 1 # This is important to avoid ddos GHA API |
| 126 | + fail-fast: false # Don't fail fast to avoid locking TF State |
| 127 | + matrix: |
| 128 | + fdi-version: ${{ fromJSON(needs.setup-auth-react.outputs.fdiVersions) }} |
| 129 | + with: |
| 130 | + fdi-version: ${{ matrix.fdi-version }} |
| 131 | + specs: ${{ needs.setup-auth-react.outputs.specs }} |
| 132 | + AUTH_REACT__LOG_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__LOG_DIR }} |
| 133 | + AUTH_REACT__SCREENSHOT_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__SCREENSHOT_DIR }} |
| 134 | + AUTH_REACT__APP_SERVER: ${{ needs.setup-auth-react.outputs.AUTH_REACT__APP_SERVER }} |
| 135 | + AUTH_REACT__NODE_PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__NODE_PORT }} |
| 136 | + AUTH_REACT__TEST_MODE: ${{ needs.setup-auth-react.outputs.AUTH_REACT__TEST_MODE }} |
| 137 | + AUTH_REACT__PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__PORT }} |
| 138 | + secrets: inherit |
0 commit comments