Merge pull request #54 from markstory/calendar-synced #712
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 | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
phpunit: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: ['8.1'] | |
db-type: [sqlite, mysql, pgsql] | |
env: | |
MYSQL_URL: mysql://root:[email protected]/docket | |
POSTGRES_URL: postgres://postgres:[email protected]/docket | |
SQLITE_URL: sqlite://./docket.db | |
steps: | |
- name: Setup MySQL | |
if: matrix.db-type == 'mysql' | |
run: | | |
sudo service mysql start | |
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE docket;' | |
- name: Setup PostgreSQL | |
if: matrix.db-type == 'pgsql' | |
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=docket -p 5432:5432 -d postgres:14 | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: curl, mbstring, intl, pdo_${{ matrix.db-type }} | |
coverage: pcov | |
- name: composer install | |
run: | | |
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then | |
composer install --no-progress --prefer-lowest --prefer-stable --ignore-platform-req=php | |
else | |
composer install --no-progress --ignore-platform-req=php | |
fi | |
cp ./tests/Fixture/google-auth.json ./config/google-auth.json | |
- name: yarn install & build | |
run: | | |
yarn install | |
yarn build | |
- name: Run PHPUnit | |
run: | | |
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DATABASE_TEST_URL=$SQLITE_URL; fi | |
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DATABASE_TEST_URL=$MYSQL_URL; fi | |
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DATABASE_TEST_URL=$POSTGRES_URL; fi | |
if [[ ${{ matrix.php-version }} == '8.1' ]]; then | |
export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=coverage.xml | |
else | |
vendor/bin/phpunit | |
fi | |
- name: Submit code coverage | |
if: matrix.php-version == '8.1' | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: phpunit | |
token: ${{ secrets.CODECOV_TOKEN }} | |
jest: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: yarn install & build | |
run: | | |
yarn install | |
- name: Run Jest | |
run: | |
yarn test | |
acceptance: | |
name: Browser Acceptance | |
runs-on: ubuntu-22.04 | |
env: | |
DATABASE_TEST_URL: mysql://root:[email protected]/docket | |
steps: | |
- name: Setup MySQL latest | |
run: | | |
sudo service mysql start | |
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE docket;' | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
extensions: mbstring, intl, pdo_mysql | |
coverage: pcov | |
- name: Install dependencies & build javascript | |
run: | | |
composer install --no-progress --ignore-platform-req=php | |
yarn install | |
yarn build | |
- name: Run PHPUnit | |
run: | | |
# Run suites individually so we abort on first failure | |
# a string of timeouts takes a long time to work through. | |
vendor/bin/phpunit tests/Acceptance/ProjectsTest.php | |
vendor/bin/phpunit tests/Acceptance/TasksTest.php | |
vendor/bin/phpunit tests/Acceptance/TodayTest.php | |
vendor/bin/phpunit tests/Acceptance/UpcomingTest.php | |
vendor/bin/phpunit tests/Acceptance/LoginTest.php | |
flutter-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
flutter-version: 3.13.x | |
- name: Run pub get | |
run: | | |
cd flutterapp | |
flutter --version | |
flutter pub get | |
- name: Run flutter test | |
run: | | |
cd flutterapp | |
flutter test --coverage | |
- name: Submit code coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: flutter | |
token: ${{ secrets.CODECOV_TOKEN }} | |
cs-stan: | |
name: Coding Standard & Static Analysis | |
runs-on: ubuntu-22.04 | |
env: | |
DATABASE_TEST_URL: sqlite://./docket.db | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, intl | |
coverage: none | |
tools: phive | |
- name: composer install | |
run: composer install --no-progress --ignore-platform-req=php | |
- name: Install PHP tools with phive. | |
run: phive install --trust-gpg-keys '12CE0F1D262429A5' | |
- name: Run PHP CodeSniffer | |
run: vendor/bin/phpcs --ignore=tests/js src/ tests/ | |
- name: Run psalm | |
if: success() || failure() | |
run: tools/psalm --output-format=github |