Skip to content

Commit 9afc444

Browse files
committed
chore(ci): add config for automated releases
1 parent cd43a4e commit 9afc444

File tree

5 files changed

+86
-16
lines changed

5 files changed

+86
-16
lines changed

.github/workflows/main.yml renamed to .github/workflows/prs.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
name: CI
2-
3-
on: [push, pull_request]
4-
2+
on:
3+
pull_request:
54
jobs:
65
tests:
76
runs-on: ubuntu-latest
8-
97
strategy:
108
matrix:
119
php: [8.3, 8.4]
12-
1310
steps:
1411
- name: Checkout code
1512
uses: actions/checkout@v4
@@ -20,10 +17,8 @@ jobs:
2017
php-version: ${{ matrix.php }}
2118
extensions: pdo, sqlite, imagick
2219
coverage: none
23-
2420
- name: Validate composer.json and composer.lock
2521
run: composer validate
26-
2722
- name: Install dependencies
2823
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
2924
- name: Run ECS

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Automated release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
static_analysis:
8+
name: Static Analysis
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Setup PHP with PECL extension
13+
uses: shivammathur/setup-php@v2
14+
with:
15+
php-version: '8.4'
16+
- uses: ramsey/composer-install@v3
17+
- name: Initialize cache
18+
uses: actions/cache@v4
19+
with:
20+
key: phpstan
21+
path: .phpstan-cache
22+
- name: Run PHPStan
23+
run: vendor/bin/phpstan
24+
- name: Run ECS
25+
run: php vendor/bin/ecs
26+
tests:
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
php: [8.3, 8.4]
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: ${{ matrix.php }}
39+
extensions: pdo, sqlite, imagick
40+
coverage: none
41+
- uses: ramsey/composer-install@v3
42+
- name: Run test suite
43+
run: |
44+
php vendor/bin/codecept build
45+
php vendor/bin/codecept run
46+
release:
47+
name: Automated release
48+
needs:
49+
- static_analysis
50+
- tests
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
persist-credentials: false
56+
- uses: actions/setup-node@v4
57+
with:
58+
node-version: 22
59+
- run: >
60+
npx
61+
-p "@semantic-release/commit-analyzer"
62+
-p "@semantic-release/release-notes-generator"
63+
-p conventional-changelog-conventionalcommits
64+
-p semantic-release
65+
-- semantic-release
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.COLLECTHOR_FINE_GRAINED_RELEASE }}
68+
permissions:
69+
packages: write
70+
contents: write
71+
pull-requests: write

.releaserc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"branches": ["master"],
3+
"plugins": [
4+
["@semantic-release/commit-analyzer", {
5+
"preset": "conventionalcommits",
6+
"presetConfig": {}
7+
}],
8+
"@semantic-release/github",
9+
"@semantic-release/release-notes-generator"]
10+
}

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,12 +1956,6 @@ parameters:
19561956
count: 1
19571957
path: tests/cases/simple/helpers/EmptyString.php
19581958

1959-
-
1960-
message: '#^Parameter \#1 \$directory of function tempnam expects string, null given\.$#'
1961-
identifier: argument.type
1962-
count: 3
1963-
path: tests/cases/sqlite/config.php
1964-
19651959
-
19661960
message: '#^Cannot call method get\(\) on yii\\base\\Application\|null\.$#'
19671961
identifier: method.nonObject

tests/cases/sqlite/config.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
'components' => [
1010
'db' => [
1111
'class' => yii\db\Connection::class,
12-
'dsn' => 'sqlite:' . tempnam(null, '/file0'),
12+
'dsn' => 'sqlite:' . tempnam('', '/file0'),
1313
],
1414
'db1' => [
1515
'class' => yii\db\Connection::class,
16-
'dsn' => 'sqlite:' . tempnam(null, '/file1'),
16+
'dsn' => 'sqlite:' . tempnam('', '/file1'),
1717
],
1818
'db21' => [
1919
'class' => yii\db\Connection::class,
20-
'dsn' => 'sqlite:' . ($name = tempnam(null, '/file2')),
20+
'dsn' => 'sqlite:' . ($name = tempnam('', '/file2')),
2121
],
2222
'db22' => [
2323
'class' => yii\db\Connection::class,

0 commit comments

Comments
 (0)