Skip to content

Commit 8c95b4c

Browse files
Curtis Delicataclaude
andcommitted
Fix and improve GitHub Actions workflows
- main.yml: fix PHP 8.4→8.5, replace two corrupted action SHAs (metadata-action, build-push-action), switch phpunit→pest, drop unused MySQL service, fix Docker cache image from control-panel→accounting, add packages:write permission on docker job - tests.yml: drop MySQL service (phpunit.xml uses SQLite :memory:), switch phpunit→pest, add pdo_sqlite extension, add workflow_dispatch and permissions block, remove redundant migrate/seed steps - install.yml: replace MySQL service with inline SQLite env overrides, add pdo_sqlite, add workflow_dispatch, permissions, timeout-minutes - security.yml: fix actions/checkout@v5→@v4 (v5 does not exist), fix master→main branch, remove sudo from composer/artisan, fix copy-paste job name typo, switch curl binary→composer audit, add Pint code-style job, add workflow_dispatch, permissions, timeouts - dependabot.yml: change daily→weekly, add open-pull-requests-limit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8aaad01 commit 8c95b4c

5 files changed

Lines changed: 185 additions & 179 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
version: 2
22
updates:
33
- package-ecosystem: "composer"
4-
# Files stored in repository root
54
directory: "/"
65
schedule:
7-
interval: "daily"
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
89
- package-ecosystem: "npm"
9-
# Files stored in repository root
1010
directory: "/"
1111
schedule:
12-
interval: "daily"
12+
interval: "weekly"
13+
open-pull-requests-limit: 10
14+
1315
- package-ecosystem: "github-actions"
14-
# Workflow files stored in the
15-
# default location of `.github/workflows`
1616
directory: "/"
1717
schedule:
18-
interval: "daily"
18+
interval: "weekly"
19+
open-pull-requests-limit: 5

.github/workflows/install.yml

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,72 @@ name: Install
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
8+
workflow_dispatch:
89

9-
jobs:
10+
permissions:
11+
contents: read
1012

13+
jobs:
1114
install:
1215
runs-on: ubuntu-latest
13-
14-
services:
15-
mysql:
16-
image: mysql:8.0
17-
env:
18-
MYSQL_ROOT_PASSWORD: root
19-
MYSQL_DATABASE: liberu_accounting_testing
20-
ports:
21-
- 3306:3306
22-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
16+
timeout-minutes: 20
2317

2418
steps:
25-
- uses: actions/checkout@v4
26-
27-
- name: Setup PHP
28-
uses: shivammathur/setup-php@v2
29-
with:
30-
php-version: '8.5'
31-
extensions: mbstring, pdo, pdo_mysql, bcmath, opcache, zip, gd, intl
32-
coverage: none
33-
34-
- name: Setup Node.js
35-
uses: actions/setup-node@v4
36-
with:
37-
node-version: '20'
38-
cache: 'npm'
39-
40-
- name: Get composer cache directory
41-
id: composer-cache
42-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
43-
44-
- name: Cache composer dependencies
45-
uses: actions/cache@v4
46-
with:
47-
path: ${{ steps.composer-cache.outputs.dir }}
48-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
49-
restore-keys: ${{ runner.os }}-composer-
50-
51-
- name: Copy environment file
52-
run: cp .env.testing .env
53-
54-
- name: Install dependencies
55-
run: composer install --no-interaction --prefer-dist --optimize-autoloader
56-
57-
- name: Generate application key
58-
run: php artisan key:generate
59-
60-
- name: Run database migrations
61-
run: php artisan migrate:fresh --force
62-
63-
- name: Seed database
64-
run: php artisan db:seed --force
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.5'
25+
extensions: mbstring, pdo, pdo_sqlite, bcmath, opcache, zip, gd, intl
26+
coverage: none
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
cache: 'npm'
33+
34+
- name: Get composer cache directory
35+
id: composer-cache
36+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
37+
38+
- name: Cache composer dependencies
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ steps.composer-cache.outputs.dir }}
42+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
43+
restore-keys: ${{ runner.os }}-composer-
44+
45+
- name: Copy environment file
46+
run: cp .env.example .env
47+
48+
- name: Install PHP dependencies
49+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
50+
51+
- name: Generate application key
52+
run: php artisan key:generate
53+
54+
- name: Create SQLite database
55+
run: touch database/database.sqlite
56+
57+
- name: Run database migrations
58+
run: php artisan migrate:fresh --force
59+
env:
60+
DB_CONNECTION: sqlite
61+
DB_DATABASE: database/database.sqlite
6562

66-
- name: Install npm dependencies
67-
run: npm ci
63+
- name: Seed database
64+
run: php artisan db:seed --force
65+
env:
66+
DB_CONNECTION: sqlite
67+
DB_DATABASE: database/database.sqlite
6868

69-
- name: Build frontend assets
70-
run: npm run build
69+
- name: Install npm dependencies
70+
run: npm ci
7171

72+
- name: Build frontend assets
73+
run: npm run build

.github/workflows/main.yml

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,18 @@ name: Docker
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88
workflow_dispatch:
99

10-
env:
11-
DB_DATABASE: liberu
12-
DB_USERNAME: root
13-
DB_PASSWORD: root
14-
1510
permissions:
1611
contents: read
1712

1813
jobs:
1914
laravel-tests:
2015
runs-on: ubuntu-latest
21-
22-
services:
23-
mysql:
24-
image: mysql:8.0
25-
env:
26-
MYSQL_ROOT_PASSWORD: root
27-
MYSQL_DATABASE: liberu
28-
ports:
29-
- 3306:3306
30-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
16+
timeout-minutes: 15
3117

3218
steps:
3319
- name: Checkout repository
@@ -36,8 +22,8 @@ jobs:
3622
- name: Setup PHP
3723
uses: shivammathur/setup-php@v2
3824
with:
39-
php-version: '8.4'
40-
extensions: mbstring, pdo, pdo_mysql, bcmath, opcache, zip, gd, intl
25+
php-version: '8.5'
26+
extensions: mbstring, pdo, pdo_sqlite, bcmath, opcache, zip, gd, intl
4127
coverage: none
4228

4329
- name: Get composer cache directory
@@ -52,24 +38,26 @@ jobs:
5238
restore-keys: ${{ runner.os }}-composer-
5339

5440
- name: Copy environment file
55-
run: cp .env.testing .env
41+
run: cp .env.example .env
5642

5743
- name: Install dependencies
5844
run: composer install --no-interaction --prefer-dist --optimize-autoloader
5945

6046
- name: Generate application key
6147
run: php artisan key:generate
6248

63-
- name: Run database migrations
64-
run: php artisan migrate:fresh --force
65-
6649
- name: Run tests
67-
run: vendor/bin/phpunit --no-coverage
50+
run: ./vendor/bin/pest --no-coverage
6851

6952
docker:
7053
if: github.event_name == 'push'
7154
needs: laravel-tests
7255
runs-on: ubuntu-latest
56+
timeout-minutes: 30
57+
permissions:
58+
contents: read
59+
packages: write
60+
7361
steps:
7462
- name: Checkout code
7563
uses: actions/checkout@v4
@@ -80,9 +68,12 @@ jobs:
8068
username: ${{ secrets.DOCKERHUB_USERNAME }}
8169
password: ${{ secrets.DOCKERHUB_TOKEN }}
8270

83-
- name: Extract metadata (tags, labels) for Docker
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Extract metadata for Docker
8475
id: meta
85-
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e4288.5
76+
uses: docker/metadata-action@v5
8677
with:
8778
images: liberu/accounting
8879
tags: |
@@ -91,24 +82,13 @@ jobs:
9182
type=semver,pattern={{version}}
9283
type=raw,value=latest,enable={{is_default_branch}}
9384
94-
- name: Set up Docker Buildx
95-
uses: docker/setup-buildx-action@v3
96-
97-
- name: Cache Docker layers
98-
uses: actions/cache@v4
99-
with:
100-
path: /tmp/.buildx-cache
101-
key: ${{ runner.os }}-buildx-${{ github.sha }}
102-
restore-keys: |
103-
${{ runner.os }}-buildx-
104-
10585
- name: Build and push Docker image
106-
uses: docker/build-push-action@263435318d21b8e681c14492fe198.562a7d2c83
86+
uses: docker/build-push-action@v6
10787
with:
10888
context: .
10989
file: Dockerfile
11090
push: true
11191
tags: ${{ steps.meta.outputs.tags }}
11292
labels: ${{ steps.meta.outputs.labels }}
113-
cache-from: type=registry,ref=liberu/control-panel:buildcache
114-
cache-to: type=registry,ref=liberu/control-panel:buildcache,mode=max
93+
cache-from: type=registry,ref=liberu/accounting:buildcache
94+
cache-to: type=registry,ref=liberu/accounting:buildcache,mode=max

0 commit comments

Comments
 (0)