Skip to content

Fix test failing due to api migrated now #3604

Fix test failing due to api migrated now

Fix test failing due to api migrated now #3604

Workflow file for this run

name: End to end testing
on:
push:
branches:
- "**"
- "!master"
jobs:
quality-control:
runs-on: ubuntu-20.04
env:
PG_USER: datapass
PG_PASSWORD: datapass
PG_DATABASE: datapass
services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgres:12.12
env:
POSTGRES_USER: ${{ env.PG_USER }}
POSTGRES_PASSWORD: ${{ env.PG_PASSWORD }}
POSTGRES_DB: ${{ env.PG_DATABASE }}
ports:
- 5432:5432
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v3
- name: Override INSEE dotenv info
run: |
echo "INSEE_HOST=https://api.insee.fr" >> .env
echo "INSEE_CONSUMER_KEY=${{ secrets.INSEE_CONSUMER_KEY }}" >> .env
echo "INSEE_CONSUMER_SECRET=${{ secrets.INSEE_CONSUMER_SECRET }}" >> .env
- name: Load dotenv
uses: falti/[email protected]
with:
log-variables: true
export-variables: true
keys-case: bypass
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
working-directory: backend
- name: Install postgres client
run: sudo apt-get install libpq-dev
- name: Link libffi7 to libffi6 since the version 6 is not available anymore in Ubuntu 20.04
run: sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6
- name: Cache backend dependencies
uses: actions/cache@v3
with:
path: backend/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install backend dependencies
run: |
gem install bundler
bundle config path vendor/bundle
bundler install --jobs 4 --retry 3
working-directory: backend
- name: Cache frontend dependencies
uses: actions/cache@v3
env:
cache-name: cache-node-modules
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: Install frontend dependencies
run: npm install
working-directory: frontend
- name: Create and seed database
run: bin/rails db:create:all db:schema:load db:seed
working-directory: backend
- name: Install Cypress
run: npm install cypress@12
working-directory: .
- name: Install foreman to run local app
run: gem install foreman
working-directory: .
- name: Run applications
run: ./bin/local_dev.sh &
working-directory: .
env:
INSEE_HOST: https://api.insee.fr
INSEE_CONSUMER_KEY: ${{ secrets.INSEE_CONSUMER_KEY }}
INSEE_CONSUMER_SECRET: ${{ secrets.INSEE_CONSUMER_SECRET }}
- name: Wait for backend application to run
run: npx wait-on tcp:3001 -t 30000
- name: Wait for frontend application to run
run: npx wait-on tcp:3000 -t 30000
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: chrome
install: false
working-directory: .
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-videos
path: cypress/videos