Skip to content

Commit a4e0326

Browse files
committed
ci: refactored testing
1 parent 2a359f8 commit a4e0326

File tree

7 files changed

+34
-41
lines changed

7 files changed

+34
-41
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21-
2221
- uses: docker/setup-buildx-action@v3
23-
24-
- name: Generate php image tags
25-
uses: docker/metadata-action@v5
22+
- uses: docker/metadata-action@v5
2623
id: meta-php
2724
with:
2825
bake-target: php
@@ -32,9 +29,7 @@ jobs:
3229
type=ref,event=branch
3330
type=semver,pattern={{version}}
3431
type=semver,pattern={{major}}.{{minor}}
35-
36-
- name: Generate nginx image tags
37-
uses: docker/metadata-action@v5
32+
- uses: docker/metadata-action@v5
3833
id: meta-nginx
3934
with:
4035
bake-target: nginx
@@ -44,13 +39,11 @@ jobs:
4439
type=ref,event=branch
4540
type=semver,pattern={{version}}
4641
type=semver,pattern={{major}}.{{minor}}
47-
4842
- uses: docker/login-action@v3
4943
with:
5044
registry: ghcr.io
5145
username: ${{ github.actor }}
5246
password: ${{ github.token }}
53-
5447
- uses: docker/bake-action@v5
5548
with:
5649
targets: production

.github/workflows/ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
name: CI
22

33
on:
4-
push:
5-
branches-ignore:
6-
- main
7-
- renovate/**
8-
- release-**
94
pull_request:
105
branches-ignore:
116
- renovate/**
127
- release-**
138
workflow_dispatch:
149

1510
jobs:
11+
pint:
12+
name: Pint
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: docker/setup-buildx-action@v3
17+
- uses: docker/login-action@v3
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ github.token }}
22+
- run: docker compose -f docker-compose.testing.yml run --rm testing ./vendor/bin/pint --test
1623
test:
1724
uses: ./.github/workflows/test.yml
1825
build:

.github/workflows/release-please.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
push:
55
branches:
66
- main
7-
workflow_dispatch:
7+
workflow_dispatch:
88

99
jobs:
1010
release-please:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- uses: googleapis/release-please-action@v4
1414
with:
1515
release-type: 'php'
16-
token: '${{ secrets.RELEASE_PLEASE }}'
16+
token: '${{ secrets.RELEASE_PLEASE_TOKEN }}'

.github/workflows/test.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,15 @@ permissions:
1111
packages: write
1212

1313
jobs:
14-
test:
15-
runs-on: ubuntu-latest
14+
run:
15+
name: Run
16+
runs-on: ubuntu-22.04
1617
steps:
1718
- uses: actions/checkout@v4
18-
1919
- uses: docker/setup-buildx-action@v3
20-
2120
- uses: docker/login-action@v3
2221
with:
2322
registry: ghcr.io
2423
username: ${{ github.actor }}
2524
password: ${{ github.token }}
26-
27-
- uses: docker/bake-action@v5
28-
with:
29-
targets: testing
30-
files: ./docker-bake.hcl
25+
- run: docker compose -f docker-compose.testing.yml run --rm testing php artisan test

containers/php/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ COPY --chown=www-data:www-data storage storage
8989
COPY tests tests
9090
COPY artisan .
9191
COPY phpunit.xml .
92-
COPY .env.example .env
92+
COPY .env.example .env.testing
9393
RUN composer dump-autoload --optimize \
94-
&& php artisan key:generate \
95-
&& php artisan test
94+
&& php artisan key:generate --env=testing
95+
USER www-data

docker-bake.hcl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,3 @@ target "nginx" {
3030
group "production" {
3131
targets = ["php", "nginx"]
3232
}
33-
34-
target "testing" {
35-
dockerfile = "containers/php/Dockerfile"
36-
context = "."
37-
target = "testing"
38-
output = [
39-
"type=cacheonly"
40-
]
41-
cache-from = [
42-
"type=gha,scope=php"
43-
]
44-
}

docker-compose.testing.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
testing:
3+
build:
4+
dockerfile: containers/php/Dockerfile
5+
context: .
6+
target: testing
7+
cache_to:
8+
- type=gha,mode=max,scope=testing
9+
cache_from:
10+
- type=gha,scope=testing

0 commit comments

Comments
 (0)