Feature/README #340
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: Cypress & Jest Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
install-cache: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: npm-cache | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies if cache invalid | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm install | |
cypress-run: | |
runs-on: ubuntu-latest | |
needs: install-cache | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Restore npm dependencies | |
uses: actions/cache@v2 | |
id: npm-cache | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Cypress run | |
uses: cypress-io/github-action@v2 | |
with: | |
build: npm run build | |
start: npm run dev | |
env: | |
VITE_HORIZON_NETWORK_PASSPHRASE: Test SDF Network ; September 2015 | |
VITE_STELLAR_NETWORK: ${{ secrets.VITE_STELLAR_NETWORK }} | |
CYPRESS_SIMPLE_SIGNER_PRIVATE_KEY: ${{ secrets.SIMPLE_SIGNER_PRIVATE_KEY }} | |
test: | |
runs-on: ubuntu-latest | |
needs: install-cache | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Restore npm dependencies | |
uses: actions/cache@v2 | |
id: npm-cache | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Run the tests | |
run: | | |
npm install | |
npm run test | |
build-and-deploy: | |
needs: [cypress-run, test] | |
if: ${{ github.ref_name == 'main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Install and Build | |
run: | | |
npm install | |
npm run build | |
- name: Deploy | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: dist |