refactor: Katapult API v4 and refactorings to support testing #29
Workflow file for this run
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: Analyse and Test | |
on: | |
pull_request: | |
paths: | |
- '**.php' | |
push: | |
branches: | |
- main | |
paths: | |
- '**.php' | |
concurrency: | |
# On the main branch we want all builds to complete, even if new commits are merged. | |
group: ${{ github.ref == 'refs/heads/main' && format('lint-main-{0}', github.run_id) || format('lint-{0}-lint', github.ref) }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
- name: Install Composer dependencies | |
run: composer install | |
- name: Run PHP CodeSniffer | |
run: composer lint | |
phpstan: | |
name: Static Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.KRYSTAL_REGISTRY_HOST }} | |
username: ${{ vars.KRYSTAL_REGISTRY_USERNAME }} | |
password: ${{ secrets.KRYSTAL_REGISTRY_PASSWORD }} | |
- name: Composer Cache | |
uses: actions/cache@v4 | |
with: | |
path: ./.cache-composer | |
key: ${{ runner.os }}-${{ hashFiles('./vendor/composer.lock') }} | |
- name: Install Composer dependencies | |
run: | | |
docker run \ | |
-v ./:/app \ | |
-w /app \ | |
registry.k.io/hosting/php-8.2-cli:3 \ | |
composer install | |
- name: Show Composer dependencies | |
run: | | |
docker run \ | |
-v ./:/app \ | |
-w /app \ | |
registry.k.io/hosting/php-8.2-cli:3 \ | |
composer show | |
- name: PHPStan version | |
run: | | |
docker run \ | |
-v ./:/app \ | |
-w /app \ | |
registry.k.io/hosting/php-8.2-cli:3 \ | |
./vendor/bin/phpstan --version | |
- name: Run PHPStan | |
run: | | |
docker run \ | |
-v ./:/app \ | |
-w /app \ | |
registry.k.io/hosting/php-8.2-cli:3 \ | |
composer stan | |
phpunit: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
extensions: pdo, zip | |
ini-values: opcache.save_comments=1 | |
coverage: xdebug | |
- name: Composer Cache | |
uses: actions/cache@v4 | |
with: | |
path: ./.cache-composer | |
key: ${{ runner.os }}-${{ hashFiles('./vendor/composer.lock') }} | |
- name: Install Composer dependencies | |
run: composer install | |
- name: Run PHPUnit | |
run: composer test |