From 1ce47e2377e505109e5c358e3b945abb22281c78 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 12:58:27 -0500 Subject: [PATCH 1/8] switch to gha cache --- .github/actions/before-e2e/action.yml | 16 +++++------ .github/workflows/pull-request.yml | 38 ++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/.github/actions/before-e2e/action.yml b/.github/actions/before-e2e/action.yml index 92cef4f90b..ae658c08c4 100644 --- a/.github/actions/before-e2e/action.yml +++ b/.github/actions/before-e2e/action.yml @@ -34,14 +34,14 @@ runs: shell: bash run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $BASE_URL -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1 - - name: Download artifacts - uses: ./.github/actions/download-job-artifact - with: - artifact: ${{ inputs.from }} - output: ${{ inputs.to }} - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} + # - name: Download artifacts + # uses: ./.github/actions/download-job-artifact + # with: + # artifact: ${{ inputs.from }} + # output: ${{ inputs.to }} + # aws-access-key-id: ${{ inputs.aws-access-key-id }} + # aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + # aws-region: ${{ inputs.aws-region }} - name: Install google chrome shell: bash diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 812f8ec0a5..4ff24807ee 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -66,15 +66,23 @@ jobs: - uses: ./.github/actions/before-install - run: npm ci - run: npm run build -- $BUILD_OPTS - - name: upload job artifact + + - name: dist cache if: ${{ success() }} - uses: ./.github/actions/upload-job-artifact + uses: actions/cache@v3 with: - artifact: $CONTENT_CE_DIST_PATH - output: $S3_DBP_FOLDER/alfresco-content-app.tar.bz2 - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} + path: $CONTENT_CE_DIST_PATH + key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} + + # - name: upload job artifact + # if: ${{ success() }} + # uses: ./.github/actions/upload-job-artifact + # with: + # artifact: $CONTENT_CE_DIST_PATH + # output: $S3_DBP_FOLDER/alfresco-content-app.tar.bz2 + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # aws-region: ${{ env.AWS_REGION }} unit-tests: needs: [lint, build] @@ -136,6 +144,13 @@ jobs: cache: 'npm' - uses: ./.github/actions/before-install - run: npm ci + + - uses: actions/cache/restore@v3 + id: cache + with: + path: $CONTENT_CE_DIST_PATH + key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} + - uses: ./.github/actions/before-e2e with: from: "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" @@ -189,8 +204,16 @@ jobs: with: node-version-file: '.nvmrc' cache: 'npm' + - uses: ./.github/actions/before-install - run: npm ci + + - uses: actions/cache/restore@v3 + id: cache + with: + path: $CONTENT_CE_DIST_PATH + key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} + - uses: ./.github/actions/before-e2e with: from: "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" @@ -199,6 +222,7 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} + - name: before playwright shell: bash run: npx playwright install chromium From 5a7e99c13d0842d896dbc1f79f41b043cafd0b1e Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 13:10:40 -0500 Subject: [PATCH 2/8] save cache --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4ff24807ee..752137885f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -69,7 +69,7 @@ jobs: - name: dist cache if: ${{ success() }} - uses: actions/cache@v3 + uses: actions/cache/save@v3 with: path: $CONTENT_CE_DIST_PATH key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} From 384928c7d9a393c97ef190dd2e51ad1901a1c3e6 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 13:21:08 -0500 Subject: [PATCH 3/8] use exact path --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 752137885f..541491b4cb 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -71,7 +71,7 @@ jobs: if: ${{ success() }} uses: actions/cache/save@v3 with: - path: $CONTENT_CE_DIST_PATH + path: ./dist/content-ce key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} # - name: upload job artifact @@ -148,7 +148,7 @@ jobs: - uses: actions/cache/restore@v3 id: cache with: - path: $CONTENT_CE_DIST_PATH + path: ./dist/content-ce key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} - uses: ./.github/actions/before-e2e From f31d790d72f43418180f3629f5b76fae915325fc Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 13:53:28 -0500 Subject: [PATCH 4/8] improve cache key --- .github/workflows/pull-request.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 541491b4cb..a5d7f44214 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -72,7 +72,7 @@ jobs: uses: actions/cache/save@v3 with: path: ./dist/content-ce - key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} + key: cache-dist-${{ github.run_id }} # - name: upload job artifact # if: ${{ success() }} @@ -149,7 +149,7 @@ jobs: id: cache with: path: ./dist/content-ce - key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} + key: cache-dist-${{ github.run_id }} - uses: ./.github/actions/before-e2e with: @@ -211,8 +211,8 @@ jobs: - uses: actions/cache/restore@v3 id: cache with: - path: $CONTENT_CE_DIST_PATH - key: cache-dist-${{ github.run_id }}-${{ github.run_attempt }} + path: ./dist/content-ce + key: cache-dist-${{ github.run_id }} - uses: ./.github/actions/before-e2e with: From ef067dd84f47ee5b2d0880bfea319d8c5936b63d Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 14:00:28 -0500 Subject: [PATCH 5/8] cleanup --- .github/actions/before-e2e/action.yml | 35 ----------------------- .github/actions/before-install/action.yml | 2 -- .github/workflows/pull-request.yml | 27 +---------------- .github/workflows/release.yml | 2 -- 4 files changed, 1 insertion(+), 65 deletions(-) diff --git a/.github/actions/before-e2e/action.yml b/.github/actions/before-e2e/action.yml index ae658c08c4..886302b0be 100644 --- a/.github/actions/before-e2e/action.yml +++ b/.github/actions/before-e2e/action.yml @@ -1,32 +1,6 @@ name: "Before e2e" description: "Before e2e" -inputs: - from: - description: 'path to download the artifact' - required: true - type: string - to: - description: 'path to save artifact to' - required: true - type: string - id: - description: 'test suite id' - required: true - type: number - aws-access-key-id: - description: 'aws access key id' - required: true - type: string - aws-secret-access-key: - description: 'aws secret access key' - required: true - type: string - aws-region: - description: 'aws region' - required: true - type: string - runs: using: "composite" steps: @@ -34,15 +8,6 @@ runs: shell: bash run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $BASE_URL -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1 - # - name: Download artifacts - # uses: ./.github/actions/download-job-artifact - # with: - # artifact: ${{ inputs.from }} - # output: ${{ inputs.to }} - # aws-access-key-id: ${{ inputs.aws-access-key-id }} - # aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - # aws-region: ${{ inputs.aws-region }} - - name: Install google chrome shell: bash run: | diff --git a/.github/actions/before-install/action.yml b/.github/actions/before-install/action.yml index 4b42f896c8..0f4ddf244e 100644 --- a/.github/actions/before-install/action.yml +++ b/.github/actions/before-install/action.yml @@ -22,8 +22,6 @@ runs: S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/api" fi - echo "S3_DBP_FOLDER="$S3_DBP_ROOT_FOLDER/${{ github.run_id }}"" >> $GITHUB_ENV - - name: ADF linking if: ${{ github.event_name == 'pull_request'}} uses: ./.github/actions/adf-linking diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index a5d7f44214..3118e9b12a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -23,8 +23,6 @@ env: CONTENT_IDENTITY_PASSWORD: ${{ secrets.CONTENT_IDENTITY_PASSWORD }} SCREENSHOT_USERNAME: ${{ secrets.SCREENSHOT_USERNAME }} SCREENSHOT_PASSWORD: ${{ secrets.SCREENSHOT_PASSWORD}} - AWS_REGION: "eu-west-2" - CONTENT_CE_DIST_PATH: "./dist/content-ce" PLAYWRIGHT_E2E_HOST: ${{ secrets.PLAYWRIGHT_E2E_HOST }} GH_BUILD_NUMBER: ${{ github.run_id }} MAXINSTANCES: 2 @@ -74,16 +72,6 @@ jobs: path: ./dist/content-ce key: cache-dist-${{ github.run_id }} - # - name: upload job artifact - # if: ${{ success() }} - # uses: ./.github/actions/upload-job-artifact - # with: - # artifact: $CONTENT_CE_DIST_PATH - # output: $S3_DBP_FOLDER/alfresco-content-app.tar.bz2 - # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # aws-region: ${{ env.AWS_REGION }} - unit-tests: needs: [lint, build] name: "Unit tests: ${{ matrix.unit-tests.name }}" @@ -152,13 +140,7 @@ jobs: key: cache-dist-${{ github.run_id }} - uses: ./.github/actions/before-e2e - with: - from: "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" - to: $CONTENT_CE_DIST_PATH - id: ${{ matrix.e2e-suites.id }} - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} + - uses: ./.github/actions/run-e2e with: options: "--suite=${{ matrix.e2e-suites.name }}" @@ -215,13 +197,6 @@ jobs: key: cache-dist-${{ github.run_id }} - uses: ./.github/actions/before-e2e - with: - from: "$S3_DBP_FOLDER/alfresco-content-app.tar.bz2" - to: $CONTENT_CE_DIST_PATH - id: 15 - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - name: before playwright shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bfd82095b9..8cf0c0cae8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,8 +17,6 @@ env: BASE_URL: ${{ secrets.PIPELINE_ENV_URL }} ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }} ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }} - AWS_REGION: "eu-west-2" - CONTENT_CE_DIST_PATH: "./dist/content-ce" PLAYWRIGHT_E2E_HOST: ${{ secrets.PLAYWRIGHT_E2E_HOST }} NPM_REGISTRY_ADDRESS: ${{ secrets.NPM_REGISTRY_ADDRESS }} From b65dae93417d3a7c8e0c74d67cfe31dd0be4d235 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 14:11:06 -0500 Subject: [PATCH 6/8] cleanup --- .github/actions/before-install/action.yml | 16 ------- .../actions/download-job-artifact/action.yml | 45 ------------------- .../actions/upload-job-artifact/action.yml | 41 ----------------- 3 files changed, 102 deletions(-) delete mode 100644 .github/actions/download-job-artifact/action.yml delete mode 100644 .github/actions/upload-job-artifact/action.yml diff --git a/.github/actions/before-install/action.yml b/.github/actions/before-install/action.yml index 0f4ddf244e..ff18332dc6 100644 --- a/.github/actions/before-install/action.yml +++ b/.github/actions/before-install/action.yml @@ -6,22 +6,6 @@ runs: steps: - uses: ./.github/actions/setup - - name: setup S3 caching - shell: bash - run: | - S3_DBP_PATH="s3://alfresco-travis-builds/aca" - - if [ "${{ github.event_name }}" == "push" ]; then - S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME" - elif [ "${{ github.event_name }}" == "pull_request" ]; then - S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME" - echo "BASE_HASH=origin/$BRANCH_NAME" >> $GITHUB_ENV - elif [ "${{ github.event_name }}" == "schedule" ]; then - S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/cron" - else - S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/api" - fi - - name: ADF linking if: ${{ github.event_name == 'pull_request'}} uses: ./.github/actions/adf-linking diff --git a/.github/actions/download-job-artifact/action.yml b/.github/actions/download-job-artifact/action.yml deleted file mode 100644 index 9d11f80f98..0000000000 --- a/.github/actions/download-job-artifact/action.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: "Download build artifacts" -description: "Download build artifacts" - -inputs: - artifact: - description: 'path to the s3 artifact (tar.bz2) to download and extract' - required: true - type: string - output: - description: 'directory to extract the archive to' - required: true - type: string - aws-access-key-id: - description: 'aws access key id' - required: true - type: string - aws-secret-access-key: - description: 'aws secret access key' - required: true - type: string - aws-region: - description: 'aws region' - required: true - type: string - -runs: - using: "composite" - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} - - - name: Download build artifacts from s3 - shell: bash - run: | - test ! -d ${{ inputs.output }} && mkdir -p ${{ inputs.output }} - aws s3 cp ${{ inputs.artifact }} ./s3-artifact.tmp - echo 'artifact download done' - tar -xvf ./s3-artifact.tmp -C ${{ inputs.output }} >&/dev/null - echo 'tar the artifact done' - rm ./s3-artifact.tmp - echo 'remove tmp file' diff --git a/.github/actions/upload-job-artifact/action.yml b/.github/actions/upload-job-artifact/action.yml deleted file mode 100644 index a0761597ac..0000000000 --- a/.github/actions/upload-job-artifact/action.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Upload build artifacts" -description: "Upload build artifacts" - -inputs: - artifact: - description: 'path to the artifact to archieve (tar.bz2) and upload (like ./dist)' - required: true - type: string - output: - description: 'the S3 object to copy it to, like: s3://bucket-name/folder/whatever.tar.bz2' - required: true - type: string - aws-access-key-id: - description: 'aws access key id' - required: true - type: string - aws-secret-access-key: - description: 'aws secret access key' - required: true - type: string - aws-region: - description: 'aws region' - required: true - type: string - -runs: - using: "composite" - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} - - - name: Upload build artifacts to s3 - shell: bash - run: | - tar cvfj ./s3-artifact.tmp -C ${{ inputs.artifact }} `ls ${{ inputs.artifact }}` - aws s3 cp ./s3-artifact.tmp ${{ inputs.output }} - rm ./s3-artifact.tmp From 2e2cbe6003cd364e1708ad5aa129b318b724356d Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 14:30:26 -0500 Subject: [PATCH 7/8] remove npm registry var --- .github/actions/publish-libs/action.yml | 6 +----- .github/workflows/release.yml | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/actions/publish-libs/action.yml b/.github/actions/publish-libs/action.yml index e375332c0b..27a8be1953 100644 --- a/.github/actions/publish-libs/action.yml +++ b/.github/actions/publish-libs/action.yml @@ -10,10 +10,6 @@ inputs: description: 'Github token' required: true type: string - npm_registry_address: - description: 'NPM registry address' - required: true - type: string npm_registry_token: description: 'NPM registry token' required: true @@ -59,7 +55,7 @@ runs: name: setup NPM registry with: node-version-file: '.nvmrc' - registry-url: 'https://${{ inputs.npm_registry_address }}' + registry-url: 'https://registry.npmjs.org' scope: '@alfresco' - name: Publish to NPM registry diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cf0c0cae8..f68106f19b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,6 @@ env: ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }} ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }} PLAYWRIGHT_E2E_HOST: ${{ secrets.PLAYWRIGHT_E2E_HOST }} - NPM_REGISTRY_ADDRESS: ${{ secrets.NPM_REGISTRY_ADDRESS }} jobs: publish-docker-registry: @@ -129,7 +128,6 @@ jobs: with: branch_name: ${{ env.BRANCH_NAME }} github_token: ${{ secrets.BOT_GITHUB_TOKEN }} - npm_registry_address: ${{ vars.NPM_REGISTRY_ADDRESS }} npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }} npm_tag: ${{ env.TAG_NPM }} dry-run: ${{ inputs.dry-run-release }} From 99bf03e2e5a21d3c071c80c04b760a67034bac71 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 3 Jan 2024 14:34:29 -0500 Subject: [PATCH 8/8] remove codeowners --- .github/CODEOWNERS | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index f99075462f..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,38 +0,0 @@ -# This is a comment. -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default owners for everything in -# the repo. Unless a later match takes precedence, -# these users will be requested for -# review when someone opens a pull request. -* @DenysVuika @eromano - -# Order is important; the last matching pattern takes the most -# precedence. When someone opens a pull request that only -# modifies JS files, only @js-owner and not the global -# owner(s) will be requested for a review. -e2e/* @eromano @DenysVuika -protractor.conf.js @DenysVuika - -# You can also use email addresses if you prefer. They'll be -# used to look up users just like we do for commit author -# emails. -#*.go docs@example.com - -# In this example, @doctocat owns any files in the build/logs -# directory at the root of the repository and any of its -# subdirectories. -#/build/logs/ @doctocat - -# The `docs/*` pattern will match files like -# `docs/getting-started.md` but not further nested files like -# `docs/build-app/troubleshooting.md`. -docs/* @m-hulbert - -# In this example, @octocat owns any file in an apps directory -# anywhere in your repository. -#apps/ @octocat - -# In this example, @doctocat owns any file in the `/docs` -# directory in the root of your repository. -#/docs/ @doctocat