Skip to content

Commit 15e7454

Browse files
committed
4268: Used tasks (and docker compose) in actions (and fixed some typos)
1 parent 3e5f758 commit 15e7454

File tree

2 files changed

+36
-56
lines changed

2 files changed

+36
-56
lines changed

.github/workflows/pr.yaml

Lines changed: 18 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- run: |
4242
docker network create frontend
4343
44-
- name: Load fixtures
44+
- name: Check YAML coding standards
4545
run: |
4646
task --yes coding-standards:yaml:check
4747
@@ -50,75 +50,39 @@ jobs:
5050

5151
psalm:
5252
runs-on: ubuntu-latest
53-
strategy:
54-
fail-fast: false
55-
matrix:
56-
php: ["8.3"]
57-
name: Psalm static analysis (${{ matrix.php}})
53+
name: Psalm static analysis
5854
steps:
5955
- uses: actions/checkout@v4
6056

61-
- name: Setup PHP, with composer and extensions
62-
uses: shivammathur/setup-php@v2
63-
with:
64-
php-version: ${{ matrix.php}}
65-
extensions: http, ctype, iconv
66-
coverage: none
67-
68-
- name: Get composer cache directory
69-
id: composer-cache
70-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
57+
# https://taskfile.dev/installation/#github-actions
58+
- uses: arduino/setup-task@v2
7159

72-
- name: Cache dependencies
73-
uses: actions/cache@v4
74-
with:
75-
path: ${{ steps.composer-cache.outputs.dir }}
76-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
77-
restore-keys: ${{ runner.os }}-composer-${{ matrix.dependency-version }}-
60+
- run: |
61+
docker network create frontend
7862
79-
- name: Install Dependencies
63+
- name: Run code analysis
8064
run: |
81-
composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
82-
bin/console cache:clear
83-
- name: Psalm
84-
run: ./vendor/bin/psalm --no-cache
65+
task --yes code-analysis:psalm
8566
8667
apispec:
8768
runs-on: ubuntu-latest
88-
name: API Specification validation
89-
strategy:
90-
fail-fast: false
91-
matrix:
92-
php: ["8.3"]
69+
name: API specification validation
9370
steps:
9471
- name: Checkout
9572
uses: actions/checkout@v4
9673
with:
9774
fetch-depth: 2
9875

99-
- name: Setup PHP, with composer and extensions
100-
uses: shivammathur/setup-php@v2
101-
with:
102-
php-version: ${{ matrix.php}}
103-
extensions: http, ctype, iconv
104-
coverage: none
105-
106-
- name: Get composer cache directory
107-
id: composer-cache
108-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
109-
110-
- name: Cache dependencies
111-
uses: actions/cache@v4
112-
with:
113-
path: ${{ steps.composer-cache.outputs.dir }}
114-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
115-
restore-keys: ${{ runner.os }}-composer-
76+
# https://taskfile.dev/installation/#github-actions
77+
- uses: arduino/setup-task@v2
11678

117-
- name: Install Dependencies
118-
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
79+
- run: |
80+
docker network create frontend
81+
task --yes site:update
11982
120-
- name: Export specifications
121-
run: bin/console api:openapi:export --yaml --output=public/spec.yaml --no-interaction
83+
- name: Export API specification
84+
run: |
85+
task --yes apispec:export
12286
123-
- name: Check for changes in specifications
87+
- name: Check for changes in specification
12488
run: git diff --diff-filter=ACMRT --exit-code public/spec.yaml

Taskfile.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ tasks:
8383
# Run docker compose with both arguments passed via var plus any cli args.
8484
- "{{.DOCKER_COMPOSE}} {{.COMPOSE_ARGS}} {{.CLI_ARGS}}"
8585

86+
console:
87+
desc: "Run Symfony console command. Example: task console -- cache:clear"
88+
cmds:
89+
# Run docker compose with both arguments passed via var plus any cli args.
90+
- task: compose
91+
vars:
92+
COMPOSE_ARGS: run --rm phpfpm bin/console {{.CONSOLE_ARGS}}
93+
8694
coding-standards:apply:
8795
desc: "Apply coding standards"
8896
cmds:
@@ -167,14 +175,22 @@ tasks:
167175
COMPOSE_ARGS: run --rm prettier {{.YAML_FILES_GLOB}} --check
168176
silent: true
169177

170-
code-analysis:
171-
desc: "Run code analysis"
178+
code-analysis:psalm:
179+
desc: "Run PSalm"
172180
cmds:
173181
- task: compose
174182
vars:
175183
COMPOSE_ARGS: exec phpfpm vendor/bin/psalm --no-cache
176184
silent: true
177185

186+
apispec:export:
187+
desc: Export API spec
188+
cmds:
189+
- task: console
190+
vars:
191+
CONSOLE_ARGS: api:openapi:export --yaml --output=public/spec.yaml --no-interaction
192+
silent: true
193+
178194
default:
179195
cmds:
180196
- task --list

0 commit comments

Comments
 (0)