-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
111 additions
and
18 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -8,26 +8,119 @@ on: | |
branches: | ||
- main | ||
- develop | ||
env: | ||
HISTOLOGE_URL: http://localhost:8080 | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
services: | ||
# https://docs.docker.com/samples/library/mysql/ | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: false | ||
MYSQL_ROOT_PASSWORD: histologe | ||
MYSQL_DATABASE: histologe_db | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
env: | ||
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }} | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
# https://github.com/shivammathur/setup-php (community) | ||
- name: Setup PHP, extensions and composer with shivammathur/setup-php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json, mbstring, sockets | ||
env: | ||
update: true | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache wkthtmltopdf | ||
uses: actions/cache@v2 | ||
id: cache-wkhtmltopdf | ||
with: | ||
path: "~/wkhtmltox/" | ||
key: ${{ runner.os }}-wkhtmltopdf-${{ hashFiles('**/*.deb') }} | ||
|
||
- name: Download wkthtmltopdf & dependencies | ||
if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir ~/wkhtmltox | ||
wget -O ~/wkhtmltox/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb | ||
wget -O ~/wkhtmltox/xfonts-encodings.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-encodings/xfonts-encodings_1.0.4-2_all.deb | ||
wget -O ~/wkhtmltox/xfonts-utils.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-utils/xfonts-utils_7.7+6_amd64.deb | ||
wget -O ~/wkhtmltox/xfonts-75dpi.deb http://archive.ubuntu.com/ubuntu/pool/universe/x/xfonts-75dpi/xfonts-75dpi_1.0.4+nmu1_all.deb | ||
wget -O ~/wkhtmltox/xfonts-base.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-base/xfonts-base_1.0.4+nmu1_all.deb | ||
- name: Install wkhtmltopdf | ||
run: | | ||
sudo dpkg -i ~/wkhtmltox/xfonts-encodings.deb | ||
sudo dpkg -i ~/wkhtmltox/xfonts-utils.deb | ||
sudo dpkg -i ~/wkhtmltox/xfonts-75dpi.deb | ||
sudo dpkg -i ~/wkhtmltox/xfonts-base.deb | ||
sudo dpkg -i ~/wkhtmltox/wkhtmltox.deb | ||
- name: Check PHP Version | ||
run: php -v | ||
|
||
- name: NPM install | ||
uses: actions/setup-node@v2 #v4 ? | ||
with: | ||
node-version: '18' #lts/* ? | ||
- run: npm install --omit=dev | ||
|
||
- name: Install Symfony Encore | ||
run: npm install @symfony/webpack-encore --save-dev | ||
|
||
- name: NPM build | ||
run: npm run build | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
# https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows | ||
- name: Cache composer dependencies | ||
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 Composer dependencies | ||
run: | | ||
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader | ||
composer install --working-dir=tools/php-cs-fixer --no-progress --no-suggest --prefer-dist --optimize-autoloader | ||
- name: Load Doctrine fixtures | ||
run: | | ||
composer require symfony/orm-pack | ||
php bin/console --env=test doctrine:database:create --no-interaction | ||
php bin/console --env=test doctrine:migrations:migrate --no-interaction | ||
php bin/console --env=test doctrine:fixtures:load --no-interaction | ||
env: | ||
APP_SECRET: ${{ secrets.APP_SECRET }} | ||
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/histologe_db | ||
NOTIFICATIONS_EMAIL: [email protected] | ||
CONTACT_EMAIL: [email protected] | ||
HISTOLOGE_URL: http://localhost:8080 | ||
SERVER_NAME: localhost:8080 | ||
MAILER_DSN: ${{ secrets.MAILER_DSN_CI }} | ||
MAIL_ENABLE: 1 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
env: | ||
PLAYWRIGHT_TEST_BASE_URL: http://localhost:8080 | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |