mirror of https://github.com/FreshRSS/FreshRSS.git
GitHub Actions CI optimisation (#3929)
Efforts to reduce the resources used by CI: * Only one git checkout * Exclusion of irrelevant directories for several commands * Fix some rtlcss warnings * Move some commands from tests.yml to composer.json to make them reusasble * Initial efforts to take avantage of all that from `make` (help welcome)
This commit is contained in:
parent
07e00c7681
commit
9416f45dd9
|
@ -1,3 +1,4 @@
|
|||
*.min.js
|
||||
node_modules/
|
||||
p/scripts/vendor/
|
||||
vendor/
|
||||
|
|
|
@ -8,21 +8,24 @@ on:
|
|||
|
||||
jobs:
|
||||
|
||||
composer:
|
||||
tests:
|
||||
# https://github.com/actions/virtual-environments
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Git checkout source code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Composer tests
|
||||
|
||||
- name: Check PHP syntax
|
||||
run: find . -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null
|
||||
run: composer run-script php-lint
|
||||
|
||||
- name: Check PHTML syntax
|
||||
run: find . -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null
|
||||
run: composer run-script phtml-lint
|
||||
|
||||
- name: Check translations syntax
|
||||
run: cli/manipulate.translation.php -a format && git diff --exit-code
|
||||
run: composer run-script translations && git diff --exit-code
|
||||
|
||||
- name: Use Composer cache
|
||||
id: composer-cache
|
||||
|
@ -33,17 +36,17 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- run: composer install --prefer-dist --no-progress
|
||||
- name: Run Composer install
|
||||
run: composer install --prefer-dist --no-progress
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run PHP tests
|
||||
run: composer run-script test
|
||||
- name: Run PHP unit tests
|
||||
run: composer run-script phpunit
|
||||
|
||||
- name: PHP_CodeSniffer
|
||||
run: composer run-script phpcs
|
||||
|
||||
npm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# NPM tests
|
||||
|
||||
- name: Uses Node.js
|
||||
uses: actions/setup-node@v2
|
||||
|
@ -66,11 +69,7 @@ jobs:
|
|||
- name: Check CSS syntax
|
||||
run: npm run stylelint
|
||||
|
||||
|
||||
shell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# Shell tests
|
||||
|
||||
- name: Use shell cache
|
||||
id: shell-cache
|
||||
|
@ -83,6 +82,7 @@ jobs:
|
|||
run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Setup Go
|
||||
if: steps.shell-cache.outputs.cache-hit != 'true'
|
||||
# Multiple Go versions are pre-installed but the default 1.15 is too old
|
||||
# https://github.com/actions/setup-go
|
||||
uses: actions/setup-go@v2
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
node_modules
|
||||
node_modules/
|
||||
p/scripts/bcrypt.min.js
|
||||
p/scripts/vendor/
|
||||
vendor/
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
node_modules/
|
||||
p/scripts/vendor/
|
||||
vendor/
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
node_modules/
|
||||
p/scripts/vendor/
|
||||
vendor/
|
||||
# ignore SASS-generated CSS
|
||||
p/themes/Ansum/*.css
|
||||
p/themes/Mapco/*.css
|
||||
|
|
33
Makefile
33
Makefile
|
@ -159,7 +159,7 @@ endif
|
|||
###########
|
||||
.PHONY: rtl
|
||||
rtl: ## Generate RTL CSS files
|
||||
rtlcss -d p/themes && find . -type f -name '*.rtl.rtl.css' -delete
|
||||
rtlcss -d p/themes/ && find p/themes/ -type f -name '*.rtl.rtl.css' -delete
|
||||
|
||||
.PHONY: pot
|
||||
pot: ## Generate POT templates for docs
|
||||
|
@ -169,6 +169,37 @@ pot: ## Generate POT templates for docs
|
|||
refresh: ## Refresh feeds by fetching new messages
|
||||
@$(PHP) ./app/actualize_script.php
|
||||
|
||||
###############################
|
||||
## New commands aligned on CI #
|
||||
## Work in progress #
|
||||
###############################
|
||||
|
||||
# TODO: Add composer install
|
||||
.PHONY: composer-test
|
||||
composer-test:
|
||||
composer run-script test
|
||||
|
||||
.PHONY: composer-fix
|
||||
composer-fix:
|
||||
composer run-script fix
|
||||
|
||||
# TODO: Add npm install
|
||||
.PHONY: npm-test
|
||||
npm-test:
|
||||
npm test
|
||||
|
||||
.PHONY: npm-fix
|
||||
npm-fix:
|
||||
npm run fix
|
||||
|
||||
# TODO: Add shellcheck, shfmt, hadolint
|
||||
.PHONY: test-all
|
||||
test-all: composer-test npm-test
|
||||
|
||||
.PHONY: fix-all
|
||||
fix-all: composer-fix npm-fix
|
||||
|
||||
|
||||
##########
|
||||
## HELP ##
|
||||
##########
|
||||
|
|
|
@ -24,14 +24,20 @@
|
|||
"squizlabs/php_codesniffer": "^3.6"
|
||||
},
|
||||
"scripts": {
|
||||
"phpcs": "phpcs . -p -s",
|
||||
"php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
|
||||
"phtml-lint": "find . -type d -name 'vendor' -prune -o -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
|
||||
"phpcs": "phpcs . -s",
|
||||
"phpcbf": "phpcbf . -p -s",
|
||||
"phpunit": "phpunit --bootstrap ./tests/bootstrap.php --verbose ./tests",
|
||||
"translations": "cli/manipulate.translation.php -a format",
|
||||
"test": [
|
||||
"@php-lint",
|
||||
"@phtml-lint",
|
||||
"@phpunit",
|
||||
"@phpcs"
|
||||
],
|
||||
"fix": [
|
||||
"@translations",
|
||||
"@phpcbf"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"eslint_fix": "eslint --fix --ext .js .",
|
||||
"markdownlint": "markdownlint '**/*.md'",
|
||||
"markdownlint_fix": "markdownlint --fix '**/*.md'",
|
||||
"rtlcss": "rtlcss -d p/themes && find . -type f -name '*.rtl.rtl.css' -delete",
|
||||
"rtlcss": "rtlcss -d p/themes/ && find p/themes/ -type f -name '*.rtl.rtl.css' -delete",
|
||||
"stylelint": "stylelint '**/*.css' && stylelint --syntax scss '**/*.scss'",
|
||||
"stylelint_fix": "stylelint --fix '**/*.css' && stylelint --fix --syntax scss '**/*.scss'",
|
||||
"test": "npm run eslint && npm run stylelint && npm run markdownlint",
|
||||
|
@ -41,5 +41,6 @@
|
|||
"stylelint-config-recommended-scss": "^4.3.0",
|
||||
"stylelint-order": "^4.1.0",
|
||||
"stylelint-scss": "^3.21.0"
|
||||
}
|
||||
},
|
||||
"rtlcssConfig": {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue