2022-09-13 01:55:03 +00:00
|
|
|
name: Setup WooCommerce Monorepo
|
|
|
|
description: Handles the installation, building, and caching of the projects within the monorepo.
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
install-filters:
|
|
|
|
description: The PNPM filter used to decide what projects to install. Supports multiline strings for multiple filters.
|
|
|
|
default: ""
|
|
|
|
build:
|
|
|
|
description: Indicates whether or not the action should build any projects.
|
|
|
|
default: "true"
|
|
|
|
build-filters:
|
|
|
|
description: The PNPM filter used to decide what projects to build. Supports multiline strings for multiple filters.
|
|
|
|
default: ""
|
|
|
|
php-version:
|
|
|
|
description: The version of PHP that the action should set up.
|
2022-10-11 19:55:36 +00:00
|
|
|
default: "7.4"
|
2022-09-13 01:55:03 +00:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- name: Parse Action Input
|
|
|
|
id: parse-input
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=INSTALL_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')"
|
|
|
|
echo "::set-output name=BUILD_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')"
|
|
|
|
|
|
|
|
- name: Setup PNPM
|
|
|
|
uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d
|
|
|
|
with:
|
2022-10-10 03:59:51 +00:00
|
|
|
version: "^7.13.3"
|
2022-09-13 01:55:03 +00:00
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
|
|
|
|
with:
|
|
|
|
node-version-file: .nvmrc
|
|
|
|
cache: pnpm
|
2022-10-21 02:14:10 +00:00
|
|
|
registry-url: 'https://registry.npmjs.org'
|
2022-09-13 01:55:03 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709
|
|
|
|
with:
|
|
|
|
php-version: ${{ inputs.php-version }}
|
|
|
|
coverage: none
|
2022-10-31 18:53:01 +00:00
|
|
|
tools: phpcs, sirbrillig/phpcs-changed
|
2022-09-13 01:55:03 +00:00
|
|
|
|
|
|
|
- name: Cache Composer Dependencies
|
|
|
|
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
|
|
|
with:
|
|
|
|
path: ~/.cache/composer/files
|
|
|
|
key: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-
|
|
|
|
|
|
|
|
- name: Install Node and PHP Dependencies
|
|
|
|
shell: bash
|
2022-09-15 21:21:42 +00:00
|
|
|
run: |
|
|
|
|
pnpm -w install turbo
|
|
|
|
pnpm install ${{ steps.parse-input.outputs.INSTALL_FILTERS }}
|
2022-09-13 01:55:03 +00:00
|
|
|
|
|
|
|
- name: Cache Build Output
|
|
|
|
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
|
|
|
with:
|
|
|
|
path: node_modules/.cache/turbo
|
|
|
|
key: ${{ runner.os }}-build-output-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
|
|
|
|
restore-keys: ${{ runner.os }}-build-output-
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: ${{ inputs.build == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: pnpm -w exec turbo run turbo:build ${{ steps.parse-input.outputs.BUILD_FILTERS }}
|