管理者用のページ・ルーティングの作成 #220
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Laravel | |
on: | |
pull_request: | |
branches: ["*"] | |
jobs: | |
php-unit: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
services: | |
mysql: | |
image: mysql:5.7 | |
ports: | |
- 3306:3306 | |
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: testdatabase | |
env: | |
DB_CONNECTION: mysql | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 3306 | |
DB_DATABASE: testdatabase | |
DB_USERNAME: root | |
DB_PASSWORD: password | |
steps: | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.0" | |
- uses: actions/checkout@v3 | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Composer Install | |
run: composer install -n --prefer-dist | |
- name: VCmposer Dump Autoload | |
run: composer dump-autoload | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
run: vendor/bin/phpunit | |
- name: Calculate coverage | |
id: coverage | |
run: | | |
php artisan test --coverage | tee coverage.txt | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "coverage<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(cat coverage.txt)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: Create comment | |
uses: actions/github-script@v6 | |
env: | |
COVERAGE: ${{ steps.coverage.outputs.coverage }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const script = require('./.github/workflows/create-coverage-comment.js') | |
script({github, context}) | |
php-cs-fixer: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.0" | |
- uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --prefer-dist --working-dir=tools/php-cs-fixer | |
- name: PHP-CS-Fixer Version | |
run: ./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --version | |
- name: PHP-CS-Fixer Dry Run | |
run: ./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --verbose --dry-run |