File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,13 +21,15 @@ jobs:
2121 - name : Checkout
2222 uses : actions/checkout@v7
2323
24- # Tests run in the project 's own compose stack , so the PHP version comes
25- # from the Dockerfile rather than being repeated here .
26- - name : Build the php image
27- run : docker compose build php
24+ # The checkout belongs to the runner 's uid , so the container has to write
25+ # to the bind mount as that uid rather than as the image's `deploy` user .
26+ - name : Run the container as the checkout owner
27+ run : echo "COMPOSE_USER=$(id -u):$(id -g)" >> "$GITHUB_ENV"
2828
29+ # Tests run in the project's own compose stack, so the PHP version comes
30+ # from compose.yml rather than being repeated here.
2931 - name : Install dependencies
30- run : docker compose run --rm --no-deps php composer install --no-interaction --prefer-dist --no-progress
32+ run : docker compose run --rm --no-deps phpfpm composer install --no-interaction --prefer-dist --no-progress
3133
3234 - name : Run tests
33- run : docker compose run --rm --no-deps php vendor/bin/phpunit
35+ run : docker compose run --rm --no-deps phpfpm vendor/bin/phpunit
Original file line number Diff line number Diff line change 1414 release :
1515 runs-on : ubuntu-latest
1616 steps :
17- - uses : actions/checkout@v4
17+ - uses : actions/checkout@v7
1818
1919 - name : Build and create release
2020 env :
3434 release_name="release-${tag_name}"
3535 fi
3636
37- docker compose run --user root --rm php bin/create-release "$tag_name"
37+ docker compose run --user root --rm php-release bin/create-release "$tag_name"
3838
3939 # Delete release if it already exists.
4040 gh release view "$release_name" > /dev/null 2>&1 && gh release delete "$release_name" --yes
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ FROM itkdev/php8.3-fpm:latest
22
33USER root
44
5- # Add rsync
5+ # Add rsync, which `bin/create-release` needs and the base image does not carry.
66RUN apt-get update && apt-get --yes install rsync
77
88# Clean up
Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ curl https://leantime.local.itkdev.dk/apidata/api/deleted
6565
6666## Development
6767
68- The plugin has no long-running stack, so everything runs in a one-off container
69- built from the local ` Dockerfile ` . Install [ Task] ( https://taskfile.dev ) , then:
68+ The plugin has no long-running stack, so everything runs in a one-off
69+ ` itkdev/php8.3-fpm ` container . Install [ Task] ( https://taskfile.dev ) , then:
7070
7171``` shell
7272task setup
@@ -76,6 +76,10 @@ task lint
7676
7777Run ` task --list-all ` to see the remaining commands.
7878
79+ The ` Dockerfile ` exists only for releases: ` bin/create-release ` needs ` rsync ` ,
80+ which the base image does not carry. It backs the ` php-release ` compose service
81+ and is not used for tests or linting.
82+
7983Leantime core is not a Composer dependency of this plugin, so the development
8084dependencies stand in for it. ` illuminate/database ` and ` nesbot/carbon ` are
8185pinned to the exact versions the targeted Leantime release locks, so the tests
Original file line number Diff line number Diff line change 22# Run `task` (or `task --list-all`) to see all available commands.
33#
44# This plugin has no long-running stack, so everything runs in a one-off
5- # container built from the local Dockerfile ( itkdev/php8.3-fpm) .
5+ # itkdev/php8.3-fpm container .
66
77version : " 3"
88
@@ -20,14 +20,14 @@ tasks:
2020 # -------------------------------------------------------------- Wrappers ---
2121
2222 compose :
23- desc : " Run a docker compose command. Example: task compose -- build php ."
23+ desc : " Run a docker compose command. Example: task compose -- config ."
2424 cmds :
2525 - " {{ .DOCKER_COMPOSE }} {{ .CLI_ARGS }}"
2626
2727 php :
2828 desc : " Run a command in a one-off php container. Example: task php -- php --version."
2929 cmds :
30- - task compose -- run --rm --no-deps php {{ .CLI_ARGS }}
30+ - task compose -- run --rm --no-deps phpfpm {{ .CLI_ARGS }}
3131 silent : true
3232
3333 composer :
3939 # ------------------------------------------------------------ Lifecycle ---
4040
4141 setup :
42- desc : Build the php image and install dev dependencies.
42+ desc : Install dev dependencies.
4343 cmds :
44- - task compose -- build php
4544 - task composer -- install
4645
4746 # ------------------------------------------------------------ PHP tests ---
Original file line number Diff line number Diff line change 11services :
2- php :
2+ # Tests, linting and composer run straight on the itkdev image — nothing in
3+ # that path needs anything added to it.
4+ phpfpm :
5+ image : itkdev/php8.3-fpm:latest
6+ working_dir : /app
7+ # `deploy` is right locally, where Docker Desktop masks the ownership of the
8+ # bind mount. On a Linux CI runner the checkout belongs to the runner's own
9+ # uid, so CI sets COMPOSE_USER to it — otherwise composer cannot create
10+ # `vendor`. The image carries a `runner` user at uid 1001, so the overridden
11+ # uid still resolves to a writable home.
12+ user : ${COMPOSE_USER:-deploy}
13+ volumes :
14+ - .:/app
15+
16+ # Only `bin/create-release` needs the built image, for the rsync it adds.
17+ php-release :
318 build : .
419 working_dir : /app
520 volumes :
You can’t perform that action at this time.
0 commit comments