Add composite install and build action

This commit is contained in:
roykho 2022-05-17 06:20:23 -07:00
parent e8740f8b73
commit 73ba1e591f
No known key found for this signature in database
GPG Key ID: 00D6C128DC6E0F71
2 changed files with 48 additions and 29 deletions

View File

@ -0,0 +1,39 @@
name: Install and Build (Composite)
description: Installs and builds WooCommerce.
inputs:
workflow_cache:
required: true
description: The workflow cache key.
workflow_name:
required: true
description: The name of the workflow.
runs:
using: "composite"
steps:
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-${{ inputs.workflow_name }}-${{ inputs.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-no-dev woocommerce
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
run: pnpm nx build woocommerce

View File

@ -1,5 +1,8 @@
name: Run tests against PR
on: pull_request
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@ -9,35 +12,12 @@ jobs:
name: Runs E2E tests.
runs-on: ubuntu-20.04
steps:
- name: Checkout code.
uses: actions/checkout@v3
- name: Dependency caching
uses: actions/cache@v3
id: cache-deps
- uses: actions/checkout@v3
- name: Install and Build
uses: ./.github/actions/install-build
with:
path: |
~/.pnpm-store
~/.local/share/pnpm/store
~/.cache/composer/files
key: ${{ runner.os }}-pr-build-and-e2e-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-no-dev woocommerce
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Run build
run: pnpm nx build woocommerce
workflow_name: pr-build-and-e2e-tests
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Load docker images and start containers.
working-directory: plugins/woocommerce