From 8a4bc251e2786edf2b869c864fc5f102e1d7708e Mon Sep 17 00:00:00 2001 From: tatilepizs Date: Mon, 2 Dec 2024 13:39:19 -0600 Subject: [PATCH] try1 --- .github/workflows/build.yml | 779 +++++++++--------- .github/workflows/codeql.yml | 176 ++-- .github/workflows/conventional-commits.yml | 52 +- tests/e2e/default/wdio.conf.js | 2 +- .../default/login/login.wdio.page.js | 3 +- 5 files changed, 507 insertions(+), 505 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b983ac1a35..0e360a81042 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build and test -on: [push, pull_request] +on: [push] env: COUCH_URL: http://admin:pass@localhost:5984/medic-test @@ -16,7 +16,7 @@ env: TAG: ${{ (github.ref_type == 'tag' && github.ref_name) || '' }} BRANCH: ${{ github.head_ref || github.ref_name }} BUILD_NUMBER: ${{ github.run_id }} - NODE_VERSION: '22.11' + NODE_VERSION: '20.11' jobs: @@ -26,89 +26,74 @@ jobs: 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: 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 }} + - 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: 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 }} runs-on: ubuntu-22.04 timeout-minutes: 60 - + strategy: fail-fast: false matrix: cmd: ['test-config-default'] - 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 install -y xsltproc - - run: npm ci - - name: Run Tests - run: npm run ${{ matrix.cmd }} - - test-cht-form: - needs: build - runs-on: ubuntu-22.04 - steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ env.NODE_VERSION }} @@ -117,22 +102,156 @@ jobs: node-version: ${{ env.NODE_VERSION }} - run: 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 + run: npm run ${{ matrix.cmd }} + + # test-cht-form: + # needs: build + # runs-on: ubuntu-22.04 + + # 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 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-22.04 + # 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: 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: python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic + # - 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-22.04 + # 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-k3d: + tests: needs: build - name: ${{ matrix.cmd }} + name: ${{ matrix.cmd }}-${{ matrix.suite || '' }}${{ matrix.chrome-version == '90' && '-minimum-browser' || '' }} runs-on: ubuntu-22.04 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-k3d', 'ci-integration-sentinel-k3d'] - + cmd: ['ci-integration-all'] + chrome-version: ['90'] + suite: [all] + # include: + # - cmd: ci-webdriver-default + # suite: core + # chrome-version: 90 + # exclude: + # - 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 @@ -161,7 +280,6 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} - uses: actions/checkout@v4 - - name: Download docker images artifacts uses: actions/download-artifact@v4 with: @@ -173,325 +291,208 @@ jobs: working-directory: images/ if: ${{ !env.INTERNAL_CONTRIBUTOR }} - - run: mkdir tests/logs - - run: python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic - - 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-22.04 - 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 }} + - name: Create logs directory + run: mkdir tests/logs + - name: Install pyxform + run: python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic + - name: Install cht-conf + run: npm install -g cht-conf - 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-22.04 - 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: Create logs directory - run: mkdir tests/logs - - name: Install pyxform - run: python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic - - name: Install cht-conf - run: npm install -g cht-conf - - run: npm ci - - name: Fetch allure history - uses: actions/checkout@v4 - with: - repository: 'medic/build-history-data' - path: 'build-history-data' - persist-credentials: false - - name: Copy allure history - run: | - mkdir -p allure-results/history - cp -r build-history-data/cht-core/allure/${{ env.JOB_NAME }}/allure-report/history allure-results | true - - name: Install Chrome 90 - if: ${{matrix.chrome-version=='90'}} - run: | - wget -O "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 - sudo dpkg -i "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: Fetch allure history - if: always() - uses: actions/checkout@v4 - with: - repository: 'medic/build-history-data' - path: 'build-history-data-new' - persist-credentials: false - - name: Copy new allure history - if: always() - run: | - mkdir -p build-history-data-new/cht-core/allure/${{ env.JOB_NAME }}/history - cp -r allure-report/history build-history-data-new/cht-core/allure/${{ env.JOB_NAME }}/allure-report | true - - name: Upload allure report history - if: always() && github.ref == 'refs/heads/master' # whether pass or fail, but only on master - continue-on-error: true # don't fail the build if git push fails - uses: actions-js/push@master - with: - github_token: ${{ secrets.BUILD_HISTORY_DATA_PUSH_TOKEN }} - directory: 'build-history-data-new' - repository: 'medic/build-history-data' - force: true - - name: Fetch report repo - if: always() - uses: actions/checkout@v4 - with: - repository: 'medic/build-history' - path: 'build-history' - persist-credentials: false - - name: Copy new report - if: always() - run: | - mkdir -p build-history/cht-core/allure/${{ env.JOB_NAME }} - cp -r allure-report build-history/cht-core/allure/${{ env.JOB_NAME }} | true - - name: Upload allure report - if: always() && github.ref == 'refs/heads/master' # whether pass or fail, but only on master - continue-on-error: true # don't fail the build if git push fails - uses: actions-js/push@master - with: - github_token: ${{ secrets.BUILD_HISTORY_DATA_PUSH_TOKEN }} - directory: 'build-history' - repository: 'medic/build-history' - force: true - - 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, translations] - name: Publish branch build - runs-on: ubuntu-22.04 - timeout-minutes: 60 - - if: ${{ github.event_name != 'pull_request' }} - - steps: - - name: Install regctl - if: ${{ env.INTERNAL_CONTRIBUTOR }} - uses: regclient/actions/regctl-installer@main - - - 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-22.04 - 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 + - name: Fetch allure history + uses: actions/checkout@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' + repository: 'medic/build-history-data' + path: 'build-history-data' + persist-credentials: false + - name: Copy allure history + run: | + mkdir -p allure-results/history + cp -r build-history-data/cht-core/allure/${{ env.JOB_NAME }}/allure-report/history allure-results | true + - name: Install Chrome 90 + if: ${{matrix.chrome-version=='90'}} + run: | + wget -O "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 + sudo dpkg -i "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: Fetch allure history + if: always() + uses: actions/checkout@v4 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-22.04 - 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 + repository: 'medic/build-history-data' + path: 'build-history-data-new' + persist-credentials: false + - name: Copy new allure history + if: always() + run: | + mkdir -p build-history-data-new/cht-core/allure/${{ env.JOB_NAME }}/history + cp -r allure-report/history build-history-data-new/cht-core/allure/${{ env.JOB_NAME }}/allure-report | true + - name: Upload allure report history + if: always() && github.ref == 'refs/heads/master' # whether pass or fail, but only on master + continue-on-error: true # don't fail the build if git push fails + uses: actions-js/push@master 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 + github_token: ${{ secrets.BUILD_HISTORY_DATA_PUSH_TOKEN }} + directory: 'build-history-data-new' + repository: 'medic/build-history-data' + force: true + - name: Fetch report repo + if: always() + uses: actions/checkout@v4 with: - registry-type: public - mask-password: 'true' - - uses: actions/checkout@v4 - - name: Set ENV + repository: 'medic/build-history' + path: 'build-history' + persist-credentials: false + - name: Copy new report + if: always() 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 + mkdir -p build-history/cht-core/allure/${{ env.JOB_NAME }} + cp -r allure-report build-history/cht-core/allure/${{ env.JOB_NAME }} | true + - name: Upload allure report + if: always() && github.ref == 'refs/heads/master' # whether pass or fail, but only on master + continue-on-error: true # don't fail the build if git push fails + uses: actions-js/push@master + with: + github_token: ${{ secrets.BUILD_HISTORY_DATA_PUSH_TOKEN }} + directory: 'build-history' + repository: 'medic/build-history' + force: true - name: Archive Results uses: actions/upload-artifact@v4 with: - name: upgrade-${{ matrix.version }} + name: ${{ env.JOB_NAME }} path: | allure-results allure-report tests/logs tests/results/ if: ${{ failure() }} + + # publish: + # needs: [tests, config-tests, test-cht-form, translations] + # name: Publish branch build + # runs-on: ubuntu-22.04 + # timeout-minutes: 60 + + # if: ${{ github.event_name != 'pull_request' }} + + # steps: + # - name: Install regctl + # if: ${{ env.INTERNAL_CONTRIBUTOR }} + # uses: regclient/actions/regctl-installer@main + + # - 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-22.04 + # 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-22.04 + # 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 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() }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ce00b2233ab..830038de9a3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,97 +1,97 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" +# # For most projects, this workflow file will not need changing; you simply need +# # to commit it to your repository. +# # +# # You may wish to alter this file to override the set of languages analyzed, +# # or to provide custom queries or build logic. +# # +# # ******** NOTE ******** +# # We have attempted to detect the languages in your repository. Please check +# # the `language` matrix defined below to confirm you have the correct set of +# # supported CodeQL languages. +# # +# name: "CodeQL" -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: '25 10 * * 0' +# on: +# push: +# branches: [ "master" ] +# pull_request: +# branches: [ "master" ] +# schedule: +# - cron: '25 10 * * 0' -jobs: - analyze: - name: Analyze (${{ matrix.language }}) - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners (GitHub.com only) - # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - # required for all workflows - security-events: write +# jobs: +# analyze: +# name: Analyze (${{ matrix.language }}) +# # Runner size impacts CodeQL analysis time. To learn more, please see: +# # - https://gh.io/recommended-hardware-resources-for-running-codeql +# # - https://gh.io/supported-runners-and-hardware-resources +# # - https://gh.io/using-larger-runners (GitHub.com only) +# # Consider using larger runners or machines with greater resources for possible analysis time improvements. +# runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} +# permissions: +# # required for all workflows +# security-events: write - # required to fetch internal or private CodeQL packs - packages: read +# # required to fetch internal or private CodeQL packs +# packages: read - # only required for workflows in private repositories - actions: read - contents: read +# # only required for workflows in private repositories +# actions: read +# contents: read - strategy: - fail-fast: false - matrix: - include: - - language: javascript-typescript - build-mode: none - - language: python - build-mode: none - # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' - # Use `c-cpp` to analyze code written in C, C++ or both - # Use 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, - # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. - # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how - # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages - steps: - - name: Checkout repository - uses: actions/checkout@v4 +# strategy: +# fail-fast: false +# matrix: +# include: +# - language: javascript-typescript +# build-mode: none +# - language: python +# build-mode: none +# # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' +# # Use `c-cpp` to analyze code written in C, C++ or both +# # Use 'java-kotlin' to analyze code written in Java, Kotlin or both +# # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both +# # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, +# # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. +# # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how +# # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - config: | - paths-ignore: - - ddocs - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. +# # Initializes the CodeQL tools for scanning. +# - name: Initialize CodeQL +# uses: github/codeql-action/init@v3 +# with: +# languages: ${{ matrix.language }} +# build-mode: ${{ matrix.build-mode }} +# config: | +# paths-ignore: +# - ddocs +# # If you wish to specify custom queries, you can do so here or in a config file. +# # By default, queries listed here will override any specified in a config file. +# # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality +# # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs +# # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 +# # If the analyze step fails for one of the languages you are analyzing with +# # "We were unable to automatically build your code", modify the matrix above +# # to set the build mode to "manual" for that language. Then modify this step +# # to build your code. +# # ℹī¸ Command-line programs to run using the OS shell. +# # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun +# - if: matrix.build-mode == 'manual' +# shell: bash +# run: | +# echo 'If you are using a "manual" build mode for one or more of the' \ +# 'languages you are analyzing, replace this with the commands to build' \ +# 'your code, for example:' +# echo ' make bootstrap' +# echo ' make release' +# exit 1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" +# - name: Perform CodeQL Analysis +# uses: github/codeql-action/analyze@v3 +# with: +# category: "/language:${{matrix.language}}" diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index 9121c9f79f6..6b0a2f77326 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -1,26 +1,26 @@ -name: Conventional commits -on: - pull_request: - types: - - opened - - edited - - synchronize - - reopened - -jobs: - lint_pr_title: - name: Lint PR title - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20.11 - - name: Install dependencies - run: npm ci - - name: Run - env: - TITLE: ${{ github.event.pull_request.title }} - run: npx --no-install commitlint <<< "$TITLE" +#name: Conventional commits +#on: +# pull_request: +# types: +# - opened +# - edited +# - synchronize +# - reopened +# +#jobs: +# lint_pr_title: +# name: Lint PR title +# runs-on: ubuntu-22.04 +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - name: Setup Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: 20.11 +# - name: Install dependencies +# run: npm ci +# - name: Run +# env: +# TITLE: ${{ github.event.pull_request.title }} +# run: npx --no-install commitlint <<< "$TITLE" diff --git a/tests/e2e/default/wdio.conf.js b/tests/e2e/default/wdio.conf.js index cecd574096b..2412a7bd151 100644 --- a/tests/e2e/default/wdio.conf.js +++ b/tests/e2e/default/wdio.conf.js @@ -4,7 +4,7 @@ const { suites } = require('./suites'); // Override specific properties from wdio base config const defaultConfig = Object.assign(wdioBaseConfig.config, { suites, - specs: ['**/*.wdio-spec.js'], + specs: ['**/repeat.wdio-spec.js'], }); exports.config = defaultConfig; diff --git a/tests/page-objects/default/login/login.wdio.page.js b/tests/page-objects/default/login/login.wdio.page.js index 28569e2e5ab..a20c9ed098b 100644 --- a/tests/page-objects/default/login/login.wdio.page.js +++ b/tests/page-objects/default/login/login.wdio.page.js @@ -128,7 +128,8 @@ const changeLocale = async locale => { if (!locale) { return; } - return (await localeByName(locale)).click(); + await (await localeByName(locale)).waitForClickable(); + await (await localeByName(locale)).click(); }; const changeLanguage = async (languageCode, userTranslation) => {