Skip to content

Commit 51b0545

Browse files
committed
feat: adds composite action
0 parents  commit 51b0545

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright GitHub
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# backend-sdk-testing-action
2+
Composite action to clone `backend-sdk-testing`, run tests, and report them on Github.
3+
4+
## Inputs
5+
| Variable | Required | Default | Description |
6+
| -------- | -------- | ------- | ----------- |
7+
| version | true | N/A | The git ref to clone, usually the FDI version |
8+
| path | false | backend-sdk-testing | Relative path where the repo will be cloned

action.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Run supertokens-auth-react tests
2+
description:
3+
Will clone the `supertokens-auth-react` repo in it's own folder in the workspace directory.
4+
Expects `node` to be installed. The test-server and core need to be running before this action.
5+
6+
inputs:
7+
auth-react-version:
8+
description: The git ref to clone, usually a version tag
9+
required: true
10+
11+
node-version:
12+
description: The git ref to use for `supertokens-node`, usually a version tag
13+
required: true
14+
15+
check-name-suffix:
16+
description: Suffix to append to check names (usually matrix values)
17+
required: true
18+
19+
path:
20+
description: Relative path where the repo will be cloned
21+
required: false
22+
default: supertokens-auth-react
23+
24+
should-clone:
25+
description: Whether the `supertokens-auth-react` repo should be cloned
26+
required: false
27+
default: 'true'
28+
29+
runs:
30+
using: composite
31+
32+
steps:
33+
- if: ${{ inputs.should-clone }}
34+
uses: actions/checkout@v4
35+
with:
36+
repository: supertokens/supertokens-auth-react
37+
ref: ${{ inputs.auth-react-version }}
38+
path: ${{ inputs.path }}
39+
40+
- name: Setup auth-react test servers
41+
working-directory: ${{ inputs.path }}
42+
env:
43+
CI: true
44+
BROWSER: none
45+
PORT: 3031
46+
REACT_APP_API_PORT: 8083
47+
TEST_MODE: testing
48+
NODE_PORT: 8082
49+
NODE_TAG: ${{ inputs.node-version }}
50+
shell: bash
51+
run: |
52+
npm init
53+
(cd ./examples/for-tests && npm run link) # this is there because in linux machine, postinstall in npm doesn't work..
54+
cd ./test/server/
55+
npm i git+https://github.com:supertokens/supertokens-node.git#$NODE_TAG
56+
npm i
57+
58+
(cd test/server/ && node . >> ~/test_report/react-logs/backend.log 2>&1 &)
59+
(cd ./examples/for-tests/ && cat | npm run start >> ~/test_report/react-logs/frontend.log 2>&1 &)
60+
61+
- name: Run tests
62+
working-directory: ${{ inputs.path }}
63+
env:
64+
CI: true
65+
BROWSER: none
66+
PORT: 3031
67+
REACT_APP_API_PORT: 8083
68+
TEST_MODE: testing
69+
NODE_PORT: 8082
70+
shell: bash
71+
run: |
72+
npm test-e2e
73+
74+
- if: always()
75+
name: Fix paths
76+
working-directory: ${{ inputs.path }}
77+
shell: bash
78+
# Doing it in the shell since the Reporter's `transformers` don't seem to work
79+
run: sed -i "s|${{ github.workspace }}/${{ inputs.path }}/test||g" test-report/test-results.xml
80+
81+
- if: always()
82+
name: Reporter
83+
# Alternative: dorny/test-reporter@v1 - does not create a summary
84+
uses: mikepenz/action-junit-report@v5
85+
with:
86+
report_paths: ${{ inputs.path }}/test-results.xml
87+
check_name: Auth React Tests ${{ inputs.check-name-suffix }}
88+
# Include table with all test results in the summary
89+
detailed_summary: true
90+
# Group the testcases by test suite in the detailed_summary
91+
group_suite: true
92+
# Fail if no test are found.
93+
require_tests: true
94+
# Fail the build in case of a test failure.
95+
fail_on_failure: true

0 commit comments

Comments
 (0)