Extract cache and build to rest of workflows

This commit is contained in:
roykho 2022-05-17 11:48:24 -07:00
parent f4cf7899e7
commit 1042f22cf8
No known key found for this signature in database
GPG Key ID: 00D6C128DC6E0F71
14 changed files with 117 additions and 258 deletions

View File

@ -16,11 +16,6 @@ runs:
shell: bash
run: pnpm nx composer-install-no-dev woocommerce
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
shell: bash
run: pnpm nx build woocommerce

View File

@ -11,18 +11,12 @@ jobs:
name: Build release zip file
runs-on: ubuntu-20.04
steps:
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-build-release-zip-file-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: build-release-zip-file
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2

View File

@ -8,12 +8,19 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install and Build
uses: ./.github/actions/install-build
- uses: ./.github/actions/cache-deps
with:
workflow_name: build-releases
workflow_name: build-release
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Build zip
working-directory: plugins/woocommerce
run: bash bin/build-zip.sh

View File

@ -4,6 +4,8 @@ on:
branches:
- trunk
- 'release/**'
workflow_dispatch:
defaults:
run:
shell: bash
@ -37,8 +39,12 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: ./.github/actions/cache-deps
with:
workflow_name: ci
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
@ -53,24 +59,8 @@ jobs:
php --version
composer --version
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-ci-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Build Admin feature config
run: pnpm nx build:feature-config woocommerce

View File

@ -8,18 +8,12 @@ jobs:
name: Build WooCommerce zip
runs-on: ubuntu-20.04
steps:
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-mirrors-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: mirrors
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2

View File

@ -12,20 +12,14 @@ jobs:
build: [trunk]
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: ${{ matrix.build }}
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-nightly-builds-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: nightly-builds
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2

View File

@ -18,6 +18,11 @@ jobs:
workflow_name: pr-build-and-e2e-tests
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install and Build
uses: ./.github/actions/install-build
@ -54,6 +59,11 @@ jobs:
workflow_name: pr-build-and-e2e-tests
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install and Build
uses: ./.github/actions/install-build
@ -89,6 +99,11 @@ jobs:
workflow_name: pr-build-and-e2e-tests
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install and Build
uses: ./.github/actions/install-build

View File

@ -21,8 +21,7 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 100
@ -39,24 +38,13 @@ jobs:
php --version
composer --version
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-pr-code-coverage-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: pr-code-coverage
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Build Admin feature config
run: |

View File

@ -13,8 +13,7 @@ jobs:
timeout-minutes: 15
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 100
@ -29,24 +28,13 @@ jobs:
php --version
composer --version
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-pr-code-sniff-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: pr-code-sniff
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Run code sniff
continue-on-error: true

View File

@ -15,28 +15,24 @@ jobs:
name: Lint and Test JS
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-pr-lint-test-js-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: pr-lint-test-js
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install dependencies
run: pnpm install
- name: Install and Build
uses: ./.github/actions/install-build
- name: Lint
run: |

View File

@ -15,38 +15,23 @@ jobs:
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
runs-on: ubuntu-20.04
steps:
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-pr-smoke-test-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
workflow_name: pr-smoke-test
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install Jest
run: pnpm install -g jest
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install-no-dev woocommerce
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
run: pnpm nx build woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Run smoke test.
working-directory: plugins/woocommerce

View File

@ -35,8 +35,12 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: ./.github/actions/cache-deps
with:
workflow_name: pr-unit-tests
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
@ -51,24 +55,8 @@ jobs:
php --version
composer --version
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-pr-unit-tests-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Build Admin feature config
run: |

View File

@ -12,40 +12,25 @@ jobs:
env:
API_TEST_REPORT_DIR: ${{ github.workspace }}/api-test-report
steps:
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: trunk
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-smoke-test-daily-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
workflow_name: smoke-test-daily
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install Jest
run: pnpm install -g jest
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install-no-dev woocommerce
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
run: pnpm nx build woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Run smoke test.
working-directory: plugins/woocommerce
@ -86,18 +71,12 @@ jobs:
name: Build zip for PR
runs-on: ubuntu-20.04
steps:
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-smoke-test-daily-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: smoke-test-daily
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
@ -150,36 +129,23 @@ jobs:
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
path: package/woocommerce
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-smoke-test-daily-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
working-directory: package/woocommerce
run: pnpm install
workflow_name: smoke-test-daily
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
- name: Install and Build
working-directory: package/woocommerce
run: pnpm nx build woocommerce
uses: ./.github/actions/install-build
- name: Download WooCommerce ZIP.
uses: actions/download-artifact@v3

View File

@ -10,40 +10,25 @@ jobs:
name: Daily smoke test on release.
runs-on: ubuntu-20.04
steps:
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
ref: trunk
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-smoke-test-release-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
workflow_name: smoke-test-release
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install Jest
run: pnpm install -g jest
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
run: pnpm nx composer-install-no-dev woocommerce
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
run: pnpm nx build woocommerce
- name: Install and Build
uses: ./.github/actions/install-build
- name: Run smoke test.
working-directory: plugins/woocommerce
@ -81,20 +66,14 @@ jobs:
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
path: package/woocommerce
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-smoke-test-release-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: smoke-test-release
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Fetch Asset ID
id: fetch_asset_id
@ -108,21 +87,14 @@ jobs:
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
await script({github, context, core})
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
working-directory: package/woocommerce
run: pnpm install
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
- name: Install and Build
working-directory: package/woocommerce
run: pnpm nx build woocommerce
uses: ./.github/actions/install-build
- name: Download WooCommerce release zip
working-directory: tmp
@ -172,20 +144,14 @@ jobs:
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
- name: Checkout code.
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
path: package/woocommerce
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: ./.github/actions/cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-smoke-test-release-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
workflow_name: smoke-test-release
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Fetch Asset ID
id: fetch_asset_id
@ -199,21 +165,14 @@ jobs:
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
await script({github, context, core})
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
working-directory: package/woocommerce
run: pnpm install
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
- name: Install and Build
working-directory: package/woocommerce
run: pnpm nx build woocommerce
uses: ./.github/actions/install-build
- name: Download WooCommerce release zip
working-directory: tmp