huridocs/uwazi

View on GitHub
.github/workflows/ci_check_translations.yml

Summary

Maintainability
Test Coverage
name: check translations

on:
  push:
    branches:
      - development
  pull_request:

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

jobs:
  check_translations:
    runs-on: ubuntu-20.04
    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
      - uses: actions/checkout@v4
      - name: Use Node.js
        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: yarn blank-state
        id: blank-state-attempt1
        continue-on-error: true  
        env:
          DBHOST: localhost:27017
          ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
      - run: yarn blank-state --force
        id: blank-state-attempt2
        if: steps.blank-state-attempt1.outcome == 'failure'
        env:
          DBHOST: localhost:27017
          ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
      - run: yarn production-build
        env:
          DBHOST: localhost:${{ job.services.mongodb.ports[27017] }}
          ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
      - run: cd prod; yarn update-translations-db
        env:
          NODE_ENV: production
          DBHOST: localhost:${{ job.services.mongodb.ports[27017] }}
      - run: yarn check-translations
        env:
          DBHOST: localhost:${{ job.services.mongodb.ports[27017] }}