Files
sysPass/.github/workflows/feature.yaml
2022-05-22 22:53:09 +02:00

94 lines
2.9 KiB
YAML

name: Feature Build & Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
strategy:
matrix:
platform: [ ubuntu-latest ]
php: [ '7.4', '8' ]
name: Build & Test ${{ matrix.php }}/${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
env:
DB_SERVER: 127.0.0.1
DB_NAME: syspass
DB_USER: root
DB_PASS: syspass
DB_PORT: 3306
services:
mariadb:
image: mariadb:10.3
env:
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASS }}
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v1
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, gd, ldap, gettext, pdo_mysql
# tools: phpunit
coverage: xdebug
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install \
--prefer-dist \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
- name: Setup database
run: |
set -euo pipefail
MYSQL_OPTS="-h ${DB_SERVER} -P ${DB_PORT} -u ${DB_USER} -p${DB_PASS}"
mysql ${MYSQL_OPTS} -e 'DROP DATABASE IF EXISTS `'"$DB_NAME"'`;'
mysql ${MYSQL_OPTS} -e 'CREATE DATABASE `'"${DB_NAME}"'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql ${MYSQL_OPTS} ${DB_NAME} < ./schemas/dbstructure.sql
- name: Unitary tests
uses: paambaati/codeclimate-action@v3.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
XDEBUG_MODE: coverage
with:
coverageCommand: ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite unitary
coverageLocations: ./tests/_output/coverage-clover.xml:clover
- name: Integration tests
uses: paambaati/codeclimate-action@v3.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
XDEBUG_MODE: coverage
with:
coverageCommand: ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite core
coverageLocations: ./tests/_output/coverage-clover.xml:clover