Skip to content

Produciton equivalent checks in prepareRepeatedDocs #14117

Produciton equivalent checks in prepareRepeatedDocs

Produciton equivalent checks in prepareRepeatedDocs #14117

Workflow file for this run

name: Build and test
on: [push, pull_request]
env:
COUCH_URL: http://admin:pass@localhost:5984/medic-test
BUILDS_SERVER: ${{ secrets.AUTH_MARKET_URL && '_couch/builds_testing' || '_couch/builds_external' }}
STAGING_SERVER: ${{ secrets.AUTH_MARKET_URL && '_couch/builds_4' || '_couch/builds_external' }}
MARKET_URL_READ: 'https://staging.dev.medicmobile.org'
MARKET_URL: ${{ secrets.AUTH_MARKET_URL || 'https://staging.dev.medicmobile.org' }}
INTERNAL_CONTRIBUTOR: ${{ secrets.AUTH_MARKET_URL && 'true' }}
DOCKERHUB_USERNAME: 'dockermedic'
ECR_REPO: '720541322708.dkr.ecr.eu-west-2.amazonaws.com/medic'
ECR_PUBLIC_REPO: 'public.ecr.aws/s5s3h4s7'
COUCHDB_LOG_LEVEL: 'debug'
jobs:
build:
name: Compile the app
runs-on: ubuntu-22.04
steps:
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ env.INTERNAL_CONTRIBUTOR }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
if: ${{ env.INTERNAL_CONTRIBUTOR }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
if: ${{ env.INTERNAL_CONTRIBUTOR }}
- name: Get branch name
uses: nelonoel/branch-name@1ea5c86cb559a8c4e623da7f188496208232e49f
- name: Set ENV
run: |
echo "BUILD_NUMBER=$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Couch Start
run: ./scripts/ci/couch-start
- name: Create logs directory
run: mkdir tests/logs
- run: npm ci --legacy-peer-deps
- name: Grunt Install
run: npm install -g grunt-cli
- name: Grunt CI-Compile
run: |
node --stack_size=10000 `which grunt` ci-compile-github
- name: Publish for testing
run: |
node --stack_size=10000 `which grunt` publish-for-testing
- name: Upload docker images as artifacts
uses: actions/upload-artifact@v3
with:
name: cht-images
path: images/
if: ${{ !env.INTERNAL_CONTRIBUTOR }}
config-tests:
needs: build
name: ${{ matrix.grunt-cmd }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
grunt-cmd: [ 'exec:test-config-standard', 'exec:test-config-default']
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Grunt Install
run: npm install -g grunt-cli
- run: npm ci --legacy-peer-deps
- name: Run Tests
run: node --stack_size=10000 `which grunt` ${{ matrix.grunt-cmd }}
tests:
needs: build
name: ${{ matrix.grunt-cmd }}
runs-on: ubuntu-22.04
env:
NODE: 16.x
strategy:
fail-fast: false
matrix:
grunt-cmd: ['ci-webdriver-default', 'ci-webdriver-standard', 'ci-e2e-integration', 'ci-e2e', 'ci-e2e-mobile']
steps:
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ env.INTERNAL_CONTRIBUTOR }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
if: ${{ env.INTERNAL_CONTRIBUTOR }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
if: ${{ env.INTERNAL_CONTRIBUTOR }}
- name: Get branch name
uses: nelonoel/branch-name@1ea5c86cb559a8c4e623da7f188496208232e49f
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- uses: actions/checkout@v2
- name: Download docker images artifacts
uses: actions/download-artifact@v3
with:
name: cht-images
path: images/
if: ${{ !env.INTERNAL_CONTRIBUTOR }}
- name: Load docker images
run: ls -1 *.tar | xargs --no-run-if-empty -L 1 docker load -i
working-directory: images/
if: ${{ !env.INTERNAL_CONTRIBUTOR }}
- name: Set ENV
run: |
echo "BUILD_NUMBER=$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
echo "HORTI_BUILDS_SERVER=$MARKET_URL_READ/$BUILDS_SERVER" >> $GITHUB_ENV
- name: Create logs directory
run: mkdir tests/logs
- name: Install pyxform
run: python -m pip install git+https://github.com/medic/[email protected]#egg=pyxform-medic
- name: Install cht-conf
run: npm install -g cht-conf
- run: npm ci --legacy-peer-deps
- name: Run tests
run: node --stack_size=10000 `which grunt` ${{ matrix.grunt-cmd }}
- name: Archive Results
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.grunt-cmd }}
path: |
allure-results
allure-report
tests/logs
tests/results/
if: ${{ failure() }}
publish:
needs: [tests,config-tests]
name: Publish branch build
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Delete image artifacts
if: ${{ !env.INTERNAL_CONTRIBUTOR }}
uses: geekyeggo/delete-artifact@v1
with:
name: cht-images
- name: Configure AWS credentials
if: ${{ env.INTERNAL_CONTRIBUTOR }}
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Login to Amazon ECR
if: ${{ env.INTERNAL_CONTRIBUTOR }}
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Configure AWS credentials Public
if: ${{ env.INTERNAL_CONTRIBUTOR }}
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Public Amazon ECR
if: ${{ env.INTERNAL_CONTRIBUTOR }}
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- uses: actions/checkout@v2
- name: Get branch name
uses: nelonoel/branch-name@1ea5c86cb559a8c4e623da7f188496208232e49f
- name: Set ENV
run: |
echo "BUILD_NUMBER=$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
- name: Publish
run: |
cd scripts/ci
npm ci --legacy-peer-deps
node ./publish.js
node ./tag-docker-images.js
upgrade:
needs: [publish]
name: Upgrade from latest release
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Configure AWS credentials Public
if: ${{ env.INTERNAL_CONTRIBUTOR }}
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Public Amazon ECR
if: ${{ env.INTERNAL_CONTRIBUTOR }}
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- uses: actions/checkout@v2
- name: Get branch name
uses: nelonoel/branch-name@1ea5c86cb559a8c4e623da7f188496208232e49f
- name: Set ENV
run: |
echo "BUILD_NUMBER=$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
echo "BUILDS_SERVER=$STAGING_SERVER" >> $GITHUB_ENV
- run: npm ci --legacy-peer-deps
- name: Create logs directory
run: mkdir tests/logs
- name: Upgrade
run: npm run upgrade-wdio
- name: Archive Results
uses: actions/upload-artifact@v2
with:
name: Upgrade
path: |
allure-results
allure-report
tests/logs
tests/results/
if: ${{ failure() }}