Skip to content

Commit f8a30e3

Browse files
committed
Improve GitHub workflow configurations
Improvements to GitHub workflow configurations: - Fixes code style issues - Improves naming of files, workflows and jobs - Adds scheduled workflow for dependency validation - Allows the check for outdated Symfony recipes to fail
1 parent e764646 commit f8a30e3

File tree

6 files changed

+132
-133
lines changed

6 files changed

+132
-133
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
name: Build image
1+
name: Build images
22

3-
on:
4-
pull_request:
5-
push:
3+
on: [pull_request, push]
64

75
jobs:
8-
build-image:
9-
name: Test Docker build
6+
build-standalone:
7+
name: Standalone images
108
runs-on: ubuntu-latest
119
steps:
12-
-
13-
name: Set up Docker Buildx
10+
- name: Set up Docker Buildx
1411
uses: docker/setup-buildx-action@v3
1512
with:
1613
driver: docker-container
1714

18-
-
19-
name: Build Docker image
15+
- name: Build images
2016
uses: docker/build-push-action@v6
2117
with:
2218
platforms: linux/amd64,linux/arm64
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
1-
name: Publish image
1+
name: Publish images
22

33
on:
44
push:
5-
tags:
6-
- v*
5+
tags: [v*]
76
schedule:
8-
-
9-
cron: "30 4 * * *"
7+
- cron: "30 4 * * *"
108

119
jobs:
12-
publish-image:
13-
name: Publish Docker image
10+
publish-standalone:
11+
name: Standalone images
1412
runs-on: ubuntu-latest
1513
permissions:
1614
id-token: write
1715
contents: read
1816
packages: write
1917
attestations: write
2018
steps:
21-
-
22-
name: Set up Docker Buildx
19+
- name: Set up Docker Buildx
2320
uses: docker/setup-buildx-action@v3
2421
with:
2522
driver: docker-container
2623

27-
-
28-
name: Extract metadata for Docker
24+
- name: Extract metadata for Docker
2925
id: meta
3026
uses: docker/metadata-action@v5
3127
with:
@@ -35,16 +31,14 @@ jobs:
3531
type=semver,pattern={{version}}
3632
type=semver,pattern={{major}}.{{minor}}
3733
38-
-
39-
name: Login to GitHub Packages
34+
- name: Login to GitHub Packages
4035
uses: docker/login-action@v3
4136
with:
4237
registry: ghcr.io
4338
username: ${{ github.actor }}
4439
password: ${{ secrets.GITHUB_TOKEN }}
4540

46-
-
47-
name: Build and push Docker image
41+
- name: Build and publish images
4842
id: push
4943
uses: docker/build-push-action@v6
5044
with:
@@ -53,8 +47,7 @@ jobs:
5347
labels: ${{ steps.meta.outputs.labels }}
5448
platforms: linux/amd64,linux/arm64
5549

56-
-
57-
name: Generate artifact attestation
50+
- name: Generate artifact attestation
5851
uses: actions/attest-build-provenance@v2
5952
with:
6053
subject-name: ghcr.io/${{ github.repository }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Lint dependencies
2+
3+
on:
4+
pull_request:
5+
push:
6+
schedule:
7+
- cron: "30 4 * * *"
8+
9+
jobs:
10+
dependencies:
11+
name: Composer
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Install PHP with extensions
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.3
22+
tools: composer:v2
23+
24+
- name: Set Composer cache directory
25+
id: composer-cache
26+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
27+
28+
- name: Cache Composer output
29+
uses: actions/cache@v4
30+
with:
31+
path: ${{ steps.composer-cache.outputs.dir }}
32+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
33+
restore-keys: ${{ runner.os }}-composer-
34+
35+
- name: Install dependencies
36+
id: install
37+
run: composer install --ansi --no-interaction --no-progress
38+
39+
- name: Check if any Composer dependencies are compromised
40+
if: always() && steps.install.outcome == 'success'
41+
run: composer audit --ansi
42+
43+
# This check always shows a success state (due to `continue-on-error`),
44+
# even when there are outdated recipes. Please check the result when
45+
# updating Composer dependencies.
46+
# todo fail when composer.lock changed and there is an outdated recipe
47+
- name: Check if any Symfony recipes are outdated
48+
if: always() && steps.install.outcome == 'success'
49+
continue-on-error: true
50+
run: composer recipes --outdated
Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
name: Lint code & configuration
22

3-
on:
4-
pull_request:
5-
push:
6-
7-
env:
8-
fail-fast: true
9-
10-
permissions:
11-
contents: read
3+
on: [pull_request, push]
124

135
jobs:
146
linters:
@@ -22,8 +14,6 @@ jobs:
2214
- name: Install PHP with extensions
2315
uses: shivammathur/setup-php@v2
2416
with:
25-
coverage: none
26-
extensions: intl
2717
php-version: 8.3
2818
tools: composer:v2
2919

@@ -42,39 +32,31 @@ jobs:
4232
id: install
4333
run: composer install --ansi --no-interaction --no-progress
4434

35+
- name: Lint Composer configuration
36+
if: always() && steps.install.outcome == 'success'
37+
run: composer validate --ansi
38+
# todo enable strict mode, currently license is invalid
39+
# run: composer validate --strict
40+
4541
- name: Lint YAML files
4642
if: always() && steps.install.outcome == 'success'
4743
run: bin/console lint:yaml .github config translations --parse-tags
4844

49-
- name: Lint Twig templates
45+
- name: Lint Symfony service container
5046
if: always() && steps.install.outcome == 'success'
51-
run: bin/console lint:twig templates --env=prod
47+
run: bin/console lint:container
5248

53-
#- name: Lint XLIFF translation files
54-
# if: always() && steps.install.outcome == 'success'
55-
# run: bin/console lint:xliff translations
49+
- name: Lint Twig templates
50+
if: always() && steps.install.outcome == 'success'
51+
run: bin/console lint:twig templates
5652

5753
#- name: Lint translation contents
5854
# if: always() && steps.install.outcome == 'success'
5955
# run: bin/console lint:translations
6056

61-
- name: Lint Parameters and Services
62-
if: always() && steps.install.outcome == 'success'
63-
run: bin/console lint:container --no-debug
64-
65-
- name: Lint Composer config
66-
if: always() && steps.install.outcome == 'success'
67-
run: composer validate
68-
# todo enable strict mode, currently license is invalid
69-
# run: composer validate --strict
70-
71-
- name: Check if any dependencies are compromised
72-
if: always() && steps.install.outcome == 'success'
73-
run: composer audit
74-
75-
- name: Check if any Symfony recipes are outdated
76-
if: always() && steps.install.outcome == 'success'
77-
run: composer recipes --outdated --no-interaction
57+
#- name: Lint XLIFF translation files
58+
# if: always() && steps.install.outcome == 'success'
59+
# run: bin/console lint:xliff translations
7860

7961
php-cs-fixer:
8062
name: PHP-CS-Fixer
@@ -86,8 +68,6 @@ jobs:
8668
- name: Install PHP with extensions
8769
uses: shivammathur/setup-php@v2
8870
with:
89-
coverage: none
90-
extensions: intl
9171
php-version: 8.3
9272
tools: composer:v2
9373

@@ -107,7 +87,7 @@ jobs:
10787
run: composer install --ansi --no-interaction --no-progress
10888

10989
- name: PHP-CS-Fixer
110-
run: ./vendor/bin/php-cs-fixer fix --diff --dry-run
90+
run: vendor/bin/php-cs-fixer fix --diff --dry-run
11191

11292
phpstan:
11393
name: PHPStan
@@ -120,8 +100,6 @@ jobs:
120100
- name: Install PHP with extensions
121101
uses: shivammathur/setup-php@v2
122102
with:
123-
coverage: none
124-
extensions: intl
125103
php-version: 8.3
126104
tools: composer:v2
127105

@@ -142,4 +120,4 @@ jobs:
142120

143121
- name: Run PHPStan
144122
if: always() && steps.install.outcome == 'success'
145-
run: ./vendor/bin/phpstan analyze
123+
run: vendor/bin/phpstan analyze
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
name: Run image tests
22

3-
on:
4-
pull_request:
5-
push:
3+
on: [pull_request, push]
64

75
env:
8-
fail-fast: true
96
GITHUB_TOKEN: ${{ github.token }}
107
PHPUNIT_FLAGS: ""
118

12-
permissions:
13-
contents: read
14-
159
jobs:
16-
phpunit:
17-
name: Testcontainers
10+
testcontainers:
11+
name: Testcontainers (Standalone)
1812
runs-on: ubuntu-latest
1913
continue-on-error: false
2014

@@ -34,8 +28,6 @@ jobs:
3428
- name: Install PHP with extensions
3529
uses: shivammathur/setup-php@v2
3630
with:
37-
coverage: none
38-
extensions: intl, mbstring, zip
3931
php-version: 8.3
4032
tools: composer:v2
4133

0 commit comments

Comments
 (0)