A free, self-hostable news aggregator…
GitHub Actions CI optimisation (#3929)
Alexandre Alapetite9416f45dd917
diff --git a/.eslintignore b/.eslintignoreindex 4af5f2ccf..a3264ebd0 100644--- a/.eslintignore+++ b/.eslintignore@@ -1,3 +1,4 @@*.min.jsnode_modules/p/scripts/vendor/+vendor/diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex daa91465d..25295ebd1 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -8,21 +8,24 @@ on:jobs:- composer:+ tests:# https://github.com/actions/virtual-environmentsruns-on: ubuntu-lateststeps:- - 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 cacheid: 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-progressif: 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.jsuses: actions/setup-node@v2@@ -66,11 +69,7 @@ jobs:- name: Check CSS syntaxrun: npm run stylelint-- shell:- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v2+ # Shell tests- name: Use shell cacheid: 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-gouses: actions/setup-go@v2diff --git a/.jshintignore b/.jshintignoreindex b8a497857..21b0fd2eb 100644--- a/.jshintignore+++ b/.jshintignore@@ -1,3 +1,4 @@-node_modules+node_modules/p/scripts/bcrypt.min.jsp/scripts/vendor/+vendor/diff --git a/.markdownlintignore b/.markdownlintignoreindex c2658d7d1..771399b60 100644--- a/.markdownlintignore+++ b/.markdownlintignore@@ -1 +1,3 @@node_modules/+p/scripts/vendor/+vendor/diff --git a/.stylelintignore b/.stylelintignoreindex 402ba0702..56613503b 100644--- a/.stylelintignore+++ b/.stylelintignore@@ -1,3 +1,6 @@+node_modules/+p/scripts/vendor/+vendor/# ignore SASS-generated CSSp/themes/Ansum/*.cssp/themes/Mapco/*.cssdiff --git a/Makefile b/Makefileindex 72352ff42..adf30cad1 100644--- a/Makefile+++ b/Makefile@@ -159,7 +159,7 @@ endif###########.PHONY: rtlrtl: ## 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: potpot: ## Generate POT templates for docs@@ -169,6 +169,37 @@ pot: ## Generate POT templates for docsrefresh: ## 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 ############diff --git a/composer.json b/composer.jsonindex c39915caf..5590b24cf 100644--- a/composer.json+++ b/composer.json@@ -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"]}diff --git a/package.json b/package.jsonindex 8a25eb278..35884d900 100644--- a/package.json+++ b/package.json@@ -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": {}}