Skip to content

Commit 57f43b9

Browse files
authored
Add Github Actions Workflow (#76)
* Add Github Actions Workflow Remove phan Set phpstan to v1 cleanup gitignore * Add ftp extension for windows
1 parent 7a485af commit 57f43b9

File tree

5 files changed

+127
-357
lines changed

5 files changed

+127
-357
lines changed

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI Joomla Framework
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: 15 2 * * 1
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
composer:
15+
name: Install PHP dependencies
16+
runs-on: ubuntu-latest
17+
container: joomlaprojects/docker-images:php8.1
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/cache@v4
21+
id: cache-php
22+
with:
23+
path: vendor
24+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
25+
- name: Install PHP dependencies
26+
if: steps.cache-php.outputs.cache-hit != 'true'
27+
run: |
28+
git config --global --add safe.directory $GITHUB_WORKSPACE
29+
composer config --global home
30+
composer install --no-progress --ignore-platform-reqs
31+
32+
code-style-php:
33+
name: Check PHP code style
34+
runs-on: ubuntu-latest
35+
container: joomlaprojects/docker-images:php8.1
36+
needs: [composer]
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/cache/restore@v4
40+
with:
41+
path: vendor
42+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
43+
- name: Check PHP code style
44+
env:
45+
PHP_CS_FIXER_IGNORE_ENV: true
46+
run: ./vendor/bin/phpcs --standard=ruleset.xml src/
47+
48+
phpstan:
49+
name: Run PHPstan
50+
runs-on: ubuntu-latest
51+
container: joomlaprojects/docker-images:php8.4
52+
needs: [code-style-php]
53+
continue-on-error: true
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: actions/cache/restore@v4
57+
with:
58+
path: vendor
59+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
60+
- name: Run PHPstan
61+
run: |
62+
./vendor/bin/phpstan --error-format=github
63+
64+
tests-unit-lowest:
65+
name: Run Unit tests
66+
runs-on: ubuntu-latest
67+
container: joomlaprojects/docker-images:php8.1
68+
needs: [code-style-php]
69+
steps:
70+
- uses: actions/checkout@v4
71+
- name: Run Unit tests
72+
run: |
73+
git config --global --add safe.directory $GITHUB_WORKSPACE
74+
composer update --prefer-stable --prefer-lowest
75+
./vendor/bin/phpunit
76+
77+
tests-unit:
78+
name: Run Unit tests
79+
runs-on: ubuntu-latest
80+
container: joomlaprojects/docker-images:php${{ matrix.php_version }}
81+
needs: [code-style-php]
82+
strategy:
83+
matrix:
84+
php_version: ['8.1', '8.2', '8.3']
85+
steps:
86+
- uses: actions/checkout@v4
87+
- name: Run Unit tests
88+
run: |
89+
git config --global --add safe.directory $GITHUB_WORKSPACE
90+
composer update
91+
./vendor/bin/phpunit
92+
93+
tests-unit-windows:
94+
name: Run Unit tests (Windows)
95+
runs-on: windows-latest
96+
needs: [code-style-php]
97+
strategy:
98+
matrix:
99+
php_version: ['8.1', '8.2', '8.3']
100+
steps:
101+
- uses: actions/checkout@v4
102+
- name: Setup PHP
103+
uses: shivammathur/setup-php@v2
104+
with:
105+
php-version: ${{ matrix.php_version }}
106+
extensions: openssl, mbstring, fileinfo, ftp
107+
- name: Install Composer dependencies
108+
run: |
109+
git config --global --add safe.directory $GITHUB_WORKSPACE
110+
composer install --no-progress --ignore-platform-reqs
111+
- name: Run Unit tests
112+
run: php vendor/bin/phpunit

.gitignore

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
/.idea/
2-
build/
1+
# IDE Related Files #
2+
.buildpath
3+
.project
4+
.settings
5+
.DS_Store
6+
.idea
7+
8+
# Composer and test related files #
39
vendor/
410
composer.phar
511
composer.lock
612
phpunit.xml
7-
phpunit.*.xml
8-
.phpunit.result.cache
13+
.phpunit.cache/
14+
.idea/
15+
/.phpunit.result.cache
16+
/.phpunit.cache/

0 commit comments

Comments
 (0)