Merge pull request #159 from sai-gillingham/feature/logout_remove_tokens #143
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: CI for Api | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
paths: | |
- '**' | |
- '!*.md' | |
pull_request: | |
branches: | |
- '*' | |
paths: | |
- '**' | |
- '!*.md' | |
jobs: | |
run-on-linux: | |
name: Run on Linux | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-20.04 ] | |
php: [ '8.1' ] | |
db: [ 'mysql', 'mysql8', 'pgsql' ] | |
eccube_version: [ 'main' ] | |
plugin_code: [ 'Api42' ] | |
include: | |
- db: mysql | |
database_url: mysql://root:[email protected]:3306/eccube_db | |
database_server_version: 5.7 | |
database_charset: utf8mb4 | |
- db: mysql8 | |
database_url: mysql://root:[email protected]:3308/eccube_db | |
database_server_version: 8 | |
database_charset: utf8mb4 | |
- db: pgsql | |
database_url: postgres://postgres:[email protected]:5432/eccube_db | |
database_server_version: 14 | |
database_charset: utf8 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: ${{ matrix.dbname }} | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
mysql8: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: ${{ matrix.dbname }} | |
ports: | |
- 3308:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
postgres: | |
image: postgres:14 | |
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: Setup mock-package-api | |
env: | |
PLUGIN_CODE: ${{ matrix.plugin_code }} | |
run: | | |
mkdir -p /tmp/repos | |
cp ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz /tmp/repos/${PLUGIN_CODE}.tgz | |
docker run --name package-api -d -v /tmp/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 | |
- name: Checkout EC-CUBE | |
uses: actions/checkout@v2 | |
with: | |
repository: 'EC-CUBE/next-poc' | |
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: | |
APP_ENV: 'test' | |
APP_DEBUG: 0 | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' | |
USE_SELFSIGNED_SSL_CERTIFICATE: '1' | |
working-directory: 'ec-cube' | |
run: | | |
bin/console doctrine:database:create | |
bin/console doctrine:schema:create | |
bin/console eccube:fixtures:load | |
- name: Setup Plugin | |
env: | |
APP_ENV: 'test' | |
APP_DEBUG: 0 | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
PLUGIN_CODE: ${{ matrix.plugin_code }} | |
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' | |
USE_SELFSIGNED_SSL_CERTIFICATE: '1' | |
working-directory: 'ec-cube' | |
run: | | |
bin/console doctrine:query:sql "update dtb_base_info set authentication_key='dummy'" | |
bin/console eccube:composer:require ec-cube/api42 | |
bin/console eccube:plugin:enable --code=${PLUGIN_CODE} | |
bin/console doctrine:schema:update --force --dump-sql | |
bin/console cache:clear --no-warmup | |
rm codeception/_support/*Tester.php | |
chmod 600 app/PluginData/Api42/oauth/private.key | |
- name: Run PHPUnit | |
env: | |
APP_ENV: 'test' | |
APP_DEBUG: 0 | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
PLUGIN_CODE: ${{ matrix.plugin_code }} | |
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' | |
USE_SELFSIGNED_SSL_CERTIFICATE: '1' | |
working-directory: 'ec-cube' | |
run: | | |
bin/console cache:clear --no-warmup | |
bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests | |
- name: Disable Plugin | |
working-directory: 'ec-cube' | |
env: | |
APP_ENV: 'test' | |
APP_DEBUG: 0 | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
PLUGIN_CODE: ${{ matrix.plugin_code }} | |
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' | |
USE_SELFSIGNED_SSL_CERTIFICATE: '1' | |
run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE} | |
- name: Uninstall Plugin | |
env: | |
APP_ENV: 'test' | |
APP_DEBUG: 0 | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
PLUGIN_CODE: ${{ matrix.plugin_code }} | |
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' | |
USE_SELFSIGNED_SSL_CERTIFICATE: '1' | |
working-directory: 'ec-cube' | |
run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE} |