Skip to content

Caminojs npm

Caminojs npm #641

Workflow file for this run

name: cypress-tests
on:
push:
branches: [c4t, dev, suite, suite-c4t]
pull_request:
branches: [c4t, dev, suite, suite-c4t]
env:
suite_image: 'europe-west3-docker.pkg.dev/pwk-c4t-dev/camino-suite-apps/camino-suite-host'
explorer_image: 'europe-west3-docker.pkg.dev/pwk-c4t-dev/camino-suite-apps/camino-suite-explorer'
jobs:
wallet-cypress:
runs-on: ubuntu-latest
strategy:
matrix:
# The node version, you can put one or many versions in here to test with
node: [16]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: get branch name
id: setBranch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
# This should be caching node modules, hashing the cache key with the yarn lock code and busting that when yarn lock changes
- name: cache modules
uses: actions/cache@v3
with:
path: './node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('./yarn.lock') }}
- run: sudo npm install -g yarn
- run: yarn install --network-timeout 1000000
env:
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
- name: build local image
run: |
docker compose build --build-arg SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }} --build-arg EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
export SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }}
export EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
docker compose up -d
docker cp camino-suite-host-container:/app/camino-suite ./
mkdir -p /home/runner/.cache
docker cp camino-suite-host-container:/root/.cache/Cypress /home/runner/.cache/
- name: cypress-run
uses: cypress-io/github-action@v5
env:
USE_HTTP: true
with:
wait-on: 'http://localhost:5001/, http://localhost:5002/, http://localhost:5003/'
working-directory: camino-suite
# wait for 3 minutes for the server to respond
wait-on-timeout: 180
browser: chrome
headless: true
config-file: cypress.config.ts
env: grepTags=@wallet
# These extract all artifacts out from the container to git so they can be previewed
- name: extract screenshots to git
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: camino-suite/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- name: extract videos to git
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: camino-suite/cypress/videos
explorer-cypress:
runs-on: ubuntu-latest
strategy:
matrix:
# The node version, you can put one or many versions in here to test with
node: [16]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: get branch name
id: setBranch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
# This should be caching node modules, hashing the cache key with the yarn lock code and busting that when yarn lock changes
- name: cache modules
uses: actions/cache@v3
with:
path: './node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('./yarn.lock') }}
- run: sudo npm install -g yarn
- run: yarn install --network-timeout 1000000
env:
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
- name: build local image
run: |
docker compose build --build-arg SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }} --build-arg EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
export SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }}
export EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
docker compose up -d
docker cp camino-suite-host-container:/app/camino-suite ./
mkdir -p /home/runner/.cache
docker cp camino-suite-host-container:/root/.cache/Cypress /home/runner/.cache/
- name: cypress-run
uses: cypress-io/github-action@v5
env:
USE_HTTP: true
with:
wait-on: 'http://localhost:5001/, http://localhost:5002/, http://localhost:5003/'
working-directory: camino-suite
# wait for 3 minutes for the server to respond
wait-on-timeout: 180
browser: chrome
headless: true
config-file: cypress.config.ts
env: grepTags=@explorer
# These extract all artifacts out from the container to git so they can be previewed
- name: extract screenshots to git
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: camino-suite/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- name: extract videos to git
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: camino-suite/cypress/videos