Skip to content

Commit 7658806

Browse files
committed
Chore/Change license from Apache-2.0 to MIT and add release workflow
1 parent dafe4bc commit 7658806

6 files changed

Lines changed: 215 additions & 278 deletions

File tree

.github/workflows/documentation.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: Documentation
22

33
on:
4-
push:
5-
branches: [ 'main' ]
4+
workflow_run:
5+
workflows: ["Test"]
6+
types: [completed]
7+
branches: [main]
68

79
jobs:
810
publish:
11+
if: github.event.workflow_run.conclusion == 'success'
912
name: Publish Documentation
1013
runs-on: ubuntu-latest
1114

.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/sonar.yml

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

.github/workflows/test.yml

Lines changed: 142 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,86 @@ 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+
- name: Upload coverage artifact
105+
if: matrix.php-version == '8.4'
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: coverage-report
109+
path: |
110+
coverage.xml
111+
test.xml
50112
51-
- name: Execute Unit, Integration and Acceptance Tests
52-
run: composer test
113+
sonarcloud:
114+
name: SonarCloud Analysis
115+
runs-on: ubuntu-latest
116+
needs: [test]
117+
118+
steps:
119+
- name: Checkout
120+
uses: actions/checkout@v4
121+
with:
122+
fetch-depth: 0
123+
124+
- name: Download coverage artifact
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: coverage-report
128+
129+
- name: Fix paths in coverage reports
130+
run: |
131+
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
132+
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' test.xml
133+
134+
- name: SonarCloud Scan
135+
uses: SonarSource/sonarqube-scan-action@v6
136+
env:
137+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
138+
139+
ci-success:
140+
name: CI Success
141+
runs-on: ubuntu-latest
142+
needs: [lint, analyse, test, sonarcloud]
143+
if: always()
144+
145+
steps:
146+
- name: Check all jobs
147+
run: |
148+
echo "===== Job Results ====="
149+
echo "Lint: ${{ needs.lint.result }}"
150+
echo "Analyse: ${{ needs.analyse.result }}"
151+
echo "Test: ${{ needs.test.result }}"
152+
echo "SonarCloud: ${{ needs.sonarcloud.result }}"
153+
echo "======================="
154+
155+
if [ "${{ needs.lint.result }}" != "success" ]; then
156+
echo "❌ Lint failed"
157+
exit 1
158+
fi
159+
160+
if [ "${{ needs.test.result }}" != "success" ]; then
161+
echo "❌ Tests failed"
162+
exit 1
163+
fi
164+
165+
if [ "${{ needs.analyse.result }}" == "failure" ]; then
166+
echo "⚠️ Static analysis failed (non-blocking)"
167+
fi
168+
169+
if [ "${{ needs.sonarcloud.result }}" != "success" ]; then
170+
echo "❌ SonarCloud failed"
171+
exit 1
172+
fi
173+
174+
echo "✅ All required checks passed!"

0 commit comments

Comments
 (0)