use "Number" #220
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/medic' | |
| COUCHDB_LOG_LEVEL: 'debug' | |
| TAG: ${{ (github.ref_type == 'tag' && github.ref_name) || '' }} | |
| BRANCH: ${{ github.head_ref || github.ref_name }} | |
| BUILD_NUMBER: ${{ github.run_id }} | |
| NODE_VERSION: '22.15' | |
| AFRICAS_TALKING_SANDBOX_API_KEY: ${{ secrets.AFRICAS_TALKING_SANDBOX_API_KEY }} | |
| jobs: | |
| build: | |
| name: Compile the app | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Install bats | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y bats | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| 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 | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| mask-password: 'true' | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Set system ulimit | |
| uses: ./.github/actions/bump-system-ulimit | |
| - name: Create logs directory | |
| run: mkdir tests/logs | |
| - run: npm ci | |
| - name: Compile | |
| run: npm run ci-compile | |
| - name: Setup QEMU | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Buildx | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Publish for testing | |
| run: npm run publish-for-testing | |
| - name: Upload docker images as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cht-images | |
| path: images/ | |
| if: ${{ !env.INTERNAL_CONTRIBUTOR }} | |
| - name: Search-Replace PR Body | |
| if: ${{ env.INTERNAL_CONTRIBUTOR && github.event_name == 'pull_request' }} | |
| uses: ./.github/actions/update-staging-url-placeholders | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| config-tests: | |
| needs: build | |
| name: ${{ matrix.cmd }} | |
| # these tests fail on newer os. https://github.com/medic/cht-conf-test-harness/issues/279 | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cmd: ['test-config-covid-19', 'test-config-default', 'test-config-demo'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xsltproc | |
| - run: npm ci | |
| - name: Run Tests | |
| run: npm run ${{ matrix.cmd }} | |
| test-cht-form: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xsltproc | |
| - run: npm ci | |
| - name: Build cht-form Web Component | |
| run: npm run build-cht-form | |
| - name: Run Tests | |
| run: npm run integration-cht-form | |
| tests-k3d: | |
| needs: build | |
| name: ${{ matrix.cmd }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cmd: ['ci-integration-all-k3d', 'ci-integration-sentinel-k3d'] | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| 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 | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| mask-password: 'true' | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: actions/checkout@v4 | |
| - name: Set system ulimit | |
| uses: ./.github/actions/bump-system-ulimit | |
| - name: Download docker images artifacts | |
| uses: actions/download-artifact@v4 | |
| 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 }} | |
| - run: mkdir tests/logs | |
| - run: npm install -g cht-conf | |
| - run: npm ci | |
| - uses: nolar/setup-k3d-k3s@v1 | |
| - uses: azure/setup-helm@v4.1.0 | |
| - uses: azure/setup-kubectl@v4 | |
| - name: Run tests | |
| run: npm run ${{ matrix.cmd }} | |
| - name: Archive Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.cmd }} | |
| path: | | |
| allure-results | |
| allure-report | |
| tests/logs | |
| tests/results/ | |
| if: ${{ failure() }} | |
| translations: | |
| needs: build | |
| name: Lint translations | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - run: npm ci | |
| - run: npm run lint-translations | |
| tests: | |
| needs: build | |
| name: ${{ matrix.cmd }}-${{ matrix.suite || '' }}${{ matrix.chrome-version == '90' && '-minimum-browser' || '' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| CHROME_VERSION: ${{ matrix.chrome-version }} | |
| JOB_NAME: ${{ matrix.cmd }}-${{ matrix.suite || '' }}${{ matrix.chrome-version == '90' && '-minimum-browser' || '' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cmd: ['ci-integration-all', 'ci-integration-sentinel', 'ci-webdriver-default-mobile'] | |
| chrome-version: ['90', 'latest'] | |
| suite: [all] | |
| include: | |
| - cmd: ci-webdriver-default | |
| suite: core | |
| chrome-version: 90 | |
| - cmd: ci-webdriver-default | |
| suite: core | |
| chrome-version: latest | |
| - cmd: ci-webdriver-default | |
| suite: data | |
| - cmd: ci-webdriver-default | |
| suite: enketo | |
| chrome-version: 90 | |
| - cmd: ci-webdriver-default | |
| suite: enketo | |
| chrome-version: latest | |
| - cmd: ci-webdriver-default | |
| suite: lowLevel | |
| - cmd: ci-webdriver-default | |
| suite: workflows | |
| exclude: # temporary until all suites run on Chrome 90 | |
| - cmd: ci-integration-all | |
| chrome-version: 90 | |
| - cmd: ci-integration-sentinel | |
| chrome-version: 90 | |
| - cmd: ci-webdriver-default-mobile | |
| chrome-version: 90 | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| 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 | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| mask-password: 'true' | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - uses: actions/checkout@v4 | |
| - name: Download docker images artifacts | |
| uses: actions/download-artifact@v4 | |
| 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 system ulimit | |
| uses: ./.github/actions/bump-system-ulimit | |
| - name: Create logs directory | |
| run: mkdir tests/logs | |
| - name: Install cht-conf | |
| run: npm install -g cht-conf | |
| - run: npm ci | |
| - name: Cache Chrome 90 Installer | |
| if: ${{ matrix.chrome-version == '90' }} | |
| id: cache-chrome | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/chrome90 | |
| key: chrome90-${{ runner.os }}-90.0.4430.72 | |
| restore-keys: | | |
| chrome90-${{ runner.os }}- | |
| chrome90- | |
| - name: Download Chrome 90 | |
| if: ${{ matrix.chrome-version == '90' && steps.cache-chrome.outputs.cache-hit != 'true' }} | |
| run: | | |
| mkdir -p /tmp/chrome90 | |
| wget -O "/tmp/chrome90/google-chrome-stable_current_amd64.deb" https://www.slimjet.com/chrome/download-chrome.php?file=files/90.0.4430.72/google-chrome-stable_current_amd64.deb | |
| - name: Install Chrome 90 | |
| if: ${{ matrix.chrome-version == '90' }} | |
| run: | | |
| sudo dpkg -i "/tmp/chrome90/google-chrome-stable_current_amd64.deb" | |
| npm install chromedriver@^90.0.1 | |
| - name: Run tests ${{ matrix.cmd }}-${{ matrix.suite }} on Chrome ${{ matrix.chrome-version }} | |
| run: npm run ${{ matrix.cmd }} -- --suite=${{ matrix.suite }} | |
| - name: Archive Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.JOB_NAME }} | |
| path: | | |
| allure-results | |
| allure-report | |
| tests/logs | |
| tests/results/ | |
| if: ${{ failure() }} | |
| publish: | |
| needs: [tests, config-tests, test-cht-form] | |
| name: Publish branch build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| steps: | |
| - name: Install regctl | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: regclient/actions/regctl-installer@df29323daedc1f78ee74b261bd8d849327cb4ff0 | |
| - name: Configure AWS credentials | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| 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@v2 | |
| with: | |
| mask-password: 'true' | |
| - name: Configure AWS credentials Public | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| 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@v2 | |
| with: | |
| registry-type: public | |
| mask-password: 'true' | |
| - uses: actions/checkout@v4 | |
| - name: Publish | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| run: | | |
| npm ci | |
| cd scripts/ci | |
| node ./publish.js | |
| node ./tag-docker-images.js | |
| publish-generated-docs: | |
| needs: [publish] | |
| name: Publish generated docs | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - run: npm ci | |
| - name: Generate TypeDoc | |
| run: npm run --prefix shared-libs/cht-datasource gen-docs | |
| - name: Main Branch Only - Deploy to GH pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| if: github.ref == 'refs/heads/master' | |
| with: | |
| personal_token: ${{ secrets.DEPLOY_TO_GITHUB_PAGES }} | |
| external_repository: medic/cht-datasource | |
| publish_dir: ./shared-libs/cht-datasource/docs | |
| user_name: medic-ci | |
| user_email: medic-ci@github | |
| publish_branch: main | |
| upgrade: | |
| needs: [publish] | |
| name: Upgrade from ${{ matrix.version }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: [ '4.2.4', 'latest' ] | |
| steps: | |
| - name: Configure AWS credentials Public | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| 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@v2 | |
| with: | |
| registry-type: public | |
| mask-password: 'true' | |
| - uses: actions/checkout@v4 | |
| - name: Set system ulimit | |
| uses: ./.github/actions/bump-system-ulimit | |
| - name: Set ENV | |
| run: | | |
| echo "BUILDS_SERVER=$STAGING_SERVER" >> $GITHUB_ENV | |
| echo "BASE_VERSION=${{ matrix.version }}" >> $GITHUB_ENV | |
| - run: npm ci | |
| - name: Create logs directory | |
| run: mkdir tests/logs | |
| - name: Upgrade | |
| if: ${{ env.INTERNAL_CONTRIBUTOR }} | |
| run: npm run upgrade-wdio | |
| - name: Archive Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: upgrade-${{ matrix.version }} | |
| path: | | |
| allure-results | |
| allure-report | |
| tests/logs | |
| tests/results/ | |
| if: ${{ failure() }} |