Skip to content

add some tests

add some tests #1219

name: Cypress tests
on:
push:
paths:
- 'daikoku/app/**'
- 'daikoku/javascript/**'
- '.github/workflows/front-office-tests.yml'
workflow_dispatch:
jobs:
cypress-run:
name: Cypress run
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: daikoku_test
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2.2.0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
# install node 16
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '16'
- uses: coursier/cache-action@v5
- name: initialize backend build
run: |
cd daikoku
sbt ';clean;compile'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: CACHE ACTION
uses: actions/cache@v2
env:
cache-version: v1
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.cache-version }}-
${{ runner.os }}-yarn-
${{ runner.os }}-
- name: Installing dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
cd daikoku/javascript
echo "YARN CACHE CHANGED"
rm -rf node_modules/
yarn install
- name: build javascript
run: |
cd daikoku/javascript
yarn build
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Cypress run and publish report
uses: cypress-io/github-action@v2
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
with:
browser: chrome
headless: true
start: yarn cypress:start:backend
wait-on: 'http://localhost:9000'
command: yarn test:cypress
working-directory: daikoku/javascript