mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-24 22:35:45 +00:00
chore(ci): more robust linter
* Only run linter if there are changes * Cancel previous running workflow * Cache dependencies
This commit is contained in:
parent
76a84d9e00
commit
429b462d3f
61
.github/workflows/mediawiki.yml
vendored
61
.github/workflows/mediawiki.yml
vendored
|
@ -10,41 +10,90 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test and lint
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4']
|
php-versions: ['7.4']
|
||||||
steps:
|
steps:
|
||||||
|
- name: Cancel Previous Runs
|
||||||
|
uses: styfle/cancel-workflow-action@0.9.1
|
||||||
|
with:
|
||||||
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
|
||||||
|
|
||||||
|
- name: Cache dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /home/runner/cache
|
||||||
|
key: ${{ runner.os }}-${{ hashFiles('**/*.lock') }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer validate
|
composer validate
|
||||||
npm install --save-dev
|
|
||||||
composer install --prefer-dist --no-progress
|
composer install --prefer-dist --no-progress
|
||||||
|
npm install --save-dev
|
||||||
|
|
||||||
|
# Check for changed files
|
||||||
|
- name: Check for PHP changes
|
||||||
|
id: changed-php
|
||||||
|
uses: tj-actions/changed-files@v19
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
includes/**/*.php
|
||||||
|
|
||||||
|
- name: Check for script changes
|
||||||
|
id: changed-script
|
||||||
|
uses: tj-actions/changed-files@v19
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
resources/**/*.js
|
||||||
|
|
||||||
|
- name: Check for stylesheet changes
|
||||||
|
id: changed-stylesheet
|
||||||
|
uses: tj-actions/changed-files@v19
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
resources/**/*.css
|
||||||
|
resources/**/*.less
|
||||||
|
skinStyles/**/*.css
|
||||||
|
skinStyles/**/*.less
|
||||||
|
|
||||||
|
- name: Check for i18n changes
|
||||||
|
id: changed-i18n
|
||||||
|
uses: tj-actions/changed-files@v19
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
i18n/*.json
|
||||||
|
|
||||||
# Bypass the phpcbf non-standard exit code
|
# Bypass the phpcbf non-standard exit code
|
||||||
- name: Check PHP
|
- name: Lint PHP
|
||||||
|
if: steps.changed-php.outputs.any_changed == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
sh ./bin/phpcbf.sh
|
sh ./bin/phpcbf.sh
|
||||||
composer fix
|
composer fix
|
||||||
composer test
|
composer test
|
||||||
|
|
||||||
- name: Check Javascript
|
- name: Lint script
|
||||||
|
if: steps.changed-script.outputs.any_changed == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
npm run lint:fix:js
|
npm run lint:fix:js
|
||||||
npm run lint:js
|
npm run lint:js
|
||||||
|
|
||||||
- name: Check CSS/LESS
|
- name: Lint stylesheet
|
||||||
|
if: steps.changed-stylesheet.outputs.any_changed == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
npm run lint:fix:styles
|
npm run lint:fix:styles
|
||||||
npm run lint:styles
|
npm run lint:styles
|
||||||
|
|
||||||
- name: Check i18n
|
- name: Lint i18n
|
||||||
|
if: steps.changed-i18n.outputs.any_changed == 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
npm run lint:i18n
|
npm run lint:i18n
|
||||||
|
|
Loading…
Reference in a new issue