This commit is contained in:
Marco Carrozzo
2023-01-19 15:40:59 +01:00
parent 59df5c661d
commit ca6dd0cc0d
6 changed files with 106 additions and 55 deletions
@@ -1,5 +1,13 @@
name: "Download build artifacts"
description: "Download build artifacts"
inputs:
packages:
description: 'packages to cache'
required: false
type: string
default: 'dist nxcache'
runs:
using: "composite"
steps:
@@ -8,7 +16,7 @@ runs:
env:
REMOTE_PATH: "alfresco-ng2-components/build-cache/${{ github.run_id }}"
run: |
packages=( dist nxcache node_modules )
packages=( $(echo ${{ inputs.packages }}) )
for i in "${packages[@]}"; do
time aws s3 cp --no-progress s3://${S3_BUILD_BUCKET_SHORT_NAME}/${REMOTE_PATH}/$i.tar.gz $i.tar.gz
du -h $i.tar.gz
@@ -20,8 +28,10 @@ runs:
pwd
ls -lha
echo "====DIST===="
find dist -maxdepth 1 -type d
find dist -maxdepth 1 -type d || true
echo "====NXCACHE===="
find nxcache -maxdepth 1 -type d
find nxcache -maxdepth 1 -type d || true
echo "====ADF===="
find node_modules/@alfresco/ -maxdepth 1 -type d
find node_modules/@alfresco/ -maxdepth 1 -type d || true
echo "====NX===="
find node_modules/nx/ -maxdepth 1 -type d || true
+1 -1
View File
@@ -25,4 +25,4 @@ runs:
fi
ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version)
echo "check bundle on TAG_NPM='${TAG_NPM}' and ADF_VERSION='${ADF_VERSION}'"
./scripts/travis/build/npm-check-bundles.sh -v ${ADF_VERSION}
./scripts/travis/build/npm-check-bundles.sh -v ${ADF_VERSION}
+19 -26
View File
@@ -1,12 +1,17 @@
name: 'Setup'
description: 'Initialize cache, env var load'
inputs:
enable-cache:
cache-key-suffix:
description: 'suffix for cache key'
required: false
type: string
default: ''
enable-global-nx-cache:
description: 'enable caching'
required: false
type: boolean
default: 'true'
enable-node-modules-cache:
enable-global-node-modules-cache:
description: 'enable caching for node modules'
required: false
type: boolean
@@ -19,6 +24,7 @@ inputs:
runs:
using: "composite"
steps:
- name: install NPM
uses: actions/setup-node@v3
with:
@@ -28,44 +34,31 @@ runs:
id: tag-sha
uses: Alfresco/alfresco-build-tools/.github/actions/git-latest-tag@v1.29.0
# CACHE
- name: Node cache
id: node-cache
if: ${{ inputs.enable-cache == 'true' }}
- name: NX cache
id: nx-cache
if: ${{ inputs.enable-global-nx-cache == 'true' }}
uses: actions/cache@v3
env:
cache-name: node-cache
cache-name: nx-cache
with:
path: |
~/.npm
nxcache
dist
key: .npm-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_sha }}
key: nxcache-${{ github.ref_name }}-${{ inputs.cache-key-suffix }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
node-${{ runner.os }}-build-${{ env.cache-name }}-
node-${{ runner.os }}-build-
node-${{ runner.os }}-
nxcache-${{ github.ref_name }}-build-${{ inputs.cache-key-suffix }}
nxcache-${{ github.ref_name }}-
- name: Node Modules cache
id: node-modules-cache
if: ${{ inputs.enable-node-modules-cache == 'true' }}
if: ${{ inputs.enable-global-node-modules-cache == 'true' }}
uses: actions/cache@v3
env:
cache-name: node-modules-cache
with:
path: |
node_modules
key: .npm-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_sha }}
key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
node_modules-${{ runner.os }}-build-${{ env.cache-name }}-
node_modules-${{ runner.os }}-build-
node_modules-${{ runner.os }}-
- name: pip cache
uses: actions/cache@v3
if: ${{ inputs.enable-cache == 'true' }}
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-
restore-keys: |
${{ runner.os }}
${{ env.cache-name }}-
# ENV LOAD
- name: load .travis.yml env.global variables
uses: Alfresco/alfresco-build-tools/.github/actions/travis-env-load@v1.17.0
@@ -79,4 +72,4 @@ runs:
act: ${{ inputs.act }}
- name: link nx executable
run: sudo ln -s $(npm bin)/nx /usr/bin/nx
shell: bash
shell: bash
@@ -1,6 +1,11 @@
name: "Upload build artifacts"
description: "Upload build artifacts"
inputs:
packages:
description: 'packages to cache'
required: false
type: boolean
default: 'dist nxcache'
runs:
using: "composite"
steps:
@@ -9,7 +14,7 @@ runs:
env:
REMOTE_PATH: "alfresco-ng2-components/build-cache/${{ github.run_id }}"
run: |
packages=( dist nxcache node_modules )
packages=( $(echo ${{ inputs.packages }}) )
for i in "${packages[@]}"; do
time tar czf $i.tar.gz $i
du -h $i.tar.gz
+49 -14
View File
@@ -7,7 +7,12 @@ on:
description: 'enable dry-run on artifact push'
required: false
type: boolean
default: true
default: true
skip-pr-approve:
description: 'skip pr approve check'
required: false
type: boolean
default: false
pull_request:
types: [opened, synchronize, reopened]
branches:
@@ -83,7 +88,7 @@ jobs:
- name: Show the number
env:
GH_TOKEN: ${{ github.token }}
DEVEL_FLAG: false #put it to true if you need to develop the pipeline on your own branch. before the final merge put it to false
DEVEL_FLAG: ${{ inputs.skip-pr-approve }} #put it to true if you need to develop the pipeline on your own branch. before the final merge put it to false
shell: bash
if: ${{ github.event_name != 'schedule' }}
run: |
@@ -113,13 +118,18 @@ jobs:
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: ./.github/actions/setup
- name: install
run: |
npm ci
nx run cli:bundle
nx run testing:bundle
- run: nx print-affected $NX_CALCULATION_FLAGS
id: setup
with:
enable-global-nx-cache: false
enable-global-node-modules-cache: true
- name: run ci
if: steps.setup.outputs.cache-hit != 'true'
run: npm ci
- run: nx run cli:bundle
- run: nx run testing:bundle
- uses: ./.github/actions/upload-cache-and-artifacts
with:
packages: 'dist node_modules'
unit-tests:
timeout-minutes: 30
@@ -145,7 +155,13 @@ jobs:
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: ./.github/actions/setup
- uses: ./.github/actions/download-cache-and-artifacts
with:
enable-global-nx-cache: true
enable-global-node-modules-cache: false
cache-key-suffix: unit-tests-${{ matrix.unit-tests.name }}
# - uses: ./.github/actions/download-cache-and-artifacts
# with:
# packages: 'node_modules'
- name: Run unit tests
run: |
/usr/bin/xvfb-run --auto-servernum nx affected:test $NX_CALCULATION_FLAGS --exclude=${{ matrix.unit-tests.exclude }}
@@ -162,7 +178,13 @@ jobs:
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: ./.github/actions/setup
with:
enable-global-nx-cache: true
enable-global-node-modules-cache: false
cache-key-suffix: lint
- uses: ./.github/actions/download-cache-and-artifacts
with:
packages: 'node_modules'
- run: nx affected --target=lint $NX_CALCULATION_FLAGS
build-libs:
@@ -177,12 +199,19 @@ jobs:
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: ./.github/actions/setup
- uses: ./.github/actions/download-cache-and-artifacts
with:
enable-global-nx-cache: false
enable-global-node-modules-cache: true
cache-key-suffix: build-libs
# - uses: ./.github/actions/download-cache-and-artifacts
# with:
# packages: 'node_modules'
- run: nx affected:build $NX_CALCULATION_FLAGS --prod
- run: nx build demoshell --configuration production
- run: rm -f /home/runner/work/alfresco-ng2-components/alfresco-ng2-components/node_modules/.ngcc_lock_file
- run: nx affected --target=build-storybook $NX_CALCULATION_FLAGS --configuration ci
- uses: ./.github/actions/upload-cache-and-artifacts
with:
packages: 'dist'
e2e-storybook:
timeout-minutes: 20
@@ -195,13 +224,17 @@ jobs:
with:
fetch-depth: 0 # Fetch all history for all
- uses: ./.github/actions/setup
with:
enable-global-nx-cache: false
enable-global-node-modules-cache: false
- uses: ./.github/actions/download-cache-and-artifacts
with:
packages: 'dist nxcache node_modules'
- name: Process Cloud Storybook Playwright
run: |
npx playwright install chromium
sudo sysctl -w fs.inotify.max_user_watches=524288
npx nx affected --target=e2e-playwright $NX_CALCULATION_FLAGS || exit 1
- uses: ./.github/actions/upload-cache-and-artifacts
e2e:
timeout-minutes: 90
@@ -332,9 +365,11 @@ jobs:
fetch-depth: 0 # Fetch all history for all
- uses: ./.github/actions/setup
with:
enable-cache: "true"
enable-node-modules-cache: "true"
enable-global-nx-cache: true
enable-global-node-modules-cache: true
- uses: ./.github/actions/download-cache-and-artifacts
with:
packages: 'dist nxcache node_modules'
- name: setup chrome
uses: ./.github/actions/setup-chrome
- name: e2e
+16 -8
View File
@@ -80,14 +80,16 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
enable-cache: false
enable-node-modules-cache: false
enable-global-nx-cache: false
enable-global-node-modules-cache: false
- name: install
run: |
npm ci
nx run cli:bundle
nx run testing:bundle
- uses: ./.github/actions/upload-cache-and-artifacts
with:
packages: 'dist nxcache node_modules'
release-demoshell:
needs: [setup]
@@ -106,9 +108,11 @@ jobs:
dry-run-flag: ${{ inputs.dry-run-release }}
- uses: ./.github/actions/setup
with:
enable-cache: false
enable-node-modules-cache: false
enable-global-nx-cache: false
enable-global-node-modules-cache: false
- uses: ./.github/actions/download-cache-and-artifacts
with:
packages: 'dist nxcache node_modules'
- name: release Demoshell docker
run: |
nx build demoshell --configuration production
@@ -132,10 +136,12 @@ jobs:
dry-run-flag: ${{ inputs.dry-run-release }}
- uses: ./.github/actions/setup
with:
enable-cache: false
enable-node-modules-cache: false
enable-global-nx-cache: false
enable-global-node-modules-cache: false
act: ${{ inputs.dry-run-release }}
- uses: ./.github/actions/download-cache-and-artifacts
with:
packages: 'dist nxcache node_modules'
- name: release Storybook docker
run: |
nx run stories:build-storybook --configuration ci
@@ -154,13 +160,15 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
enable-cache: false
enable-node-modules-cache: false
enable-global-nx-cache: false
enable-global-node-modules-cache: false
- id: set-dryrun
uses: ./.github/actions/enable-dryrun
with:
dry-run-flag: ${{ inputs.dry-run-release }}
- uses: ./.github/actions/download-cache-and-artifacts
with:
packages: 'dist nxcache node_modules'
- name: build libraries
run: |
set -u;