Skip to content

Commit 40cd12b

Browse files
authored
Merge pull request #811 from kenjis/reuse-workflows
chore: use workflows in codeigniter4/.github
2 parents 202ed04 + fdf6af2 commit 40cd12b

File tree

11 files changed

+24
-564
lines changed

11 files changed

+24
-564
lines changed

.github/workflows/deptrac.yml

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,8 @@ name: Deptrac
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- 'composer.*'
10-
- 'depfile.yaml'
11-
- '.github/workflows/deptrac.yml'
125
push:
13-
branches:
14-
- develop
15-
paths:
16-
- '**.php'
17-
- 'composer.*'
18-
- 'depfile.yaml'
19-
- '.github/workflows/deptrac.yml'
206

217
jobs:
22-
build:
23-
name: Dependency Tracing
24-
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26-
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
30-
31-
- name: Set up PHP
32-
uses: shivammathur/setup-php@v2
33-
with:
34-
php-version: '8.1'
35-
tools: phive
36-
extensions: intl, json, mbstring, xml
37-
coverage: none
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
41-
- name: Get composer cache directory
42-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
43-
44-
- name: Cache composer dependencies
45-
uses: actions/cache@v3
46-
with:
47-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
48-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
49-
restore-keys: ${{ runner.os }}-composer-
50-
51-
- name: Create Deptrac cache directory
52-
run: mkdir -p build/
53-
54-
- name: Cache Deptrac results
55-
uses: actions/cache@v3
56-
with:
57-
path: build
58-
key: ${{ runner.os }}-deptrac-${{ github.sha }}
59-
restore-keys: ${{ runner.os }}-deptrac-
60-
61-
- name: Install dependencies
62-
run: |
63-
if [ -f composer.lock ]; then
64-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
65-
else
66-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
67-
fi
68-
69-
- name: Trace dependencies
70-
run: |
71-
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
72-
deptrac analyze --cache-file=build/deptrac.cache
8+
deptrac:
9+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main

.github/workflows/phpcsfixer.yml

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,8 @@ name: PHPCSFixer
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- '.github/workflows/phpcsfixer.yml'
105
push:
11-
branches:
12-
- develop
13-
paths:
14-
- '**.php'
15-
- '.github/workflows/phpcsfixer.yml'
166

177
jobs:
18-
build:
19-
name: PHP ${{ matrix.php-versions }} Coding Standards
20-
runs-on: ubuntu-latest
21-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
php-versions: ['7.4', '8.0', '8.1']
26-
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
30-
31-
- name: Set up PHP
32-
uses: shivammathur/setup-php@v2
33-
with:
34-
php-version: ${{ matrix.php-versions }}
35-
extensions: json, tokenizer
36-
coverage: none
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Get composer cache directory
41-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
42-
43-
- name: Cache composer dependencies
44-
uses: actions/cache@v3
45-
with:
46-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
47-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
48-
restore-keys: ${{ runner.os }}-composer-
49-
50-
- name: Install dependencies
51-
run: |
52-
if [ -f composer.lock ]; then
53-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
54-
else
55-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
56-
fi
57-
58-
- name: Check code for standards compliance
59-
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff
8+
phpcsfixer:
9+
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main

.github/workflows/phpstan.yml

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,8 @@ name: PHPStan
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- 'composer.*'
10-
- 'phpstan*'
11-
- '.github/workflows/phpstan.yml'
125
push:
13-
branches:
14-
- develop
15-
paths:
16-
- '**.php'
17-
- 'composer.*'
18-
- 'phpstan*'
19-
- '.github/workflows/phpstan.yml'
206

217
jobs:
22-
build:
23-
name: PHP ${{ matrix.php-versions }} Static Analysis
24-
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26-
strategy:
27-
fail-fast: false
28-
matrix:
29-
php-versions: ['7.4', '8.0', '8.1']
30-
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
35-
- name: Setup PHP
36-
uses: shivammathur/setup-php@v2
37-
with:
38-
php-version: ${{ matrix.php-versions }}
39-
tools: phpstan, phpunit
40-
extensions: intl, json, mbstring, xml
41-
coverage: none
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
45-
- name: Get composer cache directory
46-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
47-
48-
- name: Cache composer dependencies
49-
uses: actions/cache@v3
50-
with:
51-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
52-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
53-
restore-keys: ${{ runner.os }}-composer-
54-
55-
- name: Create PHPStan cache directory
56-
run: mkdir -p build/phpstan
57-
58-
- name: Cache PHPStan results
59-
uses: actions/cache@v3
60-
with:
61-
path: build/phpstan
62-
key: ${{ runner.os }}-phpstan-${{ github.sha }}
63-
restore-keys: ${{ runner.os }}-phpstan-
64-
65-
- name: Install dependencies
66-
run: |
67-
if [ -f composer.lock ]; then
68-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
69-
else
70-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
71-
fi
72-
73-
- name: Run static analysis
74-
run: vendor/bin/phpstan analyze
8+
phpstan:
9+
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main

.github/workflows/phpunit.yml

Lines changed: 2 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -2,184 +2,8 @@ name: PHPUnit
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- 'composer.*'
10-
- 'phpunit*'
11-
- '.github/workflows/phpunit.yml'
125
push:
13-
branches:
14-
- develop
15-
paths:
16-
- '**.php'
17-
- 'composer.*'
18-
- 'phpunit*'
19-
- '.github/workflows/phpunit.yml'
206

217
jobs:
22-
main:
23-
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.dependencies }}
24-
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26-
strategy:
27-
matrix:
28-
php-versions: ['7.4', '8.0', '8.1', '8.2']
29-
db-platforms: ['MySQLi', 'SQLite3']
30-
mysql-versions: ['5.7']
31-
dependencies: ['highest']
32-
include:
33-
# MySQL 8.0
34-
- php-versions: '7.4'
35-
db-platforms: MySQLi
36-
mysql-versions: '8.0'
37-
dependencies: 'highest'
38-
# Lowest Dependency
39-
- php-versions: '7.4'
40-
db-platforms: MySQLi
41-
mysql-versions: '5.7'
42-
dependencies: 'lowest'
43-
# Postgre
44-
- php-versions: '7.4'
45-
db-platforms: Postgre
46-
mysql-versions: '5.7'
47-
dependencies: 'highest'
48-
# SQLSRV
49-
- php-versions: '7.4'
50-
db-platforms: SQLSRV
51-
mysql-versions: '5.7'
52-
dependencies: 'highest'
53-
# OCI8
54-
- php-versions: '7.4'
55-
db-platforms: OCI8
56-
mysql-versions: '5.7'
57-
dependencies: 'highest'
58-
59-
services:
60-
mysql:
61-
image: mysql:${{ matrix.mysql-versions }}
62-
env:
63-
MYSQL_ALLOW_EMPTY_PASSWORD: yes
64-
MYSQL_DATABASE: test
65-
ports:
66-
- 3306:3306
67-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
68-
69-
postgres:
70-
image: postgres
71-
env:
72-
POSTGRES_USER: postgres
73-
POSTGRES_PASSWORD: postgres
74-
POSTGRES_DB: test
75-
ports:
76-
- 5432:5432
77-
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
78-
79-
mssql:
80-
image: mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
81-
env:
82-
SA_PASSWORD: 1Secure*Password1
83-
ACCEPT_EULA: Y
84-
MSSQL_PID: Developer
85-
ports:
86-
- 1433:1433
87-
options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION'" --health-interval=10s --health-timeout=5s --health-retries=3
88-
89-
oracle:
90-
image: quillbuilduser/oracle-18-xe
91-
env:
92-
ORACLE_ALLOW_REMOTE: true
93-
ports:
94-
- 1521:1521
95-
options: --health-cmd="/opt/oracle/product/18c/dbhomeXE/bin/sqlplus -s sys/Oracle18@oracledbxe/XE as sysdba <<< 'SELECT 1 FROM DUAL'" --health-interval=10s --health-timeout=5s --health-retries=3
96-
97-
steps:
98-
- name: Create database for MSSQL Server
99-
if: matrix.db-platforms == 'SQLSRV'
100-
run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"
101-
102-
- name: Install Oracle InstantClient
103-
if: matrix.db-platforms == 'OCI8'
104-
run: |
105-
sudo apt-get install wget libaio1 alien
106-
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
107-
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
108-
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
109-
sudo alien oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
110-
sudo alien oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
111-
sudo alien oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
112-
sudo dpkg -i oracle-instantclient18.5-basic_18.5.0.0.0-4_amd64.deb oracle-instantclient18.5-devel_18.5.0.0.0-4_amd64.deb oracle-instantclient18.5-sqlplus_18.5.0.0.0-4_amd64.deb
113-
echo "LD_LIBRARY_PATH=/lib/oracle/18.5/client64/lib/" >> $GITHUB_ENV
114-
echo "NLS_LANG=AMERICAN_AMERICA.UTF8" >> $GITHUB_ENV
115-
echo "C_INCLUDE_PATH=/usr/include/oracle/18.5/client64" >> $GITHUB_ENV
116-
echo 'NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
117-
echo 'NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
118-
echo 'NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
119-
120-
- name: Create database for Oracle Database
121-
if: matrix.db-platforms == 'OCI8'
122-
run: echo -e "ALTER SESSION SET CONTAINER = XEPDB1;\nCREATE BIGFILE TABLESPACE \"TEST\" DATAFILE '/opt/oracle/product/18c/dbhomeXE/dbs/TEST' SIZE 10M AUTOEXTEND ON MAXSIZE UNLIMITED SEGMENT SPACE MANAGEMENT AUTO EXTENT MANAGEMENT LOCAL AUTOALLOCATE;\nCREATE USER \"ORACLE\" IDENTIFIED BY \"ORACLE\" DEFAULT TABLESPACE \"TEST\" TEMPORARY TABLESPACE TEMP QUOTA UNLIMITED ON \"TEST\";\nGRANT CONNECT,RESOURCE TO \"ORACLE\";\nexit;" | /lib/oracle/18.5/client64/bin/sqlplus -s sys/Oracle18@localhost:1521/XE as sysdba
123-
124-
- name: Checkout
125-
uses: actions/checkout@v4
126-
127-
- name: Set up PHP
128-
uses: shivammathur/setup-php@v2
129-
with:
130-
php-version: ${{ matrix.php-versions }}
131-
tools: composer, phive, phpunit
132-
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3, sqlsrv, oci8, pgsql
133-
coverage: xdebug
134-
env:
135-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136-
137-
- name: Get composer cache directory
138-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
139-
140-
- name: Cache composer dependencies
141-
uses: actions/cache@v3
142-
with:
143-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
144-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
145-
restore-keys: ${{ runner.os }}-composer-
146-
147-
- name: Install dependencies
148-
run: |
149-
if [ -f composer.lock ]; then
150-
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
151-
else
152-
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
153-
fi
154-
env:
155-
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}
156-
157-
- name: Test with PHPUnit
158-
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
159-
env:
160-
DB: ${{ matrix.db-platforms }}
161-
TERM: xterm-256color
162-
TACHYCARDIA_MONITOR_GA: enabled
163-
164-
- if: matrix.php-versions == '8.0'
165-
name: Run Coveralls
166-
continue-on-error: true
167-
run: |
168-
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
169-
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
170-
env:
171-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172-
COVERALLS_PARALLEL: true
173-
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
174-
175-
coveralls:
176-
needs: [main]
177-
name: Coveralls Finished
178-
runs-on: ubuntu-latest
179-
steps:
180-
- name: Upload Coveralls results
181-
uses: coverallsapp/github-action@master
182-
continue-on-error: true
183-
with:
184-
github-token: ${{ secrets.GITHUB_TOKEN }}
185-
parallel-finished: true
8+
phpunit:
9+
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main

0 commit comments

Comments
 (0)