fix: php version up #100
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
name: Coverage | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
paths: | |
- '**' | |
- '!*.md' | |
pull_request: | |
paths: | |
- '**' | |
- '!*.md' | |
jobs: | |
phpunit: | |
name: PHPUnit | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ 8.3 ] | |
db: [ pgsql ] | |
include: | |
- db: pgsql | |
database_url: postgres://postgres:[email protected]:5432/eccube_db | |
database_server_version: 14 | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
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 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: nanasess/setup-php@master | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Setup pcov | |
run: | | |
sudo apt-fast install -y php8.3-pcov | |
sudo phpenmod -s cli pcov | |
- name: Initialize Composer | |
uses: ./.github/actions/composer | |
- name: Setup EC-CUBE | |
env: | |
APP_ENV: 'test' | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
run: | | |
bin/console doctrine:database:create | |
bin/console doctrine:schema:create | |
bin/console eccube:fixtures:load | |
- name: PHPUnit | |
env: | |
APP_ENV: 'test' | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
MAILER_URL: 'smtp://127.0.0.1:1025' | |
continue-on-error: true | |
run: | | |
echo "session.save_path=$PWD/var/sessions/test" > php.ini | |
echo "memory_limit=512M" >> php.ini | |
php -c php.ini -dpcov.enabled=1 vendor/bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine --coverage-clover=coverage1.xml | |
- name: Upload report | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpunit-reports | |
path: coverage1.xml | |
codeception: | |
name: Codeception | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ 8.3 ] | |
db: [ pgsql ] | |
group: [ admin01, admin02, admin03, front, installer ] | |
include: | |
- db: pgsql | |
database_url: postgres://postgres:[email protected]:5432/eccube_db | |
database_server_version: 14 | |
- group: admin01 | |
app_env: 'codeception' | |
- group: admin02 | |
app_env: 'codeception' | |
- group: admin03 | |
app_env: 'codeception' | |
- group: front | |
app_env: 'codeception' | |
- group: installer | |
app_env: 'install' | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
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: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup PHP | |
uses: nanasess/setup-php@master | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Initialize Composer | |
uses: ./.github/actions/composer | |
- name: Setup to EC-CUBE | |
env: | |
APP_ENV: ${{ matrix.app_env }} | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
MAILER_DSN: 'smtp://127.0.0.1:1025' | |
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' | |
TRUSTED_HOSTS: '127.0.0.1,localhost' | |
run: | | |
echo "APP_ENV=${APP_ENV}" > .env | |
echo "DATABASE_URL=${DATABASE_URL}" >> .env | |
echo "DATABASE_SERVER_VERSION=${DATABASE_SERVER_VERSION}" >> .env | |
echo "MAILER_DSN=${MAILER_DSN}" >> .env | |
echo "ECCUBE_PACKAGE_API_URL=${ECCUBE_PACKAGE_API_URL}" >> .env | |
echo "TRUSTED_HOSTS=${TRUSTED_HOSTS}" >> .env | |
bin/console doctrine:database:create --env=dev | |
bin/console doctrine:schema:create --env=dev | |
bin/console eccube:fixtures:load --env=dev | |
- name: Install fonts | |
run: sudo apt install fonts-ipafont fonts-ipaexfont | |
- name: setup-chromedriver | |
uses: nanasess/setup-chromedriver@master | |
- name: Run chromedriver | |
run: | | |
export DISPLAY=:99 | |
chromedriver --url-base=/wd/hub --port=9515 & | |
echo ">>> Started chrome-driver" | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
echo ">>> Started xvfb" | |
- name: Run package-api | |
run: | | |
if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi | |
docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 | |
for d in $(ls codeception/_data/plugins | grep 1.0.0) | |
do | |
(cd codeception/_data/plugins/$d; tar zcf ../../../../repos/${d}.tgz *) | |
done | |
- name: Setup pcov | |
run: | | |
sudo apt-fast install -y php8.3-pcov | |
sudo phpenmod -s cli pcov | |
- name: Setup codeception | |
run: | | |
composer config --no-plugins allow-plugins.codeception/c3 true | |
composer require --dev codeception/c3 "2.*" | |
sed -i "7a include __DIR__.'/c3.php';" index.php | |
- name: Start PHP Development Server | |
run: php -S 127.0.0.1:8000 codeception/router.php & | |
- name: Codeception | |
env: | |
GROUP: ${{ matrix.group }} | |
SYMFONY_DEPRECATIONS_HELPER: weak | |
continue-on-error: true | |
run: | | |
sed -i "s|%GITHUB_WORKSPACE%|${GITHUB_WORKSPACE}|g" codeception/_envs/github_action.yml | |
php -dpcov.enabled=1 vendor/bin/codecept -vvv run acceptance --env chrome,github_action -g ${GROUP} --skip-group excludeCoverage --coverage --coverage-xml | |
- name: Upload outputs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeception-${{ matrix.group }}-evidence | |
path: codeception/_output/ | |
- name: Upload report | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeception-${{ matrix.group }}-reports | |
path: codeception/_output/**/*.xml | |
- name: Upload logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeception-${{ matrix.group }}-logs | |
path: var/log/ | |
upload: | |
name: Upload coverage reports | |
runs-on: ubuntu-latest | |
needs: [ phpunit, codeception ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: reports | |
- run: | | |
mv reports/codeception-admin01-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.admin01.coverage.xml | |
mv reports/codeception-admin02-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.admin02.coverage.xml | |
mv reports/codeception-admin03-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.admin03.coverage.xml | |
mv reports/codeception-front-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.front.coverage.xml | |
mv reports/codeception-installer-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.installer.coverage.xml | |
- name: Upload unit test coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./reports/phpunit-reports/coverage1.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: Unit | |
fail_ci_if_error: true | |
- name: Upload E2E coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./reports/acceptance.admin01.coverage.xml,./reports/acceptance.admin02.coverage.xml,./reports/acceptance.admin03.coverage.xml,./reports/acceptance.front.coverage.xml,./reports/acceptance.installer.coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: E2E | |
fail_ci_if_error: true |