From 60d32a5fcf77326da334b8b9961ad5cd303f6ed3 Mon Sep 17 00:00:00 2001 From: Walmyr Date: Mon, 13 Dec 2021 02:42:26 +0100 Subject: [PATCH] Create github workflow to run tests First, it will run the unit tests, and only if they all pass, it will run the end-to-end tests (against Chrome and Firefox.) --- .github/workflows/ci.yml | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..3a86cda8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: ci + +on: + push: + branches: + - development + - master + pull_request: + +jobs: + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: yarn install + - name: Run unit tests 🧪 + run: yarn test + end-to-end-tests-chrome: + needs: unit-tests + runs-on: ubuntu-latest + container: cypress/base:16.5.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install dependencies + uses: cypress-io/github-action@v2 + with: + install-command: yarn install + runTests: false + - name: Install Cypress + uses: cypress-io/github-action@v2 + with: + runTests: false + - name: Run end-to-end tests on Chrome 🧪 + uses: cypress-io/github-action@v2 + env: + API_URL: ${{ secrets.API_URL }} + PORT: ${{ secrets.PORT }} + MONGODB_LOCAL_URL: ${{ secrets.MONGODB_LOCAL_URL }} + CYPRESS_user: ${{ secrets.CYPRESS_user }} + CYPRESS_password: ${{ secrets.CYPRESS_password }} + with: + install: false + start: | + yarn start:dev + yarn start:frontend + command: yarn test:cy + end-to-end-tests-firefox: + needs: unit-tests + runs-on: ubuntu-latest + container: cypress/base:16.5.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install dependencies + uses: cypress-io/github-action@v2 + with: + install-command: yarn install + runTests: false + - name: Install Cypress + uses: cypress-io/github-action@v2 + with: + runTests: false + - name: Run end-to-end tests on Firefox 🧪 + uses: cypress-io/github-action@v2 + env: + API_URL: ${{ secrets.API_URL }} + PORT: ${{ secrets.PORT }} + MONGODB_LOCAL_URL: ${{ secrets.MONGODB_LOCAL_URL }} + CYPRESS_user: ${{ secrets.CYPRESS_user }} + CYPRESS_password: ${{ secrets.CYPRESS_password }} + with: + install: false + start: | + yarn start:dev + yarn start:frontend + command: yarn test:cy:firefox