Skip to content

Commit 1d5aedc

Browse files
[CHORE] Review and update CI & Dependencies (#2109)
* upgrade test build * upgrade SQLite * Upgrade Postgres * Upgrade MySQL * upgrade PHPStan * Upgrade code style * Upgrade Lychee and remove config file * Organize dependencies * Link check should run only ind default branch
1 parent 77557ae commit 1d5aedc

9 files changed

Lines changed: 269 additions & 258 deletions

File tree

.github/lychee.toml

Lines changed: 0 additions & 125 deletions
This file was deleted.

.github/workflows/code-style.yml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,46 @@ on:
66
- "**"
77
paths-ignore:
88
- "art/**"
9-
- "README.md"
9+
- ".github/DISCUSSION_TEMPLATE/**"
10+
- ".github/ISSUE_TEMPLATE/**"
11+
- "**/*.md"
1012
pull_request:
1113
types: [ready_for_review, synchronize, opened]
1214
paths-ignore:
1315
- "art/**"
14-
- "README.md"
16+
- ".github/DISCUSSION_TEMPLATE/**"
17+
- ".github/ISSUE_TEMPLATE/**"
18+
- "**/*.md"
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
permissions:
25+
contents: read
1526

1627
jobs:
1728
build:
1829
runs-on: ubuntu-latest
30+
name: PHP:${{ matrix.php }} / Laravel:${{ matrix.laravel }} / Livewire:${{ matrix.livewire }}
31+
1932
strategy:
20-
fail-fast: false
33+
fail-fast: true
2134
matrix:
2235
php: [ 8.3 ]
23-
laravel: [ 12.* ]
24-
dependency-version: [ prefer-stable ]
25-
26-
name: PHP:${{ matrix.php }} / L:${{ matrix.laravel }}
27-
28-
if: github.ref != 'refs/heads/todo-tests'
36+
laravel: [ 13.* ]
2937

3038
steps:
3139
- name: Checkout
32-
uses: actions/checkout@v4
40+
uses: actions/checkout@v6
41+
with:
42+
persist-credentials: false
3343

3444
- name: Setup PHP, with composer and extensions
3545
uses: shivammathur/setup-php@v2
3646
with:
3747
php-version: ${{ matrix.php }}
38-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
48+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, pdo_mysql, bcmath, soap, intl, gd, exif, iconv
3949
tools: composer:v2
4050
coverage: none
4151

@@ -44,15 +54,25 @@ jobs:
4454
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4555

4656
- name: Cache composer dependencies
47-
uses: actions/cache@v4
57+
uses: actions/cache@v5
4858
with:
49-
path: $(composer config cache-files-dir)
50-
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
59+
path: ${{ steps.composer-cache.outputs.dir }}
60+
key: dependencies-laravel-${{ matrix.laravel }}-livewire-${{ matrix.livewire}}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
61+
restore-keys: |
62+
dependencies-laravel-${{ matrix.laravel }}-livewire-${{ matrix.livewire}}-php-${{ matrix.php }}-
63+
64+
- name: Inject Matrix Dependencies Safely
65+
env:
66+
LARAVEL_VERSION: ${{ matrix.laravel }}
67+
run: >
68+
composer require
69+
"laravel/framework:$LARAVEL_VERSION"
70+
--no-interaction
71+
--no-scripts
72+
--prefer-dist
5173
5274
- name: Install Composer dependencies
53-
run: |
54-
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
55-
composer install
75+
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-scripts
5676

5777
- name: Pint
5878
run: composer test:pint

.github/workflows/lychee.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
name: Check for broken Links
2+
23
on:
3-
pull_request:
4+
push:
45
paths:
56
- '**.md'
6-
push:
7+
pull_request:
8+
types: [ ready_for_review, synchronize, opened ]
79
paths:
810
- '**.md'
911

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
1019
jobs:
1120
linkChecker:
21+
# Runs only when push/PR are targeting the default branch
22+
if: |
23+
(github.event_name == 'push' && github.ref_name == github.event.repository.default_branch) ||
24+
(github.event_name == 'pull_request' && github.base_ref == github.event.repository.default_branch)
1225
runs-on: ubuntu-latest
1326
steps:
14-
- uses: actions/checkout@v3
27+
- name: Checkout Codebase
28+
uses: actions/checkout@v6
29+
with:
30+
persist-credentials: false
1531

1632
- name: 🔗 Check Links
17-
uses: lycheeverse/lychee-action@v2.0.2
33+
uses: lycheeverse/lychee-action@v2
1834
with:
1935
fail: true
20-
args: --config .github/lychee.toml './**/*.md'
36+
args: >-
37+
--base-url "https://github.com/$REPO_OWNER_PATH/blob/$BRANCH_NAME/"
38+
--user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
39+
--exclude "https?://(www\.)?(twitter\.com|x\.com|instagram\.com|linkedin\.com)"
40+
--exclude "\.(png|jpg|jpeg|gif|svg|webp|ico)(\?.*)?$"
41+
--max-retries 3
42+
--retry-wait-time 5
43+
--verbose
44+
--no-progress
45+
"**/*.md"
2146
env:
22-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
REPO_OWNER_PATH: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
49+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

.github/workflows/mysql.yml

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,64 @@ on:
88
- "art/**"
99
- ".github/DISCUSSION_TEMPLATE/**"
1010
- ".github/ISSUE_TEMPLATE/**"
11-
- ".github/PULL_REQUEST_TEMPLATE.md"
12-
- "README.md"
13-
- "CONTRIBUTING.md"
11+
- "**/*.md"
1412
pull_request:
1513
types: [ready_for_review, synchronize, opened]
1614
paths-ignore:
1715
- "art/**"
1816
- ".github/DISCUSSION_TEMPLATE/**"
1917
- ".github/ISSUE_TEMPLATE/**"
20-
- ".github/PULL_REQUEST_TEMPLATE.md"
21-
- "README.md"
22-
- "CONTRIBUTING.md"
18+
- "**/*.md"
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
permissions:
25+
contents: read
2326

2427
jobs:
2528
build:
2629
runs-on: ubuntu-latest
30+
name: PHP:${{ matrix.php }} / Laravel:${{ matrix.laravel }} / Livewire:${{ matrix.livewire }}
2731

2832
services:
2933
mysql:
3034
image: mysql:5.7
3135
env:
32-
MYSQL_ROOT_PASSWORD: password
36+
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD || 'password' }}
3337
MYSQL_DATABASE: powergridtest
3438
ports:
3539
- 3307:3306
36-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
40+
options: >-
41+
--health-cmd="mysqladmin ping"
42+
--health-interval=10s
43+
--health-timeout=5s
44+
--health-retries=3
3745
3846
strategy:
39-
fail-fast: false
47+
fail-fast: true
4048
matrix:
41-
php: [ 8.4, 8.3 ]
42-
laravel: [ 11.*, 12.* ]
43-
livewire: [ 3.*, 4.* ]
44-
dependency-version: [ prefer-stable ]
45-
46-
name: PHP:${{ matrix.php }} / Laravel:${{ matrix.laravel }} / Livewire:${{ matrix.livewire }}
49+
php: [ 8.5, 8.4, 8.3, 8.2 ]
50+
laravel: [ 13.*, 12.*, 11.* ]
51+
livewire: [ 4.*, 3.* ]
52+
exclude:
53+
- php: 8.5
54+
laravel: 11.*
55+
- php: 8.2
56+
laravel: 13.*
4757

4858
steps:
4959
- name: Checkout
50-
uses: actions/checkout@v4
60+
uses: actions/checkout@v6
61+
with:
62+
persist-credentials: false
5163

5264
- name: Setup PHP, with composer and extensions
5365
uses: shivammathur/setup-php@v2
5466
with:
5567
php-version: ${{ matrix.php }}
56-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
68+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, bcmath, soap, intl, gd, exif, iconv
5769
tools: composer:v2
5870
coverage: none
5971

@@ -62,18 +74,34 @@ jobs:
6274
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
6375

6476
- name: Cache composer dependencies
65-
uses: actions/cache@v4
77+
uses: actions/cache@v5
6678
with:
67-
path: $(composer config cache-files-dir)
79+
path: ${{ steps.composer-cache.outputs.dir }}
6880
key: dependencies-laravel-${{ matrix.laravel }}-livewire-${{ matrix.livewire}}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
81+
restore-keys: |
82+
dependencies-laravel-${{ matrix.laravel }}-livewire-${{ matrix.livewire}}-php-${{ matrix.php }}-
6983
70-
- name: Install Composer dependencies
71-
run: |
72-
composer require "laravel/framework:${{ matrix.laravel }}" "livewire/livewire:${{ matrix.livewire }}" --no-interaction --no-update
73-
composer install
84+
- name: Inject Matrix Dependencies Safely
85+
env:
86+
LARAVEL_VERSION: ${{ matrix.laravel }}
87+
LIVEWIRE_VERSION: ${{ matrix.livewire }}
88+
run: >
89+
composer require
90+
"laravel/framework:$LARAVEL_VERSION"
91+
"livewire/livewire:$LIVEWIRE_VERSION"
92+
"openspout/openspout:^4.23"
93+
--no-interaction
94+
--no-update
7495
75-
- name: Install openspout/openspout v4
76-
run: composer require openspout/openspout ^4.23
96+
- name: Install Composer dependencies
97+
run: composer install --no-progress --optimize-autoloader --no-scripts
7798

78-
- name: MySQL
99+
- name: MySQL Tests
100+
env:
101+
DB_CONNECTION: mysql
102+
DB_DATABASE: powergridtest
103+
DB_HOST: 127.0.0.1
104+
DB_USERNAME: root
105+
DB_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD || 'password' }}
106+
DB_PORT: 3307
79107
run: composer test:mysql

0 commit comments

Comments
 (0)