huridocs/uwazi

View on GitHub
.github/workflows/ci_e2e_puppeteer.yml

Summary

Maintainability
Test Coverage
name: e2e puppeteer

on:
  push:
    branches:
      - development
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  e2e-puppeteer:
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        suite-dir: ['regression_suites', 'suite1', 'suite2', 'mobile']
    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6-amd64
        ports:
          - 9200/tcp
        options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
    steps:
      - name: Start MongoDB
        uses: supercharge/mongodb-github-action@1.8.0
        with:
          mongodb-version: 5.0.27
          mongodb-replica-set: test-rs
      - name: Checkout reposistory
        uses: actions/checkout@v4
      - name: Checkout submodules
        run: git submodule update --init --recursive
      - name: Setup Nodejs
        uses: actions/setup-node@v4
        with:
          node-version-file: '.nvmrc'
      - name: Cache node modules
        uses: actions/cache@v2
        with:
          path: ./node_modules
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
      - name: install dependencies
        run: yarn install
      - run: sudo apt update
      - run: sudo apt-get install poppler-utils
      - name: Cache build
        id: cache-build
        uses: actions/cache@v2
        with:
          path: ./prod
          key: >-
            ${{ runner.os }}-build-${{ hashFiles('app/**/*.*') }}-
            ${{ hashFiles('database/**/*.*') }}-
            ${{ hashFiles('**/yarn.lock') }}-
            ${{ hashFiles('**/webpack.production.config.js') }}-
            ${{ hashFiles('**/.babelrc') }}-
            ${{ hashFiles('webpack/**/config.js') }}-
      - name: build production
        if: steps.cache-build.outputs.cache-hit != 'true'
        run: yarn production-build
      - run: yarn e2e-fixtures
        env:
          DBHOST: localhost:27017
          ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
          DATABASE_NAME: uwazi_e2e
          INDEX_NAME: uwazi_e2e
          TRANSPILED: true
      - name: start Uwazi
        env:
          DBHOST: localhost:27017
          ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
          DATABASE_NAME: uwazi_e2e
          INDEX_NAME: uwazi_e2e
        run: yarn run-production > output.txt &
      - name: wait for uwazi to be ready
        run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:3000/
        timeout-minutes: 2
      - run: xvfb-run -a yarn e2e-puppeteer-all --roots '<rootDir>/${{ matrix.suite-dir }}'
        timeout-minutes: 25
        env:
          DBHOST: localhost:27017
          ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
          TRANSPILED: true
      - name: Print server output
        run: cat output.txt
        if: failure()