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
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

name: "Run tests & lint"
run-name: "Lint PHP code and run cs-fixer for validation"

on:
push:

permissions:
contents: read # for checkout

jobs:

bump_release:
name: "PHP lint & code standards"
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

- name: Install composer dependencies
uses: php-actions/composer@v6

- name: Run CS-Fixer
uses: php-actions/composer@v6
with:
command: run cs-fixer-check
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ vendor/
!includes/vendor
dev/
tmp/
node_modules
node_modules/
assets/dist
assets/webfonts
.env

# locker files
composer.lock
package-lock.json
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This is for development purpose only

.ONESHELL:
docker-php-build:
docker build -t wp_basic_btst_php -f - . <<- EOT
FROM php:7.4.33-fpm
RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo "deb http://http.debian.net/debian bullseye-backports contrib non-free main" >> /etc/apt/sources.list \
&& apt update \
&& apt install --no-install-recommends --fix-missing -t bullseye-backports -y wget zip unzip \
&& apt dist-upgrade -y -t bullseye-backports
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.0 && \
chmod +x /usr/local/bin/composer
EOT
.PHONY: docker-php-build

run-php-cs-fixer: docker-php-build
docker run -i --rm \
--name wp_basic_btst \
-v $$(pwd):/wp-basic-bootstrap \
-w /wp-basic-bootstrap \
wp_basic_btst_php bash -s <<- EOT
composer install
composer run cs-fixer
EOT
.PHONY: docker-php-run

docker-php-run: docker-php-build
docker run -ti --rm \
--name wp_basic_btst \
-v $$(pwd):/wp-basic-bootstrap \
-w /wp-basic-bootstrap \
wp_basic_btst_php bash
.PHONY: docker-php-run

docker-npm-run:
docker run -ti --rm \
--name wp_basic_btst \
-v $$(pwd):/wp-basic-bootstrap \
-w /wp-basic-bootstrap \
node:20-bullseye sh
.PHONY: docker-npm-run
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@
"composer/installers": "1.0.*@dev"
},
"require-dev": {
"fabpot/php-cs-fixer": "@stable"
"friendsofphp/php-cs-fixer": "@stable"
},
"scripts": {
"cs-fixer": "/usr/local/bin/php-cs-fixer --config=./.phpcs.php fix"
"cs-fixer": "./vendor/bin/php-cs-fixer --config=./.phpcs.php fix",
"cs-fixer-check": "./vendor/bin/php-cs-fixer --config=./.phpcs.php check"
},
"extra": {
"branch-alias": {
"dev-master": "0.0.*-dev"
}
},
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
Loading