Skip to content

Commit

Permalink
ci: Adds action for tests (#393)
Browse files Browse the repository at this point in the history
* starts working on action for tests

* Update tests.yml

* Update tests.yml

* debugging script

* adds testing gh action

* updates changelog and contributing guide

Co-authored-by: Rishabh <[email protected]>
  • Loading branch information
rishabhpoddar and Rishabh authored Mar 19, 2022
1 parent 16ecb96 commit e02c2c1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Run tests"
on:
workflow_dispatch:
inputs:
coreRepoOwnerName:
description: 'supertokens-core repo owner name'
default: supertokens
required: true
pluginRepoOwnerName:
description: 'supertokens-plugin-interface repo owner name'
default: supertokens
required: true
pluginInterfaceBranch:
description: 'supertokens-plugin-interface repos branch name'
default: master
required: true

jobs:
test_job:
name: Run tests
runs-on: ubuntu-latest
container: rishabhpoddar/supertokens_core_testing
steps:
- uses: actions/checkout@v2
- name: Cloning supertokens-root
run: cd ../ && git clone https://github.com/supertokens/supertokens-root.git
- name: Update Java 1
run: update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2
- name: Update Java 2
run: update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2
- name: Modifying modules.txt in supertokens-root
run: cd ../supertokens-root && echo "core,master,${{ github.event.inputs.coreRepoOwnerName }}\nplugin-interface,${{ github.event.inputs.pluginInterfaceBranch }},${{ github.event.inputs.pluginRepoOwnerName }}" > modules.txt
- name: Contents of modules.txt
run: cat ../supertokens-root/modules.txt
- name: Running loadModules in supertokens-root
run: cd ../supertokens-root && ./loadModules
- name: Copying current supertokens-core branch into supertokens-root
run: cd ../supertokens-root && rm -rf ./supertokens-core && cp -r ../supertokens-core ./
- name: Building and running tests
run: cd ../supertokens-root && ./startTestingEnv
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]
- Adds github action for running tests against in memory db.

## [3.11.0] - 2022-03-19
### Changes
Expand Down
15 changes: 14 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Please ask as many questions as you need, either directly in the issue or on [Di
## Development Setup

### With Gitpod
1. Navigate to the `supertokens-root` repository
1. Navigate to the [supertokens-root](https://github.com/supertokens/supertokens-root) repository
2. Click on the `Open in Gitpod` button

### Local Setup Prerequisites
Expand Down Expand Up @@ -72,6 +72,8 @@ Please ask as many questions as you need, either directly in the issue or on [Di
2. After gradle has imported all the dependencies you can start modifying the code
## Testing
### On your local machine
1. Navigate to the `supertokens-root` repository
2. Run all tests
`./startTestingEnv`
Expand All @@ -81,6 +83,17 @@ Please ask as many questions as you need, either directly in the issue or on [Di
- plugin tests:
![plugin tests passing](https://github.com/supertokens/supertokens-logo/blob/master/images/plugin-tests-passing.png)
### Using github actions
1. Go to the supertokens-core repo on github (or your forked version of it).
2. Navigate to the Actions tab.
3. Find the action named "Run tests" and navigate to it.
4. Click on the "Run workflow" button.
5. Set the config variables in the drop down:
- **supertokens-core repo owner name**: If you have forked the supertokens-core repo, then set the value of this to your github username.
- **supertokens-plugin-interface repo owner name**: If you have forked the supertokens-plugin-interface repo, then set the value of this to your github username.
- **supertokens-plugin-interface repos branch name**: If the core version you are working on is compatible with a plugin-interface version that is not in the master branch, then set the correct branch name in this value.
6. Click on "Run workflow".
## Running the core manually
1. Run `startTestingEnv --wait` in a terminal, and keep it running
2. Then open `supertokens-root` in another terminal and run `cp ./temp/config.yaml .`
Expand Down

0 comments on commit e02c2c1

Please sign in to comment.