From 1fa8e8dcd104fd3df7c38ee8ebeef7aa1838370d Mon Sep 17 00:00:00 2001 From: Ilya Shulgin <13484957+Sateetas@users.noreply.github.com> Date: Sat, 14 Dec 2024 12:16:35 +0200 Subject: [PATCH] AND-9484 Add matrix jobs. --- .../workflows/{detekt.yml => pr_check.yml} | 44 ++++++------ .github/workflows/tests.yml | 67 ------------------- 2 files changed, 25 insertions(+), 86 deletions(-) rename .github/workflows/{detekt.yml => pr_check.yml} (53%) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/detekt.yml b/.github/workflows/pr_check.yml similarity index 53% rename from .github/workflows/detekt.yml rename to .github/workflows/pr_check.yml index d2c653cb5c..a02c32fc6d 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/pr_check.yml @@ -1,4 +1,4 @@ -name: Detekt +name: PR check on: pull_request: @@ -20,10 +20,13 @@ concurrency: cancel-in-progress: true jobs: - detekt: - name: Detekt - runs-on: [ self-hosted, ARM64, active-android ] + ci: + name: ${{ matrix.task }} + runs-on: [ self-hosted, ARM64, macOS, active-android ] if: github.event.pull_request.draft == false + strategy: + matrix: + task: [Detekt, Test] steps: - name: Checkout uses: actions/checkout@v3 @@ -35,33 +38,36 @@ jobs: run: | docker build --platform linux/arm64 -t tangem_ci_android_environment . - - name: Run detekt + - name: Run ${{ matrix.task }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} BUNDLE_PATH: vendor/bundle + TASK: ${{ matrix.task }} run: | docker run --rm \ -e GITHUB_TOKEN \ -e GITHUB_ACTOR \ -e BUNDLE_PATH \ + -e TASK \ -v ~/.gradle:/root/.gradle \ -v ${{ github.workspace }}:/workspace \ tangem_ci_android_environment \ sh -c " - echo 'Running detekt...'; - - cd /workspace && fastlane detekt; + echo "Running $TASK..."; + laneName=$(echo "$TASK" | awk '{print tolower(substr($0,1,1)) substr($0,2)}') + echo "Running $laneName"; + cd /workspace && fastlane "$laneName"; " - - name: Build notification - if: failure() - uses: adamkdean/simple-slack-notify@master - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }} - with: - channel: '#development-android' - text: 'Detekt #${{ github.run_number }} failed' - color: 'danger' - fields: | - [{ "title": "Action URL", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}] +# - name: Build notification +# if: failure() +# uses: adamkdean/simple-slack-notify@master +# env: +# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }} +# with: +# channel: '#development-android' +# text: '${{ matrix.task }} #${{ github.run_number }} failed' +# color: 'danger' +# fields: | +# [{ "title": "Action URL", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 0595a5756d..0000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Tests - -on: - pull_request: - branches: - - 'release' - - 'develop' - - 'master' - - 'hotfix/**' - - '*_pre_release' - types: - - opened - - reopened - - synchronize - - ready_for_review - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - name: Test - runs-on: [ self-hosted, ARM64, active-android ] - if: github.event.pull_request.draft == false - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - token: ${{ secrets.GH_MOBILE_PAT }} - - - name: Build Docker image - run: | - docker build --platform linux/arm64 -t tangem_ci_android_environment . - - - name: Run tests - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} - BUNDLE_PATH: vendor/bundle - run: | - docker run --rm \ - -e GITHUB_TOKEN \ - -e GITHUB_ACTOR \ - -e BUNDLE_PATH \ - -v ~/.gradle:/root/.gradle \ - -v ${{ github.workspace }}:/workspace \ - tangem_ci_android_environment \ - sh -c " - echo 'Running tests...'; - - cd /workspace && fastlane test; - " - - - name: Build notification - if: failure() - uses: adamkdean/simple-slack-notify@master - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }} - with: - channel: '#development-android' - text: 'Tangem app tests #${{ github.run_number }} failed' - color: 'danger' - fields: | - [{ "title": "Action URL", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}]