2020-06-17 02:49:41 +00:00
|
|
|
name: MediaWiki CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2021-01-06 23:51:13 +00:00
|
|
|
name: Test and lint
|
2020-06-17 02:49:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-06 00:24:52 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-versions: ['7.4']
|
2020-06-17 02:49:41 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
composer validate
|
|
|
|
npm install --save-dev
|
2021-01-06 00:40:58 +00:00
|
|
|
composer install --prefer-dist --no-progress
|
2020-06-17 02:49:41 +00:00
|
|
|
|
|
|
|
# Bypass the phpcbf non-standard exit code
|
|
|
|
- name: Check PHP
|
|
|
|
run: |
|
|
|
|
sh ./bin/phpcbf.sh
|
|
|
|
composer fix
|
|
|
|
composer test
|
|
|
|
|
|
|
|
- name: Check Javascript
|
|
|
|
run: |
|
|
|
|
npm run lint:fix:js
|
|
|
|
npm run lint:js
|
|
|
|
|
|
|
|
- name: Check CSS/LESS
|
|
|
|
run: |
|
|
|
|
npm run lint:fix:styles
|
|
|
|
npm run lint:styles
|
|
|
|
|
|
|
|
- name: Check i18n
|
|
|
|
run: |
|
|
|
|
npm run lint:i18n
|
|
|
|
|
|
|
|
# Only patch code when it is a push event
|
|
|
|
- name: Push the changes
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
git config --global user.name "github-actions"
|
|
|
|
git config --global user.email "github-actions@users.noreply.github.com"
|
|
|
|
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
|
|
|
git add .
|
2021-01-06 23:51:13 +00:00
|
|
|
git commit -am "ci: lint code to MediaWiki standards" -m "Check commit and GitHub actions for more details" || echo "No changes to commit"
|
2020-06-17 03:21:22 +00:00
|
|
|
git pull --rebase
|
2020-06-17 02:49:41 +00:00
|
|
|
git push
|