mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-16 12:24:46 -04:00
GitHub Action automatic tests (#3920)
* PHP lint + phpunit + Manipulate translations + phpcs * eslint + markdownlint + rtlcss + stylelint * shellcheck + shfmt + hadolint
This commit is contained in:
committed by
GitHub
parent
da4f0dea1f
commit
9ca49408e0
@@ -1,6 +1,6 @@
|
||||
**/.git/
|
||||
**/bin/
|
||||
**/data/
|
||||
**/docs/
|
||||
**/node_modules/
|
||||
**/package*.json
|
||||
/.git/
|
||||
/bin/
|
||||
/data/
|
||||
/docs/
|
||||
/node_modules/
|
||||
/vendor/
|
||||
|
||||
105
.github/workflows/tests.yml
vendored
Normal file
105
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
name: Automated tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ edge ]
|
||||
pull_request:
|
||||
branches: [ edge ]
|
||||
|
||||
jobs:
|
||||
|
||||
composer:
|
||||
# https://github.com/actions/virtual-environments
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Check PHP syntax
|
||||
run: find . -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null
|
||||
|
||||
- name: Check PHTML syntax
|
||||
run: find . -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null
|
||||
|
||||
- name: Check translations syntax
|
||||
run: cli/manipulate.translation.php -a format && git diff --exit-code
|
||||
|
||||
- name: Use Composer cache
|
||||
id: composer-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- run: composer install --prefer-dist --no-progress
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run PHP tests
|
||||
run: composer run-script test
|
||||
|
||||
|
||||
npm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Uses Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
# https://nodejs.org/en/about/releases/
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
|
||||
- run: npm install
|
||||
|
||||
- name: Check JavaScript syntax
|
||||
run: npm run eslint
|
||||
|
||||
- name: Check Markdown syntax
|
||||
run: npm run markdownlint
|
||||
|
||||
- name: Check Right-to-left CSS
|
||||
run: npm run rtlcss && git diff --exit-code
|
||||
|
||||
- name: Check CSS syntax
|
||||
run: npm run stylelint
|
||||
|
||||
|
||||
shell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use shell cache
|
||||
id: shell-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin
|
||||
key: ${{ runner.os }}-bin-shfmt@v3.4.0c-hadolint@v2.7.0
|
||||
|
||||
- name: Add ./bin/ to $PATH
|
||||
run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Setup Go
|
||||
# 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
|
||||
with:
|
||||
go-version: '1.17'
|
||||
|
||||
- name: Install shfmt
|
||||
if: steps.shell-cache.outputs.cache-hit != 'true'
|
||||
run: GOBIN=${PWD}/bin/ go install mvdan.cc/sh/v3/cmd/shfmt@v3.4.0
|
||||
|
||||
- name: Check shell script syntax
|
||||
# shellcheck is pre-installed https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
|
||||
run: ./tests/shellchecks.sh
|
||||
|
||||
- name: Install hadolint
|
||||
if: steps.shell-cache.outputs.cache-hit != 'true'
|
||||
run: curl -sL -o ./bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v2.7.0/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ./bin/hadolint
|
||||
|
||||
- name: Check Dockerfile syntax
|
||||
run: find . -name 'Dockerfile*' -print0 | xargs -0 -n1 ./bin/hadolint --failure-threshold warning
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
/bin
|
||||
/node_modules
|
||||
package-lock.json
|
||||
constants.local.php
|
||||
/bin/
|
||||
/node_modules/
|
||||
/vendor/
|
||||
/constants.local.php
|
||||
|
||||
# Temp files
|
||||
*~
|
||||
|
||||
53
.travis.yml
53
.travis.yml
@@ -1,53 +0,0 @@
|
||||
language: php
|
||||
|
||||
jobs:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- name: "Translations"
|
||||
|
||||
include:
|
||||
- name: "PHP 8.0 Syntax, linter and tests"
|
||||
php: "8.0"
|
||||
install:
|
||||
- composer global require squizlabs/php_codesniffer
|
||||
- composer global require phpunit/phpunit ^9
|
||||
script:
|
||||
- phpenv rehash
|
||||
- find . -name \*.php -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null 2>php-l-results
|
||||
- if [ -s php-l-results ]; then cat php-l-results; exit 1; fi
|
||||
- COMPOSER_BIN=$(composer global config --absolute bin-dir)
|
||||
- $COMPOSER_BIN/phpunit --bootstrap ./tests/bootstrap.php --verbose ./tests
|
||||
- $COMPOSER_BIN/phpcs . -p -s
|
||||
- name: "PHP 7.0 Syntax"
|
||||
php: "7.0"
|
||||
script:
|
||||
- phpenv rehash
|
||||
- find . -name \*.php -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null 2>php-l-results
|
||||
- if [ -s php-l-results ]; then cat php-l-results; exit 1; fi
|
||||
|
||||
- name: "Translations format"
|
||||
php: "7.4"
|
||||
script:
|
||||
- phpenv rehash
|
||||
- php cli/manipulate.translation.php -a format
|
||||
- git diff --exit-code
|
||||
|
||||
- name: "Translations"
|
||||
php: "7.4"
|
||||
script:
|
||||
- phpenv rehash
|
||||
- php cli/check.translation.php -r
|
||||
|
||||
- name: "Linter JS, CSS, SCSS, Shell and Docker"
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
env:
|
||||
- HADOLINT="$HOME/hadolint"
|
||||
install:
|
||||
- npm install
|
||||
- curl -sL -o ${HADOLINT} "https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ${HADOLINT}
|
||||
script:
|
||||
- npm test
|
||||
- bash tests/shellchecks.sh
|
||||
- git ls-files --exclude='*Dockerfile*' --ignored | xargs --max-lines=1 "$HADOLINT"
|
||||
38
composer.json
Normal file
38
composer.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "freshrss.org/freshrss",
|
||||
"description": "A free, self-hostable aggregator",
|
||||
"type": "project",
|
||||
"homepage": "https://freshrss.org/",
|
||||
"license": "AGPL-3.0",
|
||||
"support": {
|
||||
"docs": "https://freshrss.github.io/FreshRSS/",
|
||||
"issues": "https://github.com/FreshRSS/FreshRSS/issues",
|
||||
"source": "https://github.com/FreshRSS/FreshRSS/"
|
||||
},
|
||||
"keywords": [
|
||||
"news",
|
||||
"aggregator",
|
||||
"RSS",
|
||||
"Atom",
|
||||
"WebSub"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9",
|
||||
"squizlabs/php_codesniffer": "^3.6"
|
||||
},
|
||||
"scripts": {
|
||||
"phpcs": "phpcs . -p -s",
|
||||
"phpcbf": "phpcbf . -p -s",
|
||||
"phpunit": "phpunit --bootstrap ./tests/bootstrap.php --verbose ./tests",
|
||||
"test": [
|
||||
"@phpunit",
|
||||
"@phpcs"
|
||||
],
|
||||
"fix": [
|
||||
"@phpcbf"
|
||||
]
|
||||
}
|
||||
}
|
||||
2169
composer.lock
generated
Normal file
2169
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
3775
package-lock.json
generated
Normal file
3775
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -32,9 +32,9 @@
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-standard": "^16.0.3",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"markdownlint-cli": "^0.29.0",
|
||||
"rtlcss": "^3.4.0",
|
||||
"stylelint": "^13.13.1",
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<exclude-pattern>./data/users/*/config.php</exclude-pattern>
|
||||
<exclude-pattern>./extensions/</exclude-pattern>
|
||||
<exclude-pattern>./p/scripts/vendor/</exclude-pattern>
|
||||
<exclude-pattern>./vendor/</exclude-pattern>
|
||||
<exclude-pattern>*.min.js$</exclude-pattern>
|
||||
<!-- Duplicate class names are not allowed -->
|
||||
<rule ref="Generic.Classes.DuplicateClassName"/>
|
||||
|
||||
Reference in New Issue
Block a user