From 73969bfec3dfa730a1a2250956d1c6710523fb62 Mon Sep 17 00:00:00 2001 From: VitoAlbano Date: Thu, 13 Mar 2025 21:17:19 +0000 Subject: [PATCH] [AAE-32905] - Checking by adding more steps needed --- .github/workflows/build-lib-workflow.yml | 2 +- .github/workflows/pull-request-save.yml | 82 +----------------------- .github/workflows/pull-request.yml | 29 +++++++++ 3 files changed, 32 insertions(+), 81 deletions(-) diff --git a/.github/workflows/build-lib-workflow.yml b/.github/workflows/build-lib-workflow.yml index 2cac91887e..e095a6c26c 100644 --- a/.github/workflows/build-lib-workflow.yml +++ b/.github/workflows/build-lib-workflow.yml @@ -9,7 +9,7 @@ on: type: string jobs: - unit-tests: + build: runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/pull-request-save.yml b/.github/workflows/pull-request-save.yml index d6b6e4db77..29ebeeb9f5 100644 --- a/.github/workflows/pull-request-save.yml +++ b/.github/workflows/pull-request-save.yml @@ -75,90 +75,12 @@ jobs: exit 1 fi - check-if-pr-is-approved: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - - name: Get branch name - uses: Alfresco/alfresco-build-tools/.github/actions/get-branch-name@c1236aee36bb9b35c5972819fcf8a4d07572e6cd # v8.16.0 - - - name: Save commit message - uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@c1236aee36bb9b35c5972819fcf8a4d07572e6cd # v8.16.0 - - - name: ci:force flag parser - shell: bash - run: | - if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.actor }}" == "dependabot[bot]" ]; then - echo -e "\033[32mci:force check can be skipped\033[0m" - skip_check="true" - elif [[ "$COMMIT_MESSAGE" == *"[ci:force]"* ]]; then - echo -e "\033[32m[ci:force] flag detected. No need for approval.\033[0m" - skip_check="true" - fi - - - name: Get PR number - if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} - uses: kamatama41/get-pr-number-action@0bcaab5752c0b699149e74667c8ce2f764cbb7fa # v0.9.1 - id: action - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: show pr number - shell: bash - run: | - echo "PR: ${{ steps.action.outputs.number }}" - - - name: check if pr is approved - env: - DEVEL_FLAG: ${{ inputs.devel }} - GH_TOKEN: ${{ github.token }} - skip_check: "false" - run: | - if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.actor }}" == "dependabot[bot]" ]; then - echo -e "\033[32mci:force check can be skipped\033[0m" - skip_check="true" - elif [[ "$COMMIT_MESSAGE" == *"[ci:force]"* ]]; then - echo -e "\033[32m[ci:force] flag detected. No need for approval.\033[0m" - skip_check="true" - fi - - if [ "${{ github.actor }}" == "dependabot[bot]" ] || [ "${{ github.actor }}" == "alfresco-build" ]; then - echo -e "\033[32mCommit by ${{ github.actor }}. No need for approval.\033[0m" - skip_check="true" - fi - if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - echo -e "\033[32mSchedule event\033[0m" - skip_check="true" - fi - - if [[ "$DEVEL_FLAG" == "true" ]]; then - echo -e "\033[32mDevel flag\033[0m" - skip_check="true" - fi - - if [ "$skip_check" == "false" ]; then - echo "Checking PR approval" - prNumber=${{ steps.action.outputs.number }} - echo "PR: $prNumber" - checkApproval=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$prNumber/reviews | jq '.[] | select(.state == "APPROVED") | .user.login') - if [[ $checkApproval ]]; then - echo -e "\033[32mPR approved\033[0m" - else - echo -e "\033[31mPR NOT approved\033[0m" - exit 1 - fi - fi - setup: # long timeout required when cache has to be recreated timeout-minutes: 30 name: "Setup" runs-on: ubuntu-latest - needs: [check-if-pr-is-approved, pre-checks] + # needs: [check-if-pr-is-approved, pre-checks] steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -219,7 +141,7 @@ jobs: with: fetch-depth: 0 # Fetch all history for all tags and branches - uses: ./.github/actions/setup - - run: npx nx affected --target=lint $NX_CALCULATION_FLAGS + - run: npx nx affected --target=lint build-libs: # long timeout required when cache has to be recreated diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e1c78758b1..0c9298bb43 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -209,6 +209,20 @@ jobs: echo "Matrix JSON: $MATRIX_JSON" echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT + lint: + # long timeout required when cache has to be recreated + timeout-minutes: 30 + name: "Lint" + runs-on: ubuntu-latest + needs: [] + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 # Fetch all history for all tags and branches + - uses: ./.github/actions/setup + - run: npx nx affected --target=lint + trigger-build: name: "Build Libs" needs: [generate-affected-matrix] @@ -216,6 +230,21 @@ jobs: with: matrix: ${{ needs.generate-affected-matrix.outputs.matrix }} + build-storybook: + name: "Build Storybook" + needs: [generate-affected-matrix] + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + fetch-depth: 0 + - name: Setup environment + uses: ./.github/actions/setup + - name: Build Storybook + run: | + NX_REJECT_UNKNOWN_LOCAL_CACHE=0 npx nx affected --target=build-storybook $NX_CALCULATION_FLAGS --configuration=ci + trigger-unit-tests: name: "Unit Tests" needs: [generate-affected-matrix]