Skip to content

Commit dddb92d

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

File tree

2 files changed

+37
-56
lines changed

2 files changed

+37
-56
lines changed

.github/workflows/pr.yaml

Lines changed: 19 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,40 @@ 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
62+
task --yes compose -- up --detach --wait
7863
79-
- name: Install Dependencies
64+
- name: Run code analysis
8065
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
66+
task --yes code-analysis:psalm
8567
8668
apispec:
8769
runs-on: ubuntu-latest
88-
name: API Specification validation
89-
strategy:
90-
fail-fast: false
91-
matrix:
92-
php: ["8.3"]
70+
name: API specification validation
9371
steps:
9472
- name: Checkout
9573
uses: actions/checkout@v4
9674
with:
9775
fetch-depth: 2
9876

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-
77+
# https://taskfile.dev/installation/#github-actions
78+
- uses: arduino/setup-task@v2
11679

117-
- name: Install Dependencies
118-
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
80+
- run: |
81+
docker network create frontend
82+
task --yes compose -- up --detach --wait
11983
120-
- name: Export specifications
121-
run: bin/console api:openapi:export --yaml --output=public/spec.yaml --no-interaction
84+
- name: Export API specification
85+
run: |
86+
task --yes apispec:export
12287
123-
- name: Check for changes in specifications
88+
- name: Check for changes in specification
12489
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: exec 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)