Skip to content

Commit 3bdea0c

Browse files
committed
Feature: Update license from Apache-2.0 to MIT and add release workflow
1 parent 3198f19 commit 3bdea0c

4 files changed

Lines changed: 169 additions & 222 deletions

File tree

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
validate:
10+
name: Validate Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Validate Branch
20+
run: |
21+
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
22+
23+
if ! git merge-base --is-ancestor $TAG_COMMIT origin/main; then
24+
echo "❌ ERROR: Tag ${{ github.ref_name }} is not on main branch"
25+
echo "Tags must be created from commits that are on main."
26+
exit 1
27+
fi
28+
29+
echo "✅ Tag ${{ github.ref_name }} is on main branch"
30+
31+
github-release:
32+
name: Update GitHub Release
33+
runs-on: ubuntu-latest
34+
needs: [validate]
35+
36+
permissions:
37+
contents: write
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Update Release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
generate_release_notes: true

.github/workflows/test.yml

Lines changed: 101 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,84 @@ name: Test
22

33
on:
44
push:
5-
branches: [ 'main' ]
5+
branches: [main]
66
pull_request:
7-
types: [ 'opened', 'synchronize', 'reopened' ]
7+
branches: [main]
8+
types: [opened, synchronize, reopened]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
813

914
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set up PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: "8.3"
27+
tools: composer:v2
28+
29+
- name: Cache dependencies
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.composer/cache
33+
key: php-8.3-composer-${{ hashFiles('**/composer.json') }}
34+
restore-keys: php-8.3-composer-
35+
36+
- name: Install dependencies
37+
run: composer install --prefer-dist --no-progress
38+
39+
- name: Check code style
40+
run: composer pint-test
41+
42+
analyse:
43+
name: Static Analysis
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Set up PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: "8.3"
54+
tools: composer:v2
55+
56+
- name: Cache dependencies
57+
uses: actions/cache@v4
58+
with:
59+
path: ~/.composer/cache
60+
key: php-8.3-composer-${{ hashFiles('**/composer.json') }}
61+
restore-keys: php-8.3-composer-
62+
63+
- name: Install dependencies
64+
run: composer install --prefer-dist --no-progress
65+
66+
- name: Run PHPStan
67+
run: composer analyse
68+
continue-on-error: true
69+
1070
test:
11-
name: Test on PHP ${{ matrix.php-version }}
71+
name: Test (PHP ${{ matrix.php-version }})
1272
runs-on: ubuntu-latest
73+
needs: [lint]
1374

1475
strategy:
76+
fail-fast: false
1577
matrix:
16-
php-version: [ '8.2', '8.3', '8.4' ]
78+
php-version: ["8.2", "8.3", "8.4"]
1779

1880
steps:
19-
- name: Checkout source code
20-
uses: actions/checkout@v2
21-
with:
22-
fetch-depth: 0
81+
- name: Checkout
82+
uses: actions/checkout@v4
2383

2484
- name: Set up PHP ${{ matrix.php-version }}
2585
uses: shivammathur/setup-php@v2
@@ -29,24 +89,45 @@ jobs:
2989
tools: composer:v2
3090

3191
- name: Cache dependencies
32-
uses: actions/cache@v4.3.0
92+
uses: actions/cache@v4
3393
with:
3494
path: ~/.composer/cache
3595
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
3696
restore-keys: php-${{ matrix.php-version }}-composer-
3797

38-
- name: Validate composer.json and composer.lock
39-
run: composer validate
40-
41-
- name: Install Dependencies
42-
if: steps.composer-cache.outputs.cache-hit != 'true'
98+
- name: Install dependencies
4399
run: composer install --prefer-dist --no-progress
44100

45-
- name: Check Code Style
46-
run: composer pint-test
101+
- name: Run tests
102+
run: composer test
47103

48-
- name: Execute Static Code analysis
49-
run: composer analyse
104+
ci-success:
105+
name: CI Success
106+
runs-on: ubuntu-latest
107+
needs: [lint, analyse, test]
108+
if: always()
50109

51-
- name: Execute Unit, Integration and Acceptance Tests
52-
run: composer test
110+
steps:
111+
- name: Check all jobs
112+
run: |
113+
echo "===== Job Results ====="
114+
echo "Lint: ${{ needs.lint.result }}"
115+
echo "Analyse: ${{ needs.analyse.result }}"
116+
echo "Test: ${{ needs.test.result }}"
117+
echo "======================="
118+
119+
if [ "${{ needs.lint.result }}" != "success" ]; then
120+
echo "❌ Lint failed"
121+
exit 1
122+
fi
123+
124+
if [ "${{ needs.test.result }}" != "success" ]; then
125+
echo "❌ Tests failed"
126+
exit 1
127+
fi
128+
129+
if [ "${{ needs.analyse.result }}" == "failure" ]; then
130+
echo "⚠️ Static analysis failed (non-blocking)"
131+
fi
132+
133+
echo "✅ All required checks passed!"

0 commit comments

Comments
 (0)