Skip to content

Commit

Permalink
Merge branch 'master' into config-value-object
Browse files Browse the repository at this point in the history
  • Loading branch information
coenjacobs committed Sep 9, 2024
2 parents cb12e04 + f5c71c1 commit 394fdd6
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 82 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/docker-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand All @@ -48,5 +40,5 @@ jobs:
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=gha
cache-to: type=gha,mode=max
92 changes: 43 additions & 49 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint, analyse and test
name: Lint, test and analyse

on:
push:
Expand All @@ -9,60 +9,54 @@ on:
- master

jobs:
tests:
linting:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.0', '8.1', '8.2', '8.3']
name: PHP ${{ matrix.php }} tests
name: Linting
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v4
- name: Build Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
php-version: ${{ matrix.php }}
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Install dependencies
run: composer install --prefer-dist --no-suggest --no-progress
- name: Run tests
run: vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer
analysis:
context: "{{defaultContext}}"
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run linting
run: docker compose run --rm actions-tester composer test:lint
testing:
runs-on: ubuntu-latest
name: Analysis of code
name: Testing
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v4
- name: Build Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
php-version: '8.1'
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Install dependencies
run: composer install --prefer-dist --no-suggest --no-progress
- name: Run validate
run: composer run analysis
lint:
context: "{{defaultContext}}"
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run testing
run: docker compose run --rm actions-tester composer test:phpunit
analysis:
runs-on: ubuntu-latest
name: Lint all project files
name: Analysis
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v4
- name: Build Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
php-version: '8.0'
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Install dependencies
run: composer install --prefer-dist --no-suggest --no-progress
- name: Run validate
run: composer run lint
context: "{{defaultContext}}"
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run analysis
run: docker compose run --rm actions-tester composer test:phpstan
12 changes: 2 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand All @@ -87,8 +79,8 @@ jobs:
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN apk add --no-cache $PHPIZE_DEPS \
COPY ./docker/php/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
COPY ./docker/php/error_reporting.ini /usr/local/etc/php/conf.d/error_reporting.ini
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY ./composer.json /mozart/
COPY ./ /mozart/
WORKDIR /mozart/
RUN composer install

Expand Down
27 changes: 16 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "8.0"
Expand All @@ -37,21 +38,25 @@
"phpstan/extension-installer": "^1.4",
"league/flysystem": "^2.5",
"symfony/console": "^5.4",
"symfony/finder": "^5.4"
"symfony/finder": "^5.4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/php-compatibility": "dev-develop"
},
"scripts": {
"lint": [
"composer validate",
"phpcs"
"test": [
"@test:lint",
"@test:phpunit",
"@test:phpstan"
],
"analysis": [
"@analysis:phpstan"
"test:lint": [
"composer validate",
"./vendor/bin/phpcs --standard=phpcs.xml.dist"
],
"analysis:phpstan": [
"./vendor/bin/phpstan --memory-limit=2G"
"test:phpunit": [
"./vendor/bin/phpunit -c phpunit.xml.dist"
],
"test": [
"phpunit"
"test:phpstan": [
"./vendor/bin/phpstan analyse -c phpstan.neon.dist --memory-limit=2G"
]
}
}
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ services:
volumes:
- .:/mozart/
command: /bin/sh -c "while sleep 1000; do :; done"
actions-tester:
# This service is technically the same as the builder service, only this one
# has no volume mounted to the working directory. This causes the files to
# be used (for example installed dependencies) that are created _inside_ the
# container to be used, rather than having to set them up in the working
# directory, during GitHub Actions for example.
build:
context: .
dockerfile: Dockerfile
target: builder
command: /bin/sh -c "while sleep 1000; do :; done"
6 changes: 5 additions & 1 deletion phpcs.xml → phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
<ruleset name="mozart">
<description>Coding standard ruleset based on the PSR-2 coding standard.</description>
<rule ref="PSR2"/>

<rule ref="PHPCompatibility"/>
<config name="testVersion" value="8.0-"/>

<file>./src</file>
</ruleset>
</ruleset>
File renamed without changes.

0 comments on commit 394fdd6

Please sign in to comment.