From 5f60e77a0e139bf4505b1c610fb8d19f801eba46 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Tue, 15 Aug 2023 13:23:57 +0200 Subject: [PATCH 1/2] Added testing to each pr request --- .github/workflows/external-tests.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/external-tests.yml diff --git a/.github/workflows/external-tests.yml b/.github/workflows/external-tests.yml new file mode 100644 index 000000000..cff5ae36d --- /dev/null +++ b/.github/workflows/external-tests.yml @@ -0,0 +1,26 @@ +name: Run Synpress Tests + +on: + pull_request: + branches: + - is-srpint-24 # adjust if the main branch has a different name + +jobs: + run-synpress-tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout current repository (terra-money/station-extension) + uses: actions/checkout@v2 + + - name: Checkout synpress test repository + uses: actions/checkout@v2 + with: + repository: DimitrijeDragasevic/synpress + path: ./synpress + + - name: Install Dependencies & Run Synpress Tests + run: | + cd synpress + yarn install + yarn test:e2e From 2852c5b3c9be817ba6d0afdac4e477b495d8dea8 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Tue, 15 Aug 2023 16:14:52 +0200 Subject: [PATCH 2/2] Updated scripts --- .github/workflows/external-tests.yml | 26 ------------------ .github/workflows/run-synpress-tests.yml | 34 ++++++++++++++++++++++++ scripts/build-station-extension.sh | 25 +++++++++++++++++ scripts/run-synpress-tests.sh | 8 ++++++ 4 files changed, 67 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/external-tests.yml create mode 100644 .github/workflows/run-synpress-tests.yml create mode 100755 scripts/build-station-extension.sh create mode 100755 scripts/run-synpress-tests.sh diff --git a/.github/workflows/external-tests.yml b/.github/workflows/external-tests.yml deleted file mode 100644 index cff5ae36d..000000000 --- a/.github/workflows/external-tests.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Run Synpress Tests - -on: - pull_request: - branches: - - is-srpint-24 # adjust if the main branch has a different name - -jobs: - run-synpress-tests: - runs-on: ubuntu-latest - - steps: - - name: Checkout current repository (terra-money/station-extension) - uses: actions/checkout@v2 - - - name: Checkout synpress test repository - uses: actions/checkout@v2 - with: - repository: DimitrijeDragasevic/synpress - path: ./synpress - - - name: Install Dependencies & Run Synpress Tests - run: | - cd synpress - yarn install - yarn test:e2e diff --git a/.github/workflows/run-synpress-tests.yml b/.github/workflows/run-synpress-tests.yml new file mode 100644 index 000000000..006964b1c --- /dev/null +++ b/.github/workflows/run-synpress-tests.yml @@ -0,0 +1,34 @@ +name: Run Synpress Tests and Build + +on: + pull_request: + branches: + - is-sprint-24 # adjust if the main branch has a different name + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '16.14.0' # or whatever version you need + + - name: Install jq + run: sudo apt-get install jq + + - name: Execute Build Script + run: ./scripts/build-station-extension.sh + + - name: Checkout synpress test repository + uses: actions/checkout@v2 + with: + repository: DimitrijeDragasevic/synpress + path: synpress + + - name: Execute Synpress Test Script + run: ./scripts/run-synpress-tests.sh diff --git a/scripts/build-station-extension.sh b/scripts/build-station-extension.sh new file mode 100755 index 000000000..6f431ccc9 --- /dev/null +++ b/scripts/build-station-extension.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Remove node_modules and build directories +rm -rf node_modules +rm -rf build + +# Install dependencies +npm install + +# Comment out lines 25-27 in browser-polyfill.js +sed -i '25,27s/^/\/\//g' node_modules/webextension-polyfill/dist/browser-polyfill.js + +# Build the project +npm run build + +# Navigate to build directory and modify manifest.json +cd build + +# Using jq to modify the JSON +jq '.content_scripts[0].js = ["contentScript.js"]' manifest.json > manifest.tmp.json && mv manifest.tmp.json manifest.json + +# (Optional) Navigate back to the root for any subsequent steps in the workflow +cd .. + +echo "Build complete!" diff --git a/scripts/run-synpress-tests.sh b/scripts/run-synpress-tests.sh new file mode 100755 index 000000000..2e326067c --- /dev/null +++ b/scripts/run-synpress-tests.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Navigate to the synpress directory +cd path/to/synpress + +# Install dependencies & run synpress tests +yarn install +yarn test:e2e