[ACS-6543] switch from aws to gha cache (#3582)

* switch to gha cache

* save cache

* use exact path

* improve cache key

* cleanup

* cleanup

* remove npm registry var

* remove codeowners
This commit is contained in:
Denys Vuika 2024-01-04 10:25:26 -05:00 committed by GitHub
parent 43f16a05b7
commit 33c3d6f5d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 209 deletions

38
.github/CODEOWNERS vendored
View File

@ -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

View File

@ -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: |

View File

@ -6,24 +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
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

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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
@ -66,15 +64,13 @@ 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/save@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: ./dist/content-ce
key: cache-dist-${{ github.run_id }}
unit-tests:
needs: [lint, build]
@ -136,14 +132,15 @@ jobs:
cache: 'npm'
- uses: ./.github/actions/before-install
- run: npm ci
- uses: ./.github/actions/before-e2e
- uses: actions/cache/restore@v3
id: cache
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 }}
path: ./dist/content-ce
key: cache-dist-${{ github.run_id }}
- uses: ./.github/actions/before-e2e
- uses: ./.github/actions/run-e2e
with:
options: "--suite=${{ matrix.e2e-suites.name }}"
@ -189,16 +186,18 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'npm'
- uses: ./.github/actions/before-install
- run: npm ci
- uses: ./.github/actions/before-e2e
- uses: actions/cache/restore@v3
id: cache
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 }}
path: ./dist/content-ce
key: cache-dist-${{ github.run_id }}
- uses: ./.github/actions/before-e2e
- name: before playwright
shell: bash
run: npx playwright install chromium

View File

@ -17,10 +17,7 @@ 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 }}
jobs:
publish-docker-registry:
@ -131,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 }}