| 1 |
name: build-lint-etc |
| 2 |
on: [ push ] |
| 3 |
|
| 4 |
permissions: |
| 5 |
contents: read |
| 6 |
|
| 7 |
|
| 8 |
jobs: |
| 9 |
testsuite: |
| 10 |
runs-on: ubuntu-22.04 |
| 11 |
strategy: |
| 12 |
matrix: |
| 13 |
php-versions: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] |
| 14 |
services: |
| 15 |
mysql: |
| 16 |
image: mysql:8.0 |
| 17 |
env: |
| 18 |
MYSQL_ROOT_PASSWORD: topSecret |
| 19 |
MYSQL_DATABASE: dmarc |
| 20 |
MYSQL_USER: dmarc_user |
| 21 |
MYSQL_PASSWORD: password |
| 22 |
ports: |
| 23 |
- 3306:3306 |
| 24 |
options: >- |
| 25 |
--health-cmd="mysqladmin ping" |
| 26 |
--health-interval=10s |
| 27 |
--health-timeout=5s |
| 28 |
--health-retries=3 |
| 29 |
steps: |
| 30 |
- uses: actions/checkout@v4 |
| 31 |
|
| 32 |
- name: Setup PHP |
| 33 |
uses: shivammathur/setup-php@v2 |
| 34 |
with: |
| 35 |
php-version: ${{ matrix.php-versions }} |
| 36 |
tools: composer |
| 37 |
extensions: mbstring, mysql, xml |
| 38 |
|
| 39 |
- name: Get composer cache directory |
| 40 |
if: ${{ !env.ACT }} |
| 41 |
id: composer-cache |
| 42 |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 43 |
|
| 44 |
- name: Cache dependencies |
| 45 |
if: ${{ !env.ACT }} |
| 46 |
uses: actions/cache@v4 |
| 47 |
with: |
| 48 |
path: ${{ steps.composer-cache.outputs.dir }} |
| 49 |
key: ${{ matrix.php-versions}}-${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 50 |
restore-keys: ${{ runner.os }}-composer- |
| 51 |
|
| 52 |
- name: Install dependencies |
| 53 |
run: composer install --prefer-dist -n |
| 54 |
|
| 55 |
- name: lint |
| 56 |
run: composer lint |
| 57 |
|
| 58 |
- name: static analysis |
| 59 |
run: composer phpstan |
| 60 |
|
| 61 |
- name: copy test config into place |
| 62 |
run: cp config/conf.sample.php config/conf.php |
| 63 |
|
| 64 |
- name: init database |
| 65 |
|
| 66 |
|
| 67 |
if: ${{ matrix.php-versions != '7.3' }} |
| 68 |
run: php -f utils/database_admin.php init |
| 69 |
|
| 70 |
- name: run unit tests |
| 71 |
run: composer test |