From 2c3c5f7a2a38a4bf9f379c32e5935a2cfd9211fe Mon Sep 17 00:00:00 2001 From: Vitalii Vozniak Date: Thu, 17 Aug 2023 09:56:03 +0300 Subject: [PATCH] chore(cip-1694): run tests on ci --- .github/workflows/build-ui.yaml | 48 +++++++++++++++++++++++++ .github/workflows/ui-cypress-tests.yaml | 44 ----------------------- ui/cip-1694/package.json | 3 +- 3 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/build-ui.yaml delete mode 100644 .github/workflows/ui-cypress-tests.yaml diff --git a/.github/workflows/build-ui.yaml b/.github/workflows/build-ui.yaml new file mode 100644 index 000000000..7f56b46f0 --- /dev/null +++ b/.github/workflows/build-ui.yaml @@ -0,0 +1,48 @@ +name: Run Voting App UI Tests +on: + push: + branches-ignore: + - "main" + pull_request: + branches-ignore: + - "main" + +jobs: + test: + runs-on: ubuntu-latest + env: + APP_SERVER_URL: ${{ secrets.APP_SERVER_URL }} + TARGET_NETWORK: ${{ secrets.TARGET_NETWORK }} + EVENT_ID: ${{ secrets.EVENT_ID }} + CATEGORY_ID: ${{ secrets.CATEGORY_ID }} + COMMIT_HASH: ${{ secrets.COMMIT_HASH }} + SUPPORTED_WALLETS: ${{ github.sha }} + steps: + - name: ⬇️ Checkout repository + uses: actions/checkout@v3 + + - name: 🫡 Setup node + uses: actions/setup-node@v1 + with: + node-version: 18 + + - name: 🧘‍♀️ Download dependencies + run: | + cd ui/cip-1694 + npm i + + - name: 🎳 Run tests + run: | + cd ui + cd cip-1694 + npm run jest-test --env=node + + - name: 🎳 Build + run: | + cd ui/cip-1694 + npm run react-inject-env && npm run build + + - name: Upload build + uses: actions/upload-artifact@v3 + with: + path: ui/cip-1694/build diff --git a/.github/workflows/ui-cypress-tests.yaml b/.github/workflows/ui-cypress-tests.yaml deleted file mode 100644 index 6a7114d91..000000000 --- a/.github/workflows/ui-cypress-tests.yaml +++ /dev/null @@ -1,44 +0,0 @@ -name: Run Voting App Cypress Tests -on: - push: - branches-ignore: - - "main" - pull_request: - branches-ignore: - - "main" - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repository - uses: actions/checkout@v3 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: 🦾 Create .env file - run: | - echo "PORT=3000" > .env - echo "REACT_APP_VERSION=$npm_package_version" >> .env - - - name: 🫡 Setup node - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: 🧘‍♀️ Download dependencies - run: | - cd ui - cd cip-1694 - npm i - - - name: 🎳 Run tests - run: | - cd ui - cd cip-1694 - npm test diff --git a/ui/cip-1694/package.json b/ui/cip-1694/package.json index 6bf4122b0..c9720eab6 100644 --- a/ui/cip-1694/package.json +++ b/ui/cip-1694/package.json @@ -75,8 +75,9 @@ }, "scripts": { "start": "react-scripts start", - "build": "REACT_APP_SERVER_URL= REACT_APP_TARGET_NETWORK= REACT_APP_EVENT_ID= REACT_APP_CATEGORY_ID= REACT_APP_SUPPORTED_WALLETS= npx react-inject-env build react-scripts build", + "build": "react-scripts build", "jest-test": "jest --config ./jest.config.js", + "react-inject-env": "react-inject-env set", "eject": "react-scripts eject", "cypress:open": "cypress open", "cypress:run": "cypress run",