From af596a70a65f8c465d39b855dae58ff28751880d Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Tue, 10 Oct 2023 17:34:13 +0200 Subject: [PATCH] ci: auto run tests for open PRs --- .github/workflows/tests-auto-run.yml | 12 +++++++++++ .github/workflows/tests.yml | 32 +++++++++++++++++++++------- 2 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/tests-auto-run.yml diff --git a/.github/workflows/tests-auto-run.yml b/.github/workflows/tests-auto-run.yml new file mode 100644 index 000000000..7f73f5512 --- /dev/null +++ b/.github/workflows/tests-auto-run.yml @@ -0,0 +1,12 @@ +name: "Auto run tests on open PRs" +on: + pull_request: + +jobs: + run_test_job: + uses: ./.github/workflows/tests.yml + with: + pluginInterfaceRepoOwnerName: supertokens + pluginInterfaceBranchName: master + coreRepoOwnerName: supertokens + coreBranchName: master diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f2aab6192..bc629c375 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,6 +18,16 @@ on: description: "supertokens-core repo branch name" default: master required: true + workflow_call: + inputs: + pluginInterfaceRepoOwnerName: + required: true + pluginInterfaceBranchName: + required: true + coreRepoOwnerName: + required: true + coreBranchName: + required: true jobs: test_job: name: Run tests @@ -25,19 +35,25 @@ jobs: runs-on: ubuntu-latest container: rishabhpoddar/supertokens_website_sdk_testing steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Set up node + uses: actions/setup-node@v3 + with: + node-version: "16" - name: Environment variables run: | echo "Plugin Interface Owner: ${{ github.event.inputs.pluginInterfaceRepoOwnerName }}" echo "Plugin Interface Branch: ${{ github.event.inputs.pluginInterfaceBranchName }}" echo "Core Owner: ${{ github.event.inputs.coreRepoOwnerName }}" echo "Core Branch: ${{ github.event.inputs.coreBranchName }}" - - uses: actions/checkout@v2 - with: - persist-credentials: false - - name: Set up node - uses: actions/setup-node@v1 - with: - node-version: "16" + - name: Environment variables + run: | + echo "Plugin Interface Owner: ${{ $PLUGIN_INTERFACE_OWNER }}" + echo "Plugin Interface Branch: ${{ PLUGIN_INTERFACE_BRANCH }}" + echo "Core Owner: ${{ $CORE_OWNER }}" + echo "Core Branch: ${{ CORE_BRANCH }}" - name: Make git use https instead of ssh run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ - run: npm i --force @@ -48,7 +64,7 @@ jobs: - 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,${{ github.event.inputs.coreBranchName }},${{ github.event.inputs.coreRepoOwnerName }}\nplugin-interface,${{ github.event.inputs.pluginInterfaceBranchName }},${{ github.event.inputs.pluginInterfaceRepoOwnerName }}" > modules.txt + run: cd ../supertokens-root && echo "core,${{ CORE_BRANCH }},${{ $CORE_OWNER }}\nplugin-interface,${{ PLUGIN_INTERFACE_BRANCH }},${{ $PLUGIN_INTERFACE_OWNER }}" > modules.txt - name: Contents of modules.txt run: cat ../supertokens-root/modules.txt - name: Running loadModules in supertokens-root