cleanup GitHub actions (#3071)

* cleanup GHA

* remove unused parameters

* consolidate actions, improve readability

* remove unused files

* restore fetch depth
This commit is contained in:
Denys Vuika 2023-03-22 12:48:53 -04:00 committed by GitHub
parent 509bb5ee93
commit c3b9886edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 68 additions and 154 deletions

View File

@ -1,30 +1,9 @@
name: "After e2e" name: "After e2e"
description: "After e2e" description: "Runs cleanup tasks after e2e run"
env:
storage_file: "./storage-state/AdminUserState.json"
inputs:
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: runs:
using: "composite" using: "composite"
steps: steps:
- name: Remove storage file - name: Remove storage file
shell: bash shell: bash
run: rm -f ${{ env.storage_file }} run: rm -f ./storage-state/AdminUserState.json

View File

@ -33,6 +33,7 @@ runs:
- name: Check content UP - name: Check content UP
shell: bash shell: bash
run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $APP_CONFIG_ECM_HOST -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1 run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $APP_CONFIG_ECM_HOST -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1
- name: Download artifacts - name: Download artifacts
uses: ./.github/actions/download-job-artifact uses: ./.github/actions/download-job-artifact
with: with:
@ -41,6 +42,7 @@ runs:
aws-access-key-id: ${{ inputs.aws-access-key-id }} aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }} aws-region: ${{ inputs.aws-region }}
- name: Replace variables in app.config.json - name: Replace variables in app.config.json
shell: bash shell: bash
run: | run: |
@ -54,6 +56,7 @@ runs:
echo -e "\e[31m \_ ERROR: Variables are still present in the app.config.json file. Some of them might not have default value set.\e[0m"; echo -e "\e[31m \_ ERROR: Variables are still present in the app.config.json file. Some of them might not have default value set.\e[0m";
exit 5; exit 5;
fi fi
- name: Update webdriver-manager - name: Update webdriver-manager
shell: bash shell: bash
run: | run: |

View File

@ -1,35 +1,29 @@
name: "Before install and variables setup" name: "Before install and variables setup"
description: "Before install and variables setup" description: "Before install and variables setup"
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
runs: runs:
using: "composite" using: "composite"
steps: steps:
- uses: ./.github/actions/setup - uses: ./.github/actions/setup
- name: setup S3 caching - name: setup S3 caching
shell: bash shell: bash
run: | run: |
S3_DBP_PATH="s3://alfresco-travis-builds/aca" S3_DBP_PATH="s3://alfresco-travis-builds/aca"
if [ "${{ github.event_name }}" == "push" ]; then if [ "${{ github.event_name }}" == "push" ]; then
S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME" S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME"
elif [ "${{ github.event_name }}" == "pull_request" ]; then elif [ "${{ github.event_name }}" == "pull_request" ]; then
S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME" S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/$BRANCH_NAME"
echo "BASE_HASH=origin/$BRANCH_NAME" >> $GITHUB_ENV echo "BASE_HASH=origin/$BRANCH_NAME" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "schedule" ]; then elif [ "${{ github.event_name }}" == "schedule" ]; then
S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/cron" S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/cron"
else else
S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/api" S3_DBP_ROOT_FOLDER="$S3_DBP_PATH/api"
fi fi
echo "S3_DBP_FOLDER="$S3_DBP_ROOT_FOLDER/${{ github.run_id }}"" >> $GITHUB_ENV echo "S3_DBP_FOLDER="$S3_DBP_ROOT_FOLDER/${{ github.run_id }}"" >> $GITHUB_ENV
- name: ADF linking - name: ADF linking
if: ${{ github.event_name == 'pull_request'}} if: ${{ github.event_name == 'pull_request'}}
uses: ./.github/actions/adf-linking uses: ./.github/actions/adf-linking

View File

@ -27,12 +27,13 @@ runs:
using: "composite" using: "composite"
steps: steps:
- name: Configure AWS Credentials - name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v2
with: with:
aws-access-key-id: ${{ inputs.aws-access-key-id }} aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }} aws-region: ${{ inputs.aws-region }}
- name: download build artifacts from s3
- name: Download build artifacts from s3
shell: bash shell: bash
run: | run: |
test ! -d ${{ inputs.output }} && mkdir -p ${{ inputs.output }} test ! -d ${{ inputs.output }} && mkdir -p ${{ inputs.output }}

View File

@ -14,8 +14,8 @@ runs:
shell: bash shell: bash
run: | run: |
if [[ "${{ inputs.branch_name }}" == "master" ]]; then if [[ "${{ inputs.branch_name }}" == "master" ]]; then
TAG_VERSION="$(jq -cr '.version' < package.json)" TAG_VERSION="$(jq -cr '.version' < package.json)"
else else
TAG_VERSION="${{ inputs.branch_name }}-${{ github.run_id }},{{ inputs.branch_name }}" TAG_VERSION="${{ inputs.branch_name }}-${{ github.run_id }},{{ inputs.branch_name }}"
fi fi
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV

View File

@ -49,7 +49,7 @@ runs:
- name: Publish to GH registry - name: Publish to GH registry
shell: bash shell: bash
run: ./scripts/gh/npm-publish.sh "$TAG" "$DRY_RUN" run: ${{ github.action_path }}/npm-publish.sh "$TAG" "$DRY_RUN"
env: env:
NODE_AUTH_TOKEN: ${{ inputs.github_token }} NODE_AUTH_TOKEN: ${{ inputs.github_token }}
TAG: ${{ inputs.npm_tag }} TAG: ${{ inputs.npm_tag }}
@ -64,7 +64,7 @@ runs:
- name: Publish to NPM registry - name: Publish to NPM registry
shell: bash shell: bash
run: ./scripts/gh/npm-publish.sh "$TAG" "$DRY_RUN" run: ${{ github.action_path }}/npm-publish.sh "$TAG" "$DRY_RUN"
env: env:
NODE_AUTH_TOKEN: ${{ inputs.npm_registry_token }} NODE_AUTH_TOKEN: ${{ inputs.npm_registry_token }}
TAG: ${{ inputs.npm_tag }} TAG: ${{ inputs.npm_tag }}

View File

@ -22,7 +22,7 @@ runs:
if [[ ${{ inputs.branch_name }} =~ ^master.*?$ ]] ; then if [[ ${{ inputs.branch_name }} =~ ^master.*?$ ]] ; then
NEW_LIBRARY_VERSION="$VERSION_IN_PACKAGE_JSON" NEW_LIBRARY_VERSION="$VERSION_IN_PACKAGE_JSON"
else else
NEW_LIBRARY_VERSION="${VERSION_IN_PACKAGE_JSON}.${PR_NUMBER}" NEW_LIBRARY_VERSION="${VERSION_IN_PACKAGE_JSON}.${{ github.run_id }}"
fi fi
./scripts/gh/update-lib-versions.sh "$NEW_LIBRARY_VERSION" "${{ inputs.dry-run }}" ${{ github.action_path }}/update-lib-versions.sh "$NEW_LIBRARY_VERSION" "${{ inputs.dry-run }}"

View File

@ -27,12 +27,13 @@ runs:
using: "composite" using: "composite"
steps: steps:
- name: Configure AWS Credentials - name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v2
with: with:
aws-access-key-id: ${{ inputs.aws-access-key-id }} aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }} aws-region: ${{ inputs.aws-region }}
- name: upload build artifacts to s3
- name: Upload build artifacts to s3
shell: bash shell: bash
run: | run: |
tar cvfj ./s3-artifact.tmp -C ${{ inputs.artifact }} `ls ${{ inputs.artifact }}` tar cvfj ./s3-artifact.tmp -C ${{ inputs.artifact }} `ls ${{ inputs.artifact }}`

View File

@ -24,25 +24,24 @@ jobs:
name: Trigger ACA Upstream name: Trigger ACA Upstream
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'npm' cache: 'npm'
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.35.0 - name: Configure Git Author
with: uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.35.0
username: ${{ vars.BOT_GITHUB_USERNAME }} with:
email: ${{ vars.BOT_GITHUB_EMAIL }} username: ${{ vars.BOT_GITHUB_USERNAME }}
global: true email: ${{ vars.BOT_GITHUB_EMAIL }}
global: true
- name: Trigger Upstream - name: Trigger Upstream
shell: bash shell: bash
run: | run: |
npm install github-api npm install github-api
./scripts/gh/update/update-project.sh -p $GH_BUILD_NUMBER -t $GH_TOKEN -v alpha -c $GH_COMMIT -r ${{ inputs.repo_to_update || 'alfresco-applications' }} ./scripts/gh/update/update-project.sh -p $GH_BUILD_NUMBER -t $GH_TOKEN -v alpha -c $GH_COMMIT -r ${{ inputs.repo_to_update || 'alfresco-applications' }}

View File

@ -166,11 +166,6 @@ jobs:
with: with:
options: "--suite=${{ matrix.e2e-suites.name }}" options: "--suite=${{ matrix.e2e-suites.name }}"
- uses: ./.github/actions/after-e2e - uses: ./.github/actions/after-e2e
with:
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 }}
e2es-playwright: e2es-playwright:
needs: [lint, build, unit-tests] needs: [lint, build, unit-tests]
@ -205,11 +200,6 @@ jobs:
options: "e2e/playwright/tests/folder-rules/playwright.config.ts" options: "e2e/playwright/tests/folder-rules/playwright.config.ts"
test-runner: playwright test-runner: playwright
- uses: ./.github/actions/after-e2e - uses: ./.github/actions/after-e2e
with:
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 }}
finalize: finalize:
if: ${{ always() }} if: ${{ always() }}
@ -217,12 +207,6 @@ jobs:
name: 'Finalize' name: 'Finalize'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@v1.35.0
- name: Check previous jobs status - name: Check previous jobs status
if: >- if: >-
${{ ${{
@ -231,6 +215,14 @@ jobs:
}} }}
run: exit 1 run: exit 1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Extract commit message
uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@v1.35.0
- name: Check ADF link - name: Check ADF link
shell: bash shell: bash
run: | run: |

View File

@ -1,18 +1,21 @@
on: name: Automatic Rebase
on:
issue_comment: issue_comment:
types: [created] types: [created]
name: Automatic Rebase
jobs: jobs:
rebase: rebase:
name: Rebase name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the latest code - name: Checkout the latest code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.3.1 - name: Automatic Rebase
env: uses: cirrus-actions/rebase@1.3.1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -120,21 +120,15 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Setup node - name: Setup node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'npm' cache: 'npm'
- uses: ./.github/actions/setup - uses: ./.github/actions/setup
- name: check PR number
id: action
uses: kamatama41/get-pr-number-action@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: save PR number
shell: bash
run: |
echo "PR_NUMBER=${{ steps.action.outputs.number }}" >> $GITHUB_ENV
- name: publish - name: publish
uses: ./.github/actions/publish-libs uses: ./.github/actions/publish-libs
with: with:

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const path = require('path');
const tsConfigPath = path.resolve(__dirname, 'tsconfig.json');
const tsConfig = require(tsConfigPath);
require('ts-node').register({ project: tsConfigPath });
require('tsconfig-paths').register({
project: tsConfigPath,
baseUrl: path.resolve(__dirname),
paths: tsConfig.compilerOptions.paths
});
const handlerParam = process.argv[2];
const RunnerClass = require(`./npm/${handlerParam}.ts`).default;
const runnerArgs = [...process.argv];
runnerArgs.splice(2, 1);
const runner = new RunnerClass(runnerArgs);
runner.run();

View File

@ -1,32 +0,0 @@
{
"compilerOptions": {
"outDir": "./dist/scripts",
"module": "commonjs",
"target": "es5",
"baseUrl": ".",
"sourceMap": false,
"declaration": false,
"moduleResolution": "node",
"resolveJsonModule": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"allowSyntheticDefaultImports": true,
"typeRoots": [
"node_modules/@types",
"node_modules/commander/typings/index.d.ts"
],
"lib": ["es2018", "dom"],
"types": ["node", "jasmine", "jest"],
"paths": {
"angular.json": ["../angular.json"]
}
},
"exclude": ["node_modules"],
"angularCompilerOptions": {
"preserveWhitespaces": false
}
}