[ci] package-updates #521
This file contains hidden or 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
| # This is a basic workflow to help you get started with Actions | |
| name: CI | |
| on: | |
| push: | |
| branches: [master] | |
| tags: ["**"] | |
| pull_request: | |
| branches: [master, develop] | |
| jobs: | |
| stan: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: .env | |
| run: php -r "copy('.env.ci', '.env');" | |
| - uses: ./.github/actions/php | |
| - name: Run PHP Stan | |
| run: composer run stan | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| test_suite: [Unit, Feature] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: .env | |
| run: php -r "copy('.env.ci', '.env');" | |
| - uses: ./.github/actions/php | |
| - uses: ./.github/actions/mysql | |
| - name: Test | |
| run: php artisan test --env=local --testsuite=${{ matrix.test_suite }} | |
| - name: Upload Laravel Logs | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: TestLaravelLog-${{ matrix.test_suite }} | |
| path: storage/logs | |
| deploy: | |
| # tag push -> テスト通過後デプロイ | |
| needs: test | |
| if: ${{ success() && startsWith( github.ref, 'refs/tags/' ) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install SSH key | |
| run: > | |
| mkdir -p ~/.ssh | |
| && echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa | |
| && chmod 0600 ~/.ssh/id_rsa | |
| && echo "${{ secrets.KNOWN_HOSTS }}" >> ~/.ssh/known_hosts | |
| - name: Deploy | |
| run: > | |
| ssh -i /home/runner/.ssh/id_rsa ${{ secrets.USER }}@${{ secrets.HOST }} " | |
| cd ${{ secrets.APP_DIR }} | |
| && git fetch -p | |
| && git checkout ${{ github.ref }} | |
| && bash -c 'sed -i ".bak" "s/APP_VERSION=.*/APP_VERSION=$( git describe --tags --abbrev=0 )/" .env' | |
| && php -c ~/www/php.ini ~/bin/composer.phar install --optimize-autoloader --no-dev | |
| && php -c ~/www/php.ini artisan migrate --force | |
| && php -c ~/www/php.ini artisan migrate:status | |
| && php -c ~/www/php.ini artisan optimize:clear | |
| && php -c ~/www/php.ini artisan optimize | |
| && php -c ~/www/php.ini artisan event:cache | |
| && php -c ~/www/php.ini artisan view:cache | |
| && php -c ~/www/php.ini artisan view:cache" |