Migrate from Travis to Github Actions (#1517)

This commit is contained in:
Ismail El Korchi 2022-01-01 22:03:33 +01:00 committed by GitHub
parent 56a8114f28
commit d6ccb97e0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 71 deletions

23
.github/workflows/lint-css.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: CSS Code Linting
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
lint-css:
name: Lint CSS
runs-on: ubuntu-latest
steps:
- name: Checkout the git repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
- name: npm install
run: npm install
- name: Lint CSS
run: npm run lint:scss

23
.github/workflows/lint-js.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: JS Code Linting
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
lint-js:
name: Lint JS
runs-on: ubuntu-latest
steps:
- name: Checkout the git repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
- name: npm install
run: npm install
- name: Lint JS
run: npm run lint:js

42
.github/workflows/lint-php.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: PHP Code Linting
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
lint-php:
name: Parallel lint
runs-on: ubuntu-latest
steps:
- name: Checkout the git repository
uses: actions/checkout@v2
- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Install composer packages
run: composer install --no-progress
- name: Check for PHP errors
run: composer lint:php
phpcs_check:
name: PHPCS check
runs-on: ubuntu-latest
steps:
- name: Checkout the git repository
uses: actions/checkout@v2
- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Install composer packages
run: composer install --no-progress
- name: Check coding standards using PHPCS
run: composer lint:wpcs

View file

@ -1,71 +0,0 @@
# Travis CI (MIT License) configuration file for the Underscores WordPress theme.
# @link https://travis-ci.org/
# For use with the Underscores WordPress theme.
# @link https://github.com/Automattic/_s
# Tell Travis CI which OS and which distro to use.
os: linux
dist: xenial
# Cache directories between builds.
# @link https://docs.travis-ci.com/user/caching/#arbitrary-directories
cache:
directories:
# Cache directory for npm.
- $HOME/.npm
# Cache directory for older Composer versions.
- $HOME/.composer/cache/files
# Cache directory for more recent Composer versions.
- $HOME/.cache/composer/files
# Declare project language.
# @link https://docs.travis-ci.com/user/languages/php/
language:
- php
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
jobs:
fast_finish: true
include:
- php: 7.4
env: SNIFF=1
before_install:
# Speed up build time by disabling Xdebug.
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
# Download and install the latest long-term support release of node.
- if [[ "$SNIFF" == 1 ]]; then nvm install --lts; fi
# Install Composer dependencies.
- composer install
# Install NPM dependencies.
- if [[ "$SNIFF" == 1 ]]; then npm install; fi
script:
# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- composer validate --no-check-all --strict
# Search for PHP syntax errors using PHP Parallel Lint.
# @link https://github.com/php-parallel-lint/PHP-Parallel-Lint
- composer lint:php
# Check the PHP files with the coding standards documented in the phpcs.xml.dist file.
- if [[ "$SNIFF" == 1 ]]; then composer lint:wpcs; fi
# Check the JS files with the lint-js script defined in the @wordpress/scripts package.
- if [[ "$SNIFF" == 1 ]]; then npm run lint:js; fi
# Check the SCSS files with the lint-style script defined in the @wordpress/scripts package.
- if [[ "$SNIFF" == 1 ]]; then npm run lint:scss; fi
# Receive notifications for build results.
# @link https://docs.travis-ci.com/user/notifications/#configuring-email-notifications
notifications:
email: false