Skip to content

Commit 7dceb76

Browse files
authored
Add CI workflow for testing and coding standards
cs, stan は無効化
1 parent 86ef2bd commit 7dceb76

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
push
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
testsuite:
11+
runs-on: ubuntu-22.04
12+
strategy:
13+
fail-fast: false
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup Service
19+
run: |
20+
sudo service mysql start
21+
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;'
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: 8.3
27+
extensions: mbstring, intl, apcu, sqlite, pdo_sqlite, pdo_mysql
28+
ini-values: apc.enable_cli = 1
29+
30+
- name: Get composer cache directory
31+
id: composer-cache
32+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
33+
34+
- name: Cache composer dependencies
35+
uses: actions/cache@v4
36+
with:
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
39+
40+
- name: composer install
41+
run: |
42+
composer install
43+
44+
- name: Run PHPUnit
45+
run: |
46+
export DB_URL='mysql://root:[email protected]/cakephp'
47+
vendor/bin/phpunit
48+
49+
coding-standard:
50+
if: false
51+
name: Coding Standard & Static Analysis
52+
runs-on: ubuntu-22.04
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup PHP
58+
uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: 8.3
61+
extensions: mbstring, intl, apcu, sqlite, pdo_sqlite, pdo_mysql
62+
ini-values: apc.enable_cli = 1
63+
64+
- name: Get composer cache directory
65+
id: composer-cache
66+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
67+
68+
- name: Cache composer dependencies
69+
uses: actions/cache@v4
70+
with:
71+
path: ${{ steps.composer-cache.outputs.dir }}
72+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
73+
74+
- name: composer install
75+
run: |
76+
composer install
77+
78+
- name: Run PHP CodeSniffer
79+
run: ./vendor/bin/phpcs --colors -p
80+
81+
- name: Run phpstan
82+
if: success() || failure()
83+
run: ./vendor/bin/phpstan analyze

0 commit comments

Comments
 (0)