-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from nanasess/use-coverage
Use coverage
- Loading branch information
Showing
2 changed files
with
150 additions
and
4 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
name: Coverage | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- '*' | ||
paths: | ||
- '**' | ||
- '!*.md' | ||
pull_request: | ||
branches: | ||
- '*' | ||
paths: | ||
- '**' | ||
- '!*.md' | ||
jobs: | ||
phpunit: | ||
name: Run on Linux | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ ubuntu-18.04 ] | ||
php: [ '7.4' ] | ||
db: [ pgsql ] | ||
eccube_version: [ '4.1' ] | ||
plugin_code: [ 'Coupon4' ] | ||
include: | ||
- db: pgsql | ||
dbport: '5432' | ||
dbuser: 'postgres' | ||
dbpass: 'password' | ||
dbname: 'myapp_test' | ||
dbversion: 9.5 | ||
services: | ||
postgres: | ||
image: postgres:9.5 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: ${{ matrix.dbname }} | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
mailcatcher: | ||
image: schickling/mailcatcher | ||
ports: | ||
- 1080:1080 | ||
- 1025:1025 | ||
steps: | ||
- run: sudo apt-get purge -y hhvm | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: nanasess/setup-php@master | ||
with: | ||
php-version: ${{ matrix.php }} | ||
|
||
- name: Archive Plugin | ||
env: | ||
PLUGIN_CODE: ${{ matrix.plugin_code }} | ||
run: | | ||
tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./* | ||
- name: Checkout EC-CUBE | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'EC-CUBE/ec-cube' | ||
ref: ${{ matrix.eccube_version }} | ||
path: 'ec-cube' | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install to composer | ||
working-directory: 'ec-cube' | ||
run: composer install --no-interaction -o --apcu-autoloader | ||
|
||
- name: Setup EC-CUBE | ||
env: | ||
DB: ${{ matrix.db }} | ||
USER: ${{ matrix.dbuser }} | ||
DBUSER: ${{ matrix.dbuser }} | ||
DBPASS: ${{ matrix.dbpass }} | ||
DBNAME: ${{ matrix.dbname }} | ||
DBPORT: ${{ matrix.dbport }} | ||
DBSERVER: 127.0.0.1 | ||
DBVERSION: ${{ matrix.dbversion }} | ||
ROOT_URLPATH: /ec-cube/html | ||
working-directory: 'ec-cube' | ||
run: | | ||
export PGPASSWORD=${DBPASS} | ||
echo "APP_ENV=prod" > .env | ||
echo "APP_DEBUG=0" >> .env | ||
echo "DATABASE_URL=${DB}://${DBUSER}:${DBPASS}@${DBSERVER}/${DBNAME}" >> .env | ||
echo "DATABASE_SERVER_VERSION=${DBVERSION}" >> .env | ||
echo "MAILER_URL=null://localhost" >> .env | ||
echo "HTTP_SITEURL=https://localhost" >> .env | ||
echo "USE_SELFSIGNED_SSL_CERTIFICATE=1" >> .env | ||
cat .env | ||
bin/console doctrine:schema:create | ||
bin/console eccube:fixtures:load | ||
- name: Setup Plugin | ||
env: | ||
PLUGIN_CODE: ${{ matrix.plugin_code }} | ||
working-directory: 'ec-cube' | ||
run: | | ||
bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz | ||
bin/console eccube:plugin:enable --code=${PLUGIN_CODE} | ||
rm codeception/_support/*Tester.php | ||
- name: Run PHPUnit | ||
env: | ||
PLUGIN_CODE: ${{ matrix.plugin_code }} | ||
working-directory: 'ec-cube' | ||
run: phpdbg -dmemory_limit=-1 -qrr bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests --coverage-clover=coverage1.xml | ||
- name: Upload report | ||
if: success() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: phpunit-reports | ||
path: ec-cube/coverage1.xml | ||
upload: | ||
name: Upload coverage reports | ||
runs-on: ubuntu-latest | ||
needs: [ phpunit ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: reports | ||
- name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
files: ./reports/phpunit-reports/coverage1.xml | ||
flags: tests | ||
fail_ci_if_error: true |