Skip to content

build

build #212

Workflow file for this run

name: build
on:
workflow_dispatch:
pull_request:
branches: [ "master" ]
push:
branches: [ "master" ]
schedule:
- cron: '0 16 * * 0' # sunday 16:00
# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
# sudo-bot/action-scrutinizer@latest https://github.com/marketplace/actions/action-scrutinizer
jobs:
composer-normalize:
name: Composer normalization
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: composer-normalize
env:
fail-fast: true
- name: Composer normalize
run: composer-normalize
phpcs:
name: Code Style (phpcs)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: cs2pr, phpcs
env:
fail-fast: true
- name: Code style (phpcs)
run: phpcs -q --report=checkstyle | cs2pr
php-cs-fixer:
name: Code style (php-cs-fixer)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: cs2pr, php-cs-fixer
env:
fail-fast: true
- name: Code style (php-cs-fixer)
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
phpstan:
name: Code analysis (phpstan)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
extensions: sqlite3
tools: composer:v2, cs2pr, phpstan
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: PHPStan
run: phpstan analyse --no-progress --verbose
tests:
name: Tests on PHP ${{ matrix.php-versions }}
runs-on: "ubuntu-latest"
strategy:
matrix:
php-versions: ['8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for scrutinizer
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
extensions: sqlite3
tools: composer:v2
env:
fail-fast: true
- name: Install xlsx2csv & libreoffice-calc
run: |
sudo apt-get update -y -qq
sudo apt-get install -y -qq --no-install-recommends xlsx2csv default-jre-headless libreoffice-calc-nogui libreoffice-java-common
env:
DEBIAN_FRONTEND: noninteractive
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Tests (phpunit)
run: vendor/bin/phpunit --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
- name: Upload code coverage to scrutinizer
if: github.event_name == 'push'
uses: sudo-bot/action-scrutinizer@latest
with:
cli-args: "-vvv --format=php-clover build/coverage/clover.xml"
continue-on-error: true
- name: System test
if: github.event_name == 'push'
run: |
mkdir --parents build/files/
php bin/sat-catalogos-update dump-origins > build/files/origins.xml
php bin/sat-catalogos-update update-origins build/files/
php bin/sat-catalogos-update update-database build/files/ build/files/database.sqlite3