Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
11 changes: 11 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Code Quality

on:
pull_request:

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

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

on:
pull_request:

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

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

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

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

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

on:
push:
branches:
- develop

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

test:
uses: ./.github/workflows/jobs/code-quality.yml
needs: lint

build:
uses: ./.github/workflows/jobs/build.yml
needs: test

deploy:
uses: ./.github/workflows/jobs/deploy.yml
needs: build
with:
name: develop
url: https://develop.fueled.com
88 changes: 88 additions & 0 deletions .github/workflows/jobs/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
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: Setup NPM
run: npm install -g npm@latest

- name: Check Node version
run: npm -v

- name: Install Node dependencies
run: npm install

- 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: 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: .

31 changes: 31 additions & 0 deletions .github/workflows/jobs/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
needs: build
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

48 changes: 48 additions & 0 deletions .github/workflows/jobs/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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: Setup NPM
run: npm install -g npm@latest

- name: Check NPM version
run: npm -v

- name: Install dependencies
run: npm install

- name: Run Lint JS
run: npm run lint-js
48 changes: 48 additions & 0 deletions .github/workflows/jobs/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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: Setup NPM
run: npm install -g npm@latest

- name: Check NPM version
run: npm -v

- name: Install dependencies
run: npm install

- name: Run Jest
run: npm run test
54 changes: 54 additions & 0 deletions .github/workflows/jobs/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PHP Coding Standards

on:
workflow_call:

permissions:
contents: read

jobs:
phpcs:
runs-on: ubuntu-latest

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

- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
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: Install Root dependencies
run: composer install --prefer-dist --no-progress

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

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

- name: Run PHPCS
run: composer lint
24 changes: 11 additions & 13 deletions .github/workflows/php.yml → .github/workflows/jobs/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: PHP Checks
name: PHP Static Analysis

on:
push:
branches: ["trunk"]
pull_request:
branches: ["trunk"]
workflow_call:

permissions:
contents: read

jobs:
build:
phpstan:
runs-on: ubuntu-latest

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

- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
Expand All @@ -31,11 +29,14 @@ jobs:
- name: Validate Theme composer.json and composer.lock
run: composer validate --strict --working-dir=themes/10up-theme

- name: Cache Composer packages
- name: Get Composer Cache Directory
id: composer-cache
uses: actions/cache@v3
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: vendor
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
Expand All @@ -49,8 +50,5 @@ jobs:
- name: Install Theme dependencies
run: composer install --prefer-dist --no-progress --working-dir=themes/10up-theme

- name: Run PHPCS
run: composer lint

- name: Run PHPStan
run: composer static
Loading