diff --git a/.github/workflows/ci.yml.suspend b/.github/workflows/ci.yml.suspend deleted file mode 100644 index b9cecf7ec8..0000000000 --- a/.github/workflows/ci.yml.suspend +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: ci -on: - push: - branches: - - main - - 'release*' - pull_request: - -env: - NODE_VERSION: 20.13.1 - TERM: xterm - -jobs: - test: - runs-on: ubuntu-22.04 - steps: - - name: ci/checkout-repo - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: ci/test - uses: ./.github/actions/test diff --git a/.github/workflows/e2e-detox-pr.yml b/.github/workflows/e2e-detox-pr.yml index 2c32e9fdea..698a67c18c 100644 --- a/.github/workflows/e2e-detox-pr.yml +++ b/.github/workflows/e2e-detox-pr.yml @@ -90,14 +90,13 @@ jobs: script: | const iosLabel = 'E2E iOS tests for PR'; const androidLabel = 'E2E Android tests for PR'; - const labels = context.payload.pull_request.labels.map(label => label.name); - - if (labels.includes(iosLabel)) { - github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - name: iosLabel, - }); - } - + context.payload.pull_request.labels.forEach(label => { + if (label.name.includes(iosLabel)) { + github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name, + }); + } + }); diff --git a/.github/workflows/e2e-detox-template-experiment.yml b/.github/workflows/e2e-detox-template-experiment.yml deleted file mode 100644 index c630ab298f..0000000000 --- a/.github/workflows/e2e-detox-template-experiment.yml +++ /dev/null @@ -1,311 +0,0 @@ -name: Detox E2E Tests Template - -on: - workflow_call: - inputs: - MM_TEST_SERVER_URL: - description: "The test server URL" - required: false - type: string - MM_TEST_USER_NAME: - description: "The admin username of the test instance" - required: false - type: string - MM_TEST_PASSWORD: - description: "The admin password of the test instance" - required: false - type: string - MOBILE_VERSION: - description: "The mobile version to test" - required: false - default: ${{ github.head_ref || github.ref }} - type: string - run-ios-tests: - description: "Run iOS tests" - required: true - type: boolean - run-type: - type: string - required: false - default: "PR" - testcase_failure_fatal: - description: "Should failures be considered fatal" - required: false - type: boolean - default: false - record_tests_in_zephyr: - description: "Record test results in Zephyr, typically for nightly and release runs" - required: false - type: string - default: 'false' - ios_device_name: - description: "iPhone simulator name" - required: false - type: string - default: "iPhone 14" - ios_device_os_name: - description: "iPhone simulator OS version" - required: false - type: string - default: "iOS 17.0" - low_bandwidth_mode: - description: "Enable low bandwidth mode" - required: false - type: boolean - default: false - outputs: - STATUS: - value: ${{ jobs.generate-report.outputs.STATUS }} - TARGET_URL: - value: ${{ jobs.generate-report.outputs.TARGET_URL }} - FAILURES: - value: ${{ jobs.generate-report.outputs.FAILURES }} - -env: - AWS_REGION: "us-east-1" - ADMIN_EMAIL: ${{ secrets.MM_MOBILE_E2E_ADMIN_EMAIL }} - ADMIN_USERNAME: ${{ secrets.MM_MOBILE_E2E_ADMIN_USERNAME }} - ADMIN_PASSWORD: ${{ secrets.MM_MOBILE_E2E_ADMIN_PASSWORD }} - # BRANCH: ${{ github.head_ref || github.ref_name }} - # COMMIT_HASH: ${{ github.sha }} - DEVICE_NAME: ${{ inputs.ios_device_name }} - DEVICE_OS_VERSION: ${{ inputs.ios_device_os_name }} - DETOX_AWS_S3_BUCKET: "mattermost-detox-report" - HEADLESS: "true" - TYPE: ${{ inputs.run-type }} - PULL_REQUEST: "https://github.com/mattermost/mattermost-mobile/pull/${{ github.event.number }}" - SITE_1_URL: ${{ inputs.MM_TEST_SERVER_URL || 'https://mobile-e2e-site-1.test.mattermost.cloud' }} - SITE_2_URL: "https://mobile-e2e-site-2.test.mattermost.cloud" - SITE_3_URL: "https://mobile-e2e-site-3.test.mattermost.cloud" - ZEPHYR_ENABLE: ${{ inputs.record_tests_in_zephyr }} - JIRA_PROJECT_KEY: "MM" - ZEPHYR_API_KEY: ${{ secrets.MM_MOBILE_E2E_ZEPHYR_API_KEY }} - ZEPHYR_FOLDER_ID: "3233873" - TEST_CYCLE_LINK_PREFIX: ${{ secrets.MM_MOBILE_E2E_TEST_CYCLE_LINK_PREFIX }} - WEBHOOK_URL: ${{ secrets.MM_MOBILE_E2E_WEBHOOK_URL }} - FAILURE_MESSAGE: "Something has failed" - -jobs: - generate-specs: - runs-on: ubuntu-22.04 - if: ${{ inputs.run-ios-tests }} - outputs: - specs: ${{ steps.generate-specs.outputs.specs }} - build_id: ${{ steps.resolve-device.outputs.BUILD_ID }} - mobile_sha: ${{ steps.resolve-device.outputs.MOBILE_SHA }} - mobile_ref: ${{ steps.resolve-device.outputs.MOBILE_REF }} - workflow_hash: ${{ steps.resolve-device.outputs.WORKFLOW_HASH }} - steps: - - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ inputs.MOBILE_VERSION }} - - - name: Set Build ID - id: resolve-device - run: | - BUILD_ID="${{ github.run_id }}-${{ env.DEVICE_NAME }}-${{ env.DEVICE_OS_VERSION}}" - WORKFLOW_HASH=$(tr -dc a-z0-9 > ${GITHUB_OUTPUT} - - echo "BUILD_ID=$(echo ${BUILD_ID} | sed 's/ /_/g')" >> ${GITHUB_OUTPUT} - echo "MOBILE_SHA=$(git rev-parse HEAD)" >> ${GITHUB_OUTPUT} - echo "MOBILE_REF=$(git rev-parse --abbrev-ref HEAD)" >> ${GITHUB_OUTPUT} - - - name: Generate Test Specs - id: generate-specs - uses: ./.github/actions/generate-specs - with: - parallelism: 10 - search_path: detox/e2e/test - device_name: ${{ env.DEVICE_NAME }} - device_os_version: ${{ env.DEVICE_OS_VERSION }} - - e2e-ios: - name: ios-detox-e2e-${{ matrix.runId }}-${{ matrix.deviceName }}-${{ matrix.deviceOsVersion }} - if: ${{ inputs.run-ios-tests }} - runs-on: macos-14 - continue-on-error: true - timeout-minutes: 60 - env: - IOS: true - needs: - - generate-specs - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.generate-specs.outputs.specs) }} - steps: - - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ inputs.MOBILE_VERSION }} - - - name: ci/prepare-node-deps - uses: ./.github/actions/prepare-node-deps - - - name: Install Homebrew Dependencies - run: | - brew tap wix/brew - brew install applesimutils - - - name: Download iOS Simulator Build - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - with: - name: ios-build-simulator-${{ github.run_id }} - path: mobile-artifacts - - # - name: Download iOS Simulator Build - # uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - # with: - # name: ios-build-simulator-10565193233 - # github-token: ${{ secrets.MM_MOBILE_GITHUB_TOKEN }} - # path: mobile-artifacts - # run-id: 10565193233 - - - name: Unzip iOS Simulator Build - run: unzip -o mobile-artifacts/*.zip -d mobile-artifacts/ - - - name: Prepare Low Bandwidth Environment - id: prepare-low-bandwidth - uses: ./.github/actions/prepare-low-bandwidth - if: ${{ inputs.low_bandwidth_mode }} - with: - test_server_url: ${{ env.SITE_1_URL }} - device_name: ${{ env.DEVICE_NAME }} - # all these value should be configurable - download_speed: "3300" - upload_speed: "3300" - latency: "500" - - - name: Start React Native Metro Server - run: npm run start & - - - name: Install Detox Dependencies - run: cd detox && npm i - - - name: Start Proxy - if: ${{ inputs.low_bandwidth_mode }} - id: start-proxy - uses: ./.github/actions/start-proxy - with: - test_server_url: ${{ env.SITE_1_URL }} - - - name: Run Detox E2E Tests - continue-on-error: true # Label might have been removed manually - run: | - cd detox - npm run detox:config-gen - npm run e2e:ios-test -- ${{ matrix.specs }} - env: - DETOX_DEVICE_TYPE: ${{ env.DEVICE_NAME }} - DETOX_OS_VERSION: ${{ env.DEVICE_OS_VERSION }} - LOW_BANDWIDTH_MODE: ${{ inputs.low_bandwidth_mode }} - - - name: reset network settings - if: ${{ inputs.low_bandwidth_mode || failure() }} - run: | - networksetup -setwebproxystate Ethernet "off" - networksetup -setsecurewebproxystate Ethernet "off" - - if (sudo pfctl -q -sa | grep 'Status: Enabled') then sudo pfctl -d; fi - if (command -v pm2 &> /dev/null) then pm2 stop mitmdump; fi - - sleep 5; - - - name: Upload mitmdump Flow Output - if: ${{ inputs.low_bandwidth_mode }} - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: ios-mitmdump-flow-output-${{ needs.generate-specs.outputs.workflow_hash }}-${{ matrix.runId }} - path: | - /Users/runner/work/mattermost-mobile/mattermost-mobile/flow-output.csv - /Users/runner/work/mattermost-mobile/mattermost-mobile/mitmdump.log - - - name: Upload iOS Test Report - if: always() - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: ios-results-${{ needs.generate-specs.outputs.workflow_hash }}-${{ matrix.runId }} - path: detox/artifacts/ - - generate-report: - runs-on: ubuntu-22.04 - if: ${{ inputs.run-ios-tests}} - needs: - - generate-specs - - e2e-ios - outputs: - TARGET_URL: ${{ steps.set-url.outputs.TARGET_URL }} - STATUS: ${{ steps.determine-status.outputs.STATUS }} - FAILURES: ${{ steps.summary.outputs.FAILURES }} - steps: - - name: Checkout Repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ inputs.MOBILE_VERSION }} - - - name: ci/prepare-node-deps - uses: ./.github/actions/prepare-node-deps - - - name: Download All Artifacts - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - with: - path: detox/artifacts/ - pattern: ios-results-${{ needs.generate-specs.outputs.workflow_hash }}-* - - - name: Generate Report Path - id: s3 - run: | - path="${{ needs.generate-specs.outputs.build_id }}-${{ needs.generate-specs.outputs.mobile_sha }}-${{ needs.generate-specs.outputs.mobile_ref }}" - echo "path=$(echo "${path}" | sed 's/\./-/g')" >> ${GITHUB_OUTPUT} - - - name: Save report Detox Dependencies - id: report-link - run: | - cd detox - npm ci - npm run e2e:save-report - env: - DETOX_AWS_ACCESS_KEY_ID: ${{ secrets.MM_MOBILE_DETOX_AWS_ACCESS_KEY_ID }} - DETOX_AWS_SECRET_ACCESS_KEY: ${{ secrets.MM_MOBILE_DETOX_AWS_SECRET_ACCESS_KEY }} - IOS: ${{ inputs.run-ios-tests }} - BUILD_ID: ${{ needs.generate-specs.outputs.build_id }} - REPORT_PATH: ${{ steps.s3.outputs.path }} - ## These are needed for the MM Webhook report - COMMIT_HASH: ${{ needs.generate-specs.outputs.mobile_sha }} - BRANCH: ${{ needs.generate-specs.outputs.mobile_ref }} - - - name: Calculate failures - id: summary - run: | - echo "FAILURES=$(cat detox/artifacts/summary.json | jq .stats.failures)" >> ${GITHUB_OUTPUT} - echo "PASSES=$(cat detox/artifacts/summary.json | jq .stats.passes)" >> ${GITHUB_OUTPUT} - echo "SKIPPED=$(cat detox/artifacts/summary.json | jq .stats.skipped)" >> ${GITHUB_OUTPUT} - echo "TOTAL=$(cat detox/artifacts/summary.json | jq .stats.tests)" >> ${GITHUB_OUTPUT} - echo "ERRORS=$(cat detox/artifacts/summary.json | jq .stats.errors)" >> ${GITHUB_OUTPUT} - echo "PERCENTAGE=$(cat detox/artifacts/summary.json | jq .stats.passPercent)" >> ${GITHUB_OUTPUT} - - - name: Set Target URL - id: set-url - run: | - echo "TARGET_URL=https://${{ env.DETOX_AWS_S3_BUCKET }}.s3.amazonaws.com/${{ steps.s3.outputs.path }}/jest-stare/ios-report.html" >> ${GITHUB_OUTPUT} - - - name: Determine Status - id: determine-status - run: | - if [[ ${{ steps.summary.outputs.failures }} -gt 0 && "${{ inputs.testcase_failure_fatal }}" == "true" ]]; then - echo "STATUS=failure" >> ${GITHUB_OUTPUT} - else - echo "STATUS=success" >> ${GITHUB_OUTPUT} - fi - - - name: Generate Summary - run: | - echo "| Tests | Passed :white_check_mark: | Failed :x: | Skipped :fast_forward: | Errors :warning: | " >> ${GITHUB_STEP_SUMMARY} - echo "|:---:|:---:|:---:|:---:|:---:|" >> ${GITHUB_STEP_SUMMARY} - echo "| ${{ steps.summary.outputs.TOTAL }} | ${{ steps.summary.outputs.PASSES }} | ${{ steps.summary.outputs.FAILURES }} | ${{ steps.summary.outputs.SKIPPED }} | ${{ steps.summary.outputs.ERRORS }} |" >> ${GITHUB_STEP_SUMMARY} - echo "" >> ${GITHUB_STEP_SUMMARY} - echo "You can check the full report [here](${{ steps.set-url.outputs.TARGET_URL }})" >> ${GITHUB_STEP_SUMMARY} - echo "There was **${{ steps.summary.outputs.PERCENTAGE }}%** success rate." >> ${GITHUB_STEP_SUMMARY} diff --git a/.github/workflows/e2e-detox-template.yml b/.github/workflows/e2e-detox-template.yml index 6b58f5ab0e..659f793e20 100644 --- a/.github/workflows/e2e-detox-template.yml +++ b/.github/workflows/e2e-detox-template.yml @@ -128,7 +128,7 @@ jobs: if: ${{ inputs.run-ios-tests }} runs-on: macos-14 continue-on-error: true - timeout-minutes: ${{ inputs.low_bandwidth_mode && 60 || 40 }} + timeout-minutes: ${{ inputs.low_bandwidth_mode && 80 || 40 }} env: IOS: true needs: