Ditch Travis to use GitHub Actions

This commit is contained in:
Jeremy Benoist 2020-11-23 22:39:32 +01:00
parent e089c24720
commit 40c01ad1d4
No known key found for this signature in database
GPG Key ID: BCA73962457ACC3C
9 changed files with 242 additions and 78 deletions

View File

@ -15,3 +15,6 @@ indent_size = 2
[*akefile]
indent_style = tab
[.github/**.yml]
indent_size = 2

32
.github/workflows/assets.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: "Assets"
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
js:
name: "Building assets"
runs-on: "ubuntu-20.04"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install Node"
uses: actions/setup-node@v1
with:
node-version: "12"
- name: "Install dependencies with Yarn"
run: "yarn install"
- name: "Build dev assets"
run: "yarn run build:dev"
- name: "Build prod assets"
run: "yarn run build:prod"

55
.github/workflows/coding-standards.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: "CS"
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
coding-standards:
name: "CS Fixer & PHPStan"
runs-on: "ubuntu-16.04"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "7.3"
tools: cs2pr, pecl, composer:v1
extensions: pdo, pdo_mysql, pdo_sqlite, pdo_pgsql, curl, imagick, pgsql, gd, tidy
ini-values: "date.timezone=Europe/Paris"
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php }}-composer-locked-"
- name: "Install dependencies with Composer"
run: "composer install --no-interaction --optimize-autoloader --no-progress --prefer-dist"
- name: "Run PHP CS Fixer"
run: "bin/php-cs-fixer fix --verbose --dry-run --format=checkstyle | cs2pr"
- name: "Generate test cache for PHPStan"
run: "php bin/console cache:clear --env=test"
- name: "Install PHPUnit for PHPStan"
run: "php bin/simple-phpunit install"
- name: "Run PHPStan"
run: "php bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr"

View File

@ -0,0 +1,91 @@
name: "CI"
on:
pull_request:
branches:
- "master"
push:
branches:
- "master"
env:
PGPASSWORD: wallabagrocks
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
phpunit:
name: "PHP ${{ matrix.php }} using ${{ matrix.database }}"
runs-on: "ubuntu-16.04"
services:
rabbitmq:
image: rabbitmq:3-alpine
ports:
- 5672:5672
redis:
image: redis:6-alpine
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
php:
- "7.2"
- "7.3"
- "7.4"
database:
- "sqlite"
- "mysql"
- "pgsql"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
coverage: none
tools: pecl, composer:v1
extensions: json, pdo, pdo_mysql, pdo_sqlite, pdo_pgsql, curl, imagick, pgsql, gd, tidy
ini-values: "date.timezone=Europe/Paris"
- name: "Setup MySQL"
if: "${{ matrix.database == 'mysql' }}"
run: |
sudo systemctl start mysql.service
sudo mysql -u root -proot -e "CREATE DATABASE wallabag_test"
- name: "Setup PostgreSQL"
if: "${{ matrix.database == 'pgsql' }}"
run: |
sudo systemctl start postgresql
sudo -u postgres psql -d template1 -c "CREATE USER wallabag WITH PASSWORD 'wallabagrocks' CREATEDB"
createdb -h localhost -p 5432 -U wallabag wallabag_test
pg_isready -d wallabag_test -h localhost -p 5432 -U wallabag
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer install --no-interaction --optimize-autoloader --no-progress --prefer-dist"
- name: "Prepare database"
run: "make prepare DB=${{ matrix.database }}"
- name: "Prepare fixtures"
run: "make fixtures"
- name: "Run PHPUnit"
run: "php bin/simple-phpunit -v"

57
.github/workflows/translations.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: "Translations"
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
translations:
name: "Translations"
runs-on: "ubuntu-16.04"
strategy:
matrix:
php:
- "7.3"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php }}"
tools: pecl, composer:v1
extensions: pdo, pdo_mysql, pdo_sqlite, pdo_pgsql, curl, imagick, pgsql, gd, tidy
ini-values: "date.timezone=Europe/Paris"
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php }}-composer-locked-"
- name: "Install dependencies with Composer"
run: "composer install --no-interaction --optimize-autoloader --no-progress --prefer-dist"
- name: "Validate Core translations"
run: "php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v"
- name: "Validate CraueConfig translations"
run: "php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v"
- name: "Validate User translations"
run: "php bin/console lint:yaml src/Wallabag/UserBundle/Resources/translations -v"

View File

@ -1,74 +0,0 @@
os: linux
dist: xenial
language: php
services:
- mysql
- postgresql
- rabbitmq
- redis
# cache vendor dirs
cache:
apt: true
directories:
- $HOME/.composer/cache/files
- node_modules
- $HOME/.npm
- $HOME/.yarn-cache
if: |
type = pull_request OR \
branch = master
php:
- 7.2
- 7.3
- 7.4
env:
- DB=mysql
- DB=pgsql
- DB=sqlite
jobs:
fast_finish: true
include:
- php: 7.3
env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite
# exclude v1 branches
branches:
except:
- legacy
before_install:
- if [[ $TRAVIS_REPO_SLUG = wallabag/wallabag ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
- PHP=$TRAVIS_PHP_VERSION
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- phpenv config-rm xdebug.ini || echo "xdebug not available"
# install imagick
- pear config-set preferred_state beta
- pecl channel-update pecl.php.net
- yes | pecl install imagick
install:
- if [[ $ASSETS = build ]]; then source ~/.nvm/nvm.sh && nvm install 12; fi;
- if [[ $ASSETS = build ]]; then npm install -g yarn@latest; fi;
- if [[ $ASSETS = build ]]; then yarn install; fi;
- composer install -o --no-interaction --no-progress --prefer-dist --no-suggest
- php bin/simple-phpunit install
before_script:
- make prepare DB=$DB
- make fixtures
script:
- if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi;
# PHPStan needs PHPUnit to be installed and cache app to be generated
- if [[ $CS_FIXER = run ]]; then php bin/phpstan analyse ; fi;
- if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/UserBundle/Resources/translations -v ; fi;
- if [[ $ASSETS = build ]]; then yarn run build:prod; fi;

View File

@ -1,6 +1,6 @@
<img src="https://raw.githubusercontent.com/wallabag/logo/master/_default/typo-horizontal/png/sm/logo-typo-horizontal-black-no-bg-no-border-sm.png" align="right" />
[![Build Status](https://api.travis-ci.org/wallabag/wallabag.svg?branch=master)](https://travis-ci.org/wallabag/wallabag)
![CI](https://github.com/wallabag/wallabag/workflows/CI/badge.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wallabag/wallabag/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/wallabag/wallabag/?branch=master)
[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/wallabag/wallabag)
[![Donation Status](https://img.shields.io/liberapay/goal/wallabag.svg?logo=liberapay)](https://liberapay.com/wallabag/donate)

View File

@ -4,7 +4,7 @@ parameters:
test_database_port: 3306
test_database_name: wallabag_test
test_database_user: root
test_database_password: ~
test_database_password: root
test_database_path: ~
env(TEST_DATABASE_PATH): ~
test_database_charset: utf8mb4

View File

@ -3,8 +3,8 @@ parameters:
test_database_host: localhost
test_database_port:
test_database_name: wallabag_test
test_database_user: travis
test_database_password: ~
test_database_user: wallabag
test_database_password: wallabagrocks
test_database_path: ~
env(TEST_DATABASE_PATH): ~
test_database_charset: utf8