Skip to content

Merge pull request #268 from moderntribe/bugfix/1.0/monorepo-split #627

Merge pull request #268 from moderntribe/bugfix/1.0/monorepo-split

Merge pull request #268 from moderntribe/bugfix/1.0/monorepo-split #627

Workflow file for this run

name: "CI/CD"
on:
push:
branches:
- main
- 1.0-branch
- 2.0-branch
- 'release/**'
pull_request:
types: [opened, synchronize]
env:
E2E_ARTIFACT: e2e-run-${{ github.run_id }}-${{ github.run_number }}
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
build:
name: Build and Install Dependencies
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
composer-files-dir: ${{ steps.composer-cache.outputs.composer-files-dir }}
steps:
- name: Check Out Code
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: false
- name: Setup Node.js Environment
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Setup PHP, with Composer and Extensions
uses: shivammathur/setup-php@v2
with:
tools: composer:v2
php-version: '8.0'
- name: Setup Problem Matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Get Cache Files Directory
id: composer-cache
working-directory: plugins/wme-sitebuilder
run: |
echo "composer-files-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Prepare Node Modules Cache
id: cache-node-modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Prepare Composer Dependencies Cache
uses: actions/cache@v3
with:
path: |
${{ steps.composer-cache.outputs.composer-files-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
lint:
name: Lint JS and PHP
runs-on: ubuntu-latest
needs: build
steps:
- name: Check Out Code
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: false
- name: Setup Node.js Environment
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Setup PHP, with Composer and Extensions
uses: shivammathur/setup-php@v2
with:
tools: composer:v2
php-version: '8.0'
- name: Setup Problem Matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Prepare Node Modules Cache
id: cache-node-modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Prepare Composer Dependencies Cache
uses: actions/cache@v3
with:
path: |
${{needs.build.outputs.composer-files-dir}}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Lint
run: pnpm lint
deploy:
if: ${{ github.ref_name == 'main' || github.ref_name == '1.0-branch' || github.ref_name == '2.0-branch' }}
name: Deploy to Test Sites
needs: [build, lint]
uses: ./.github/workflows/deploy.yml
secrets:
ssh-key: ${{ secrets.SITEBUILDER_SSH_PRIVATE_KEY }}