improve github ci workflows #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
pull_request: | |
branches: [stage,accounts,production,dev] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup custom host for mylocal | |
run: echo "127.0.0.1 test.zesty.io" | sudo tee -a /etc/hosts | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
unit-tests: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: npm install | |
- name: Run unit tests | |
run: npm run test | |
cypress-tests: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: npm install | |
- name: Write the cypress.env.json file 📝 | |
run: | | |
echo '${{ secrets.CYPRESS_ENV_CI }}' > cypress.json | |
- name: Run E2E test | |
run: npm run test:e2e:ci:prod | |
- name: Save screenshots 🖼 | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |