ci: php 8.3 added #433
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
# GitHub Action for Herbie | |
name: CI/CD for Herbie | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: CI - Analyse & Test | |
strategy: | |
matrix: | |
# operating-systems: ubuntu-latest, windows-latest, macos-latest | |
operating-system: [ubuntu-latest] | |
# php-versions: 8.0, 8.1, 8.2 | |
php-versions: ['8.0', '8.1', '8.2', '8.3'] | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Docs: https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring | |
coverage: xdebug | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Analyse code with PHP_CodeSniffer | |
run: vendor/bin/phpcs | |
- name: Analyse code with PHPStan | |
run: vendor/bin/phpstan analyse --memory-limit 256M | |
- name: Test code with Codeception | |
run: vendor/bin/codecept run | |
publish: | |
name: CD - Push to server | |
needs: test | |
if: github.ref == 'refs/heads/2.x' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v3 | |
- name: Setup PHP and Composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
tools: composer:v2 | |
- name: Install PHP dependencies | |
run: composer install --working-dir website --no-dev --prefer-dist --no-progress --no-suggest --optimize-autoloader | |
- name: Rename index-prod.php | |
run: rm website/web/index.php && mv website/web/index-prod.php website/web/index.php | |
- name: Deploy to server via scp | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: 22 | |
source: "website" | |
target: ${{ secrets.SSH_TARGET }} | |
rm: true | |
strip_components: 1 |