From e05ba290a0227f903076183dd4192ebad0478f8c Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Tue, 3 Jan 2023 14:46:21 +0100 Subject: [PATCH] Fix syntax error in job pre-condition (#126) build(workflow): fix syntax error in job pre-condition build(workflow): improve tests and validation workflows --- .github/workflows/commands-handler.yml | 5 ++-- .github/workflows/release.yml | 11 ++++++--- .github/workflows/run-tests.yml | 10 ++++++++ .github/workflows/run-validations.yml | 32 +++++++++++++++++++++++++- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/.github/workflows/commands-handler.yml b/.github/workflows/commands-handler.yml index d7a0bed8..4e34b04c 100644 --- a/.github/workflows/commands-handler.yml +++ b/.github/workflows/commands-handler.yml @@ -10,12 +10,11 @@ defaults: jobs: process: name: Process command - if: ${{ github.event.issue.pull_request && endsWith(github.repository, '-private') != true + if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true runs-on: ubuntu-latest steps: - name: Check referred user id: user-check - shell: bash env: CLEN_BOT: ${{ secrets.CLEN_BOT }} run: echo "expected-user=${{ startsWith(github.event.comment.body, format('@{0} ', env.CLEN_BOT)) }}" >> $GITHUB_OUTPUT @@ -41,4 +40,4 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} listener: ${{ secrets.CLEN_BOT }} - jira-api-key: ${{ secrets.JIRA_API_KEY }} + jira-api-key: ${{ secrets.JIRA_API_KEY }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ca26e47..d9c73a85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: check-release: name: Check release required runs-on: ubuntu-latest - if: ${{ github.event.pull_request.merged && endsWith(github.repository, '-private') != true }} + if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true outputs: release: ${{ steps.check.outputs.ready }} steps: @@ -28,9 +28,9 @@ jobs: token: ${{ secrets.GH_TOKEN }} publish: name: Publish package - runs-on: macos-11 + runs-on: macos-12 needs: check-release - if: ${{ needs.check-release.outputs.release == 'true' }} + if: needs.check-release.outputs.release == 'true' steps: - name: Checkout repository uses: actions/checkout@v3 @@ -56,3 +56,8 @@ jobs: token: ${{ secrets.GH_TOKEN }} jira-api-key: ${{ secrets.JIRA_API_KEY }} last-service: true + - name: Upload test reports + uses: ./.github/.release/actions/actions/test-reports/upload + with: + token: ${{ secrets.GH_TOKEN }} + acceptance-tests-workflow: Tests diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 62774535..c567aa54 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -48,6 +48,9 @@ jobs: run: xcrun simctl list -j - name: Run ${{ matrix.environment }} unit tests run: bundle exec fastlane test --env $(echo ${{ matrix.environment }} | tr '[:upper:]' '[:lower:]') + - name: Cancel workflow runs for commit on error + if: failure() + uses: ./.github/.release/actions/actions/utils/fast-jobs-failure acceptance-tests: name: Acceptance tests runs-on: macos-12 @@ -105,3 +108,10 @@ jobs: name: acceptance-test-reports path: Results/*.json retention-days: 7 + all-tests: + name: Tests + runs-on: ubuntu-latest + needs: [tests, acceptance-tests] + steps: + - name: Tests summary + run: echo -e "\033[38;2;95;215;0m\033[1mAll tests successfully passed" diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml index 2cb39222..ff2b4af4 100644 --- a/.github/workflows/run-validations.yml +++ b/.github/workflows/run-validations.yml @@ -11,7 +11,7 @@ defaults: shell: bash jobs: - repository-validators: + pubnub-yml: name: "Validate .pubnub.yml" runs-on: ubuntu-latest steps: @@ -28,6 +28,9 @@ jobs: uses: ./.github/.release/actions/actions/validators/pubnub-yml with: token: ${{ secrets.GH_TOKEN }} + - name: Cancel workflow runs for commit on error + if: failure() + uses: ./.github/.release/actions/actions/utils/fast-jobs-failure package-managers-validation: name: Validate package managers runs-on: macos-12 @@ -39,6 +42,13 @@ jobs: uses: actions/checkout@v3 with: token: ${{ secrets.GH_TOKEN }} + - name: Checkout actions + uses: actions/checkout@v3 + with: + repository: pubnub/client-engineering-deployment-tools + ref: v1 + token: ${{ secrets.GH_TOKEN }} + path: .github/.release/actions - name: Setup Ruby 2.6.6 uses: ruby/setup-ruby@v1 with: @@ -55,6 +65,9 @@ jobs: ${{ runner.os }}-spm- - name: ${{ matrix.managers }} validation run: bundle exec fastlane lint_$(echo ${{ matrix.managers }} | tr '[:upper:]' '[:lower:]' | tr ' ' '_') + - name: Cancel workflow runs for commit on error + if: failure() + uses: ./.github/.release/actions/actions/utils/fast-jobs-failure demo-app-validation: name: Validate demo application runs-on: macos-12 @@ -63,6 +76,13 @@ jobs: uses: actions/checkout@v3 with: token: ${{ secrets.GH_TOKEN }} + - name: Checkout actions + uses: actions/checkout@v3 + with: + repository: pubnub/client-engineering-deployment-tools + ref: v1 + token: ${{ secrets.GH_TOKEN }} + path: .github/.release/actions - name: Setup Ruby 2.6.6 uses: ruby/setup-ruby@v1 with: @@ -79,3 +99,13 @@ jobs: ${{ runner.os }}-spm- - name: Demo application build validation run: bundle exec fastlane build_example --env ios + - name: Cancel workflow runs for commit on error + if: failure() + uses: ./.github/.release/actions/actions/utils/fast-jobs-failure + all-validations: + name: Validations + runs-on: ubuntu-latest + needs: [pubnub-yml, package-managers-validation, demo-app-validation] + steps: + - name: Validations summary + run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed"