Skip to content

Commit

Permalink
Merge pull request #20 from kenjis/update-ci-431
Browse files Browse the repository at this point in the history
CodeIgniterを4.3に更新
  • Loading branch information
kenjis authored Feb 13, 2023
2 parents da4867f + e430a60 commit b324307
Show file tree
Hide file tree
Showing 48 changed files with 1,138 additions and 1,055 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- composer.*
- phpcs.xml
- '.github/workflows/**'
workflow_dispatch:

jobs:
coding-standards:
Expand All @@ -27,17 +28,16 @@ jobs:
tools: cs2pr
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v2
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
pull_request:
branches:
- develop
paths:
- 'app/**'
- 'tests/**'
- composer.*
- phpunit.xml.dist
- '.github/workflows/**'
workflow_dispatch:

jobs:
main:
Expand Down Expand Up @@ -45,25 +47,20 @@ jobs:
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
# To prevent rate limiting you may need to supply an OAuth token in Settings > Secrets
# env:
# https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Test with PHPUnit
run: script -e -c "vendor/bin/phpunit -v --coverage-text"
Expand Down
110 changes: 34 additions & 76 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- develop
paths:
- 'app/**'
- 'tests/**'
- composer.*
Expand All @@ -12,14 +13,17 @@ on:
- phpstan.neon
- psalm.xml
- '.github/workflows/**'
workflow_dispatch:

jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -28,17 +32,16 @@ jobs:
tools: cs2pr
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v2
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
Expand All @@ -48,11 +51,13 @@ jobs:
run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr

static-analysis-psalm:
name: Static Analysis with Psalm
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -61,18 +66,10 @@ jobs:
tools: cs2pr
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
Expand All @@ -81,28 +78,29 @@ jobs:
run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr

static-analysis-phpmd:
name: Static Analysis with PHPMD
name: PHPMD
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v2
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
Expand All @@ -112,67 +110,27 @@ jobs:
run: ./vendor/bin/phpmd app text ./phpmd.xml --exclude */app/Config,*/app/Views

static-analysis-php-metrics:
name: Static Analysis with PhpMetrics
name: PhpMetrics
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PhpMetrics
run: ./vendor/bin/phpmetrics app --exclude='Config,Database,Language,ThirdParty,Views'

# static-analysis-composer-require-checker:
# name: Static Analysis with ComposerRequireChecker
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: 8.1
# coverage: none
# tools: composer-require-checker
# env:
# COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Get composer cache directory
# id: composer-cache
# run: echo "::set-output name=dir::$(composer config cache-files-dir)"
#
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ runner.os }}-composer-
#
# - name: Install dependencies
# run: |
# composer install --no-progress --no-scripts --no-dev
#
# - name: Run composer-require-checker
# run: composer-require-checker check composer.json
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

### アプリ

- CodeIgniter 4.2.6 ([ci4-app-template](https://github.com/kenjis/ci4-app-template) を使用)
- PHP 8.1.11
- Composer 2.4.2
- CodeIgniter 4.3.1 ([ci4-app-template](https://github.com/kenjis/ci4-app-template) を使用)
- PHP 8.1.13
- Composer 2.5.1
- MySQL 5.7

### 受入テスト

- selenium-server 4.5.0
- geckodriver 0.31.0
- geckodriver 0.32.0

## 「CodeIgniter 3.xで動作するように更新したもの」からの変更点

Expand Down Expand Up @@ -94,7 +94,8 @@ MySQLにデータベースとユーザーを作成します。

```
CREATE DATABASE `codeigniter` DEFAULT CHARACTER SET utf8mb4;
GRANT ALL PRIVILEGES ON codeigniter.* TO username@localhost IDENTIFIED BY 'password';
CREATE USER username@localhost IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON codeigniter.* TO username@localhost;
```

### データベースマイグレーションとシーディングの実行
Expand Down
2 changes: 1 addition & 1 deletion app/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the frameworks
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
Expand Down
Loading

0 comments on commit b324307

Please sign in to comment.