Skip to content

Commit 1bc4bed

Browse files
committed
build: migrate to nix flake
1 parent 1920156 commit 1bc4bed

File tree

8 files changed

+731
-329
lines changed

8 files changed

+731
-329
lines changed

.ddev/config.yaml

Lines changed: 0 additions & 258 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 40 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,39 @@ on:
66
- main
77
pull_request:
88
types: [opened, synchronize, reopened]
9+
env:
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
912
jobs:
10-
test:
11-
name: Test with Symfony ${{ matrix.symfony-version }}
12-
runs-on: ubuntu-latest
13+
lint_test:
14+
name: Lint & Test
15+
runs-on: nixos
1316
strategy:
1417
matrix:
15-
symfony-version: ["^4", "^5", "^6"]
16-
steps:
17-
- uses: actions/checkout@v3
18-
with:
19-
fetch-depth: 0
20-
21-
- name: Setup PHP with Xdebug
22-
uses: shivammathur/setup-php@v2
23-
with:
24-
php-version: "8.1"
25-
coverage: xdebug
26-
27-
- name: Get composer cache directory
28-
id: composer-cache
29-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
30-
31-
- name: Cache dependencies
32-
uses: actions/cache@v3
33-
with:
34-
path: ${{ steps.composer-cache.outputs.dir }}
35-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
36-
restore-keys: ${{ runner.os }}-composer-
37-
38-
- name: Install dependencies
39-
run: >-
40-
composer update --no-ansi --no-interaction --no-progress &&
41-
composer require symfony/http-foundation:${{ matrix.symfony-version }}
42-
43-
- name: Run tests
44-
run: composer run-script test-ci
45-
46-
- name: Fix code coverage paths
47-
if: matrix.symfony-version == '^6'
48-
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
49-
50-
- name: SonarCloud Scan
51-
if: matrix.symfony-version == '^6'
52-
uses: SonarSource/sonarcloud-github-action@master
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
56-
57-
lint:
58-
name: Lint with PHPStan
59-
runs-on: ubuntu-latest
18+
reqs:
19+
- symfony: "^5"
20+
shell: "php81"
21+
- symfony: "^5"
22+
shell: "php82"
23+
- symfony: "^5"
24+
shell: "php83"
25+
- symfony: "^6"
26+
shell: "php81"
27+
- symfony: "^6"
28+
shell: "php82"
29+
- symfony: "^6"
30+
shell: "php83"
31+
- symfony: "^7"
32+
shell: "php82"
33+
- symfony: "^7"
34+
shell: "php83"
35+
- symfony: "^6"
36+
shell: "php84"
37+
- symfony: "^7"
38+
shell: "php84"
39+
defaults:
40+
run:
41+
shell: nix develop .#${{ matrix.reqs.shell }} --command bash {0}
6042
steps:
6143
- uses: actions/checkout@v3
6244

@@ -67,14 +49,15 @@ jobs:
6749
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
6850

6951
- name: Install dependencies
70-
uses: php-actions/composer@v6
71-
with:
72-
php_version: "8.1"
52+
run: >-
53+
composer update --no-ansi --no-interaction --no-progress &&
54+
composer require symfony/http-foundation:${{ matrix.reqs.symfony }}
7355
74-
- name: Lint
75-
uses: php-actions/composer@v6
76-
with:
77-
php_version: "8.1"
78-
command: run-script
79-
args: analyze
56+
- name: PHPCS
57+
run: ./vendor/bin/phpcs -s src tests
58+
59+
- name: PHPStan
60+
run: ./vendor/bin/phpstan analyse --level 8 src tests
8061

62+
- name: PHPUnit
63+
run: ./vendor/bin/phpunit tests

composer.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,22 @@
1919
"minimum-stability": "stable",
2020
"require-dev": {
2121
"phpunit/phpunit": "^10.0",
22-
"phpstan/phpstan": "^1.10"
22+
"phpstan/phpstan": "^1.10",
23+
"drupal/coder": "^8.3"
2324
},
2425
"scripts": {
25-
"test": "phpunit --testdox tests",
26-
"test-ci": "phpunit --coverage-clover=coverage.xml --coverage-filter src tests",
27-
"test-coverage": "XDEBUG_MODE=coverage phpunit --coverage-text --coverage-filter src --testdox tests",
28-
"analyze": "phpstan analyse --level 8 src tests"
26+
"unit": "phpunit tests",
27+
"phpstan": "phpstan analyse --level 8 src tests",
28+
"phpcs": "phpcs -s src tests"
2929
},
3030
"require": {
3131
"justinrainbow/json-schema": "^5.2",
3232
"symfony/http-foundation": "^4 || ^5 || ^6",
3333
"wunderwerkio/jsonapi-error": "^0.1.2"
34+
},
35+
"config": {
36+
"allow-plugins": {
37+
"dealerdirect/phpcodesniffer-composer-installer": true
38+
}
3439
}
3540
}

0 commit comments

Comments
 (0)