🧪
phpunitをGitHubActionsで行うCI/CD環境の構築方法
概要
プロジェクトでphpunit
の自動化テストをGitHubActionsで自動化したので紹介します
やり方
.github/workflows/main.yml
name: CodeCheck
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: dokcer-compose up
run: |
# docker-compose build
docker-compose up -d
- name: composer install
run: |
docker-compose exec -T laravel bash -c "composer install"
- name: phpunit
run: |
docker-compose exec -T laravel bash -c "php vendor/bin/phpunit"
Discussion