Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build

on:
workflow_call:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"

- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Check Node version
run: node -v

- name: Check Node version
run: npm -v

- name: Install Node dependencies
run: npm ci

- name: Build JavaScript
run: npm run build

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
coverage: none
tools: composer:v2

- name: Validate Root composer.json and composer.lock
run: composer validate --strict

- name: Validate Plugin composer.json and composer.lock
run: composer validate --strict --working-dir=mu-plugins/10up-plugin

- name: Validate Theme composer.json and composer.lock
run: composer validate --strict --working-dir=themes/10up-theme

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> ${GITHUB_OUTPUT}

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: PHP Version
run: php -v

- name: Install Root dependencies
run: composer install --no-dev --prefer-dist --no-progress

- name: Install Plugin dependencies
run: composer install --no-dev --prefer-dist --no-progress --working-dir=mu-plugins/10up-plugin

- name: Install Theme dependencies
run: composer install --no-dev --prefer-dist --no-progress --working-dir=themes/10up-theme

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}-payload
retention-days: 7
include-hidden-files: true
path: .

18 changes: 18 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Code Quality

on:
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
trufflehog:
uses: ./.github/workflows/truffle-hog.yml

virus-scan:
uses: ./.github/workflows/virus-scan.yml
27 changes: 27 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Coding Standards

on:
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
stylelint:
uses: ./.github/workflows/stylelint.yml

eslint:
uses: ./.github/workflows/eslint.yml

jest:
uses: ./.github/workflows/jest.yml

phpcs:
uses: ./.github/workflows/phpcs.yml

phpstan:
uses: ./.github/workflows/phpstan.yml
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy

on:
workflow_call:
inputs:
name:
required: true
type: string
url:
required: true
type: string

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest

environment:
name: ${{ inputs.name }}
url: ${{ inputs.url }}

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.name }}-payload

# TODO: Implement deployment

32 changes: 32 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to Develop

on:
push:
branches:
- develop

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
uses: ./.github/workflows/coding-standards.yml

test:
Comment thread Fixed
uses: ./.github/workflows/code-quality.yml
needs: lint

build:
Comment thread Fixed
uses: ./.github/workflows/build.yml
needs: test

deploy:
uses: ./.github/workflows/deploy.yml
needs: build
with:
name: develop
url: https://develop.example.com
45 changes: 45 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: JavaScript Coding Standards

on:
workflow_call:

permissions:
contents: read

jobs:
eslint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"

- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Check Node version
run: node -v

- name: Check NPM version
run: npm -v

- name: Install dependencies
run: npm ci

- name: Run Lint JS
run: npm run lint-js
45 changes: 45 additions & 0 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: JavaScript Unit Tests

on:
workflow_call:

permissions:
contents: read

jobs:
jest:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"

- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Check Node version
run: node -v

- name: Check NPM version
run: npm -v

- name: Install dependencies
run: npm ci

- name: Run Jest
run: npm run test
80 changes: 0 additions & 80 deletions .github/workflows/node.yml

This file was deleted.

Loading