mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
reworking on cache
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
name: 'Setup'
|
name: 'Setup'
|
||||||
description: 'Initialize cache, env var load'
|
description: 'Initialize cache, env var load'
|
||||||
inputs:
|
inputs:
|
||||||
|
cache-key-suffix:
|
||||||
|
description: 'suffix for cache key'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
enable-global-nx-cache:
|
enable-global-nx-cache:
|
||||||
description: 'enable caching'
|
description: 'enable caching'
|
||||||
required: false
|
required: false
|
||||||
@@ -29,19 +34,18 @@ runs:
|
|||||||
id: tag-sha
|
id: tag-sha
|
||||||
uses: Alfresco/alfresco-build-tools/.github/actions/git-latest-tag@v1.29.0
|
uses: Alfresco/alfresco-build-tools/.github/actions/git-latest-tag@v1.29.0
|
||||||
# CACHE
|
# CACHE
|
||||||
- name: Node cache
|
- name: NX cache
|
||||||
id: node-cache
|
id: nx-cache
|
||||||
if: ${{ inputs.enable-global-nx-cache == 'true' }}
|
if: ${{ inputs.enable-global-nx-cache == 'true' }}
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
env:
|
env:
|
||||||
cache-name: node-cache
|
cache-name: nx-cache
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
nxcache
|
nxcache
|
||||||
key: nxcache-${{ github.ref_name }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_long_sha }}
|
key: nxcache-${{ github.ref_name }}-${{ inputs.cache-key-suffix }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
nxcache-${{ github.ref_name }}-build-${{ env.cache-name }}-
|
nxcache-${{ github.ref_name }}-build-${{ inputs.cache-key-suffix }}
|
||||||
nxcache-${{ github.ref_name }}-build-
|
|
||||||
nxcache-${{ github.ref_name }}-
|
nxcache-${{ github.ref_name }}-
|
||||||
- name: Node Modules cache
|
- name: Node Modules cache
|
||||||
id: node-modules-cache
|
id: node-modules-cache
|
||||||
@@ -52,11 +56,10 @@ runs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
node_modules
|
node_modules
|
||||||
key: .npm-${{ github.ref_name }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_long_sha }}
|
key: node_modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
node_modules-${{ github.ref_name }}-build-${{ env.cache-name }}-
|
node_modules-${{ env.cache-name }}-
|
||||||
node_modules-${{ github.ref_name }}-build-
|
node_modules-
|
||||||
node_modules-${{ github.ref_name }}-
|
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
if: ${{ inputs.enable-global-nx-cache == 'true' }}
|
if: ${{ inputs.enable-global-nx-cache == 'true' }}
|
||||||
|
|||||||
@@ -118,16 +118,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch all history for all tags and branches
|
fetch-depth: 0 # Fetch all history for all tags and branches
|
||||||
- uses: ./.github/actions/setup
|
- uses: ./.github/actions/setup
|
||||||
|
id: setup
|
||||||
with:
|
with:
|
||||||
enable-global-nx-cache: false
|
enable-global-nx-cache: false
|
||||||
enable-global-node-modules-cache: true
|
enable-global-node-modules-cache: true
|
||||||
- run: npm ci
|
- name: run ci
|
||||||
|
if: steps.setup.outputs.cache-hit != 'true'
|
||||||
|
run: npm ci
|
||||||
- run: nx run cli:bundle
|
- run: nx run cli:bundle
|
||||||
- run: nx run testing:bundle
|
- run: nx run testing:bundle
|
||||||
- run: nx print-affected $NX_CALCULATION_FLAGS
|
|
||||||
- uses: ./.github/actions/upload-cache-and-artifacts
|
- uses: ./.github/actions/upload-cache-and-artifacts
|
||||||
with:
|
with:
|
||||||
packages: 'dist nxcache node_modules'
|
packages: 'dist node_modules'
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
@@ -156,6 +158,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
enable-global-nx-cache: false
|
enable-global-nx-cache: false
|
||||||
enable-global-node-modules-cache: false
|
enable-global-node-modules-cache: false
|
||||||
|
cache-key-suffix: unit-tests
|
||||||
- uses: ./.github/actions/download-cache-and-artifacts
|
- uses: ./.github/actions/download-cache-and-artifacts
|
||||||
with:
|
with:
|
||||||
packages: 'dist nxcache node_modules'
|
packages: 'dist nxcache node_modules'
|
||||||
@@ -176,18 +179,14 @@ jobs:
|
|||||||
fetch-depth: 0 # Fetch all history for all tags and branches
|
fetch-depth: 0 # Fetch all history for all tags and branches
|
||||||
- uses: ./.github/actions/setup
|
- uses: ./.github/actions/setup
|
||||||
with:
|
with:
|
||||||
enable-global-nx-cache: false
|
enable-global-nx-cache: true
|
||||||
enable-global-node-modules-cache: true
|
enable-global-node-modules-cache: false
|
||||||
|
cache-key-suffix: lint
|
||||||
- uses: ./.github/actions/download-cache-and-artifacts
|
- uses: ./.github/actions/download-cache-and-artifacts
|
||||||
with:
|
with:
|
||||||
packages: 'dist nxcache node_modules'
|
packages: 'node_modules'
|
||||||
- run: nx affected --target=lint $NX_CALCULATION_FLAGS
|
- run: nx affected --target=lint $NX_CALCULATION_FLAGS
|
||||||
|
|
||||||
#####NOT POSSIBLE AS ALREADY UPDATED BY BUILD-LIBS
|
|
||||||
# - uses: ./.github/actions/upload-cache-and-artifacts
|
|
||||||
# with:
|
|
||||||
# packages: 'nxcache'
|
|
||||||
|
|
||||||
build-libs:
|
build-libs:
|
||||||
# long timeout required when cache has to be recreated
|
# long timeout required when cache has to be recreated
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
@@ -202,16 +201,17 @@ jobs:
|
|||||||
- uses: ./.github/actions/setup
|
- uses: ./.github/actions/setup
|
||||||
with:
|
with:
|
||||||
enable-global-nx-cache: false
|
enable-global-nx-cache: false
|
||||||
enable-global-node-modules-cache: false
|
enable-global-node-modules-cache: true
|
||||||
- uses: ./.github/actions/download-cache-and-artifacts
|
cache-key-suffix: build-libs
|
||||||
with:
|
# - uses: ./.github/actions/download-cache-and-artifacts
|
||||||
packages: 'dist nxcache node_modules'
|
# with:
|
||||||
|
# packages: 'node_modules'
|
||||||
- run: nx affected:build $NX_CALCULATION_FLAGS --prod
|
- run: nx affected:build $NX_CALCULATION_FLAGS --prod
|
||||||
- run: nx build demoshell --configuration production
|
- run: nx build demoshell --configuration production
|
||||||
- run: nx affected --target=build-storybook $NX_CALCULATION_FLAGS --configuration ci
|
- run: nx affected --target=build-storybook $NX_CALCULATION_FLAGS --configuration ci
|
||||||
- uses: ./.github/actions/upload-cache-and-artifacts
|
- uses: ./.github/actions/upload-cache-and-artifacts
|
||||||
with:
|
with:
|
||||||
packages: 'dist nxcache'
|
packages: 'dist'
|
||||||
|
|
||||||
e2e-storybook:
|
e2e-storybook:
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
|||||||
Reference in New Issue
Block a user