Add github actions

This commit is contained in:
Greyscale 2024-04-14 16:41:54 +02:00
parent eda9bec6a5
commit b867f5a697
8 changed files with 69 additions and 158 deletions

12
.actrc Normal file
View file

@ -0,0 +1,12 @@
--action-cache-path .github/cache/act/actions
--artifact-server-path .github/cache/act/artifacts
--artifact-server-port 24000
--cache-server-path .github/cache/act/cache
--use-new-action-cache
--var-file .github/act.vars
--secret-file .github/act.secrets
--platform self-hosted=ghcr.io/catthehacker/ubuntu:act-latest
--platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
--platform ubuntu-22.04=ghcr.io/catthehacker/ubuntu:act-22.04
--platform ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
--platform ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04

View file

@ -1,24 +0,0 @@
name: Cache Trunk
on:
push:
branches: [main]
paths: [.trunk/trunk.yaml]
permissions: read-all
jobs:
cache_trunk:
name: Cache Trunk
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Trunk Check
uses: ./ # external users, use: trunk-io/trunk-action@v1
with:
check-mode: populate_cache_only

View file

@ -1,30 +0,0 @@
name: Lint PHP
on: [push, pull_request]
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Action
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHP-CS-Fixer
run: |
docker-compose run web \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/php-cs-fixer fix --dry-run
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Action
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPStan
run: |
docker-compose run web \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpstan analyse src/ test/ bin

View file

@ -1,33 +0,0 @@
name: Pull Request
on: [pull_request, workflow_dispatch]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: read-all
jobs:
trunk_check:
name: Trunk Check Runner
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Trunk Check
uses: ./ # external users, use: trunk-io/trunk-action@v1
action_tests:
name: Action tests
uses: ./.github/workflows/action_tests.yaml
repo_tests:
name: Repository tests
uses: ./.github/workflows/repo_tests.yaml
docker_repo_tests:
name: Repository tests (docker)
uses: ./.github/workflows/docker_repo_tests.yaml

47
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Tests
on:
push:
workflow_dispatch:
pull_request:
concurrency:
group: tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
phpcsfixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpunit@v3
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpstan@v3
with:
path: src/
trunk:
name: Trunk Check Runner
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
steps:
- uses: actions/checkout@v3
- uses: trunk-io/trunk-action@v1

View file

@ -1,61 +0,0 @@
name: Test
on: [push, pull_request]
jobs:
ingest:
name: PHPUnit/Ingest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run web \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/paratest \
--testsuite=Ingest
human:
name: PHPUnit/Human
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run test \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpunit \
--testsuite=Human
models:
name: PHPUnit/Models
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run test \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpunit \
--testsuite=Models
services:
name: PHPUnit/Services
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run test \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpunit \
--testsuite=Services

17
.gitignore vendored
View file

@ -1,12 +1,9 @@
build/
composer.lock
vendor/
.idea/
.phpunit.result.cache
.php_cs.cache
docs
phploc.xml
cghooks.lock
/composer.lock
/vendor/
/.idea/
/.phpunit.result.cache
/.php_cs.cache
/.php-cs-fixer.cache
/.coverage
/phpunit.xml
/phpunit.xml
/.github/cache

View file

@ -30,3 +30,6 @@ actions:
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
tools:
enabled:
- act@0.2.61