nit: Run pint through app #778
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: Docker Build Dev | |
on: | |
push: | |
branches: [ develop ] | |
jobs: | |
laravel-test-sqlite: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Installing PHP | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: '8.2' | |
- name: Get Composer Cache Directory 2 | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: actions-cache | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}" | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Cache PHP dependencies | |
uses: actions/cache@v4 | |
id: vendor-cache | |
with: | |
path: vendor | |
key: "${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}" | |
- name: Setup env file | |
run: cp .env.ci .env | |
- name: Composer install | |
if: steps.vendor-cache.outputs.cache-hit != 'true' | |
run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --prefer-dist | |
- name: Setup keys | |
run: php artisan key:generate | |
- name: Fix perms for dirs | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Migrate database | |
env: | |
DB_CONNECTION: 'sqlite' | |
DB_DATABASE: 'db.sqlite' | |
run: touch database/db.sqlite; php artisan migrate | |
- name: Update submodules | |
run: git submodule update --init | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
env: | |
DB_CONNECTION: 'sqlite' | |
DB_DATABASE: 'db.sqlite' | |
run: vendor/phpunit/phpunit/phpunit | |
laravel-test-sql: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mariadb:latest | |
env: | |
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
MYSQL_DATABASE: scw__api | |
MYSQL_USER: scw__api | |
MYSQL_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
ports: | |
- 33306:3306 | |
options: >- | |
--health-cmd="mariadb-admin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Installing PHP | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: '8.2' | |
- name: Get Composer Cache Directory 2 | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: actions-cache | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}" | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Cache PHP dependencies | |
uses: actions/cache@v4 | |
id: vendor-cache | |
with: | |
path: vendor | |
key: "${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}" | |
- name: Setup env file | |
run: cp .env.ci .env | |
- name: Composer install | |
if: steps.vendor-cache.outputs.cache-hit != 'true' | |
run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --prefer-dist | |
- name: Setup keys | |
run: php artisan key:generate | |
- name: Fix perms for dirs | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Migrate database | |
env: | |
DB_CONNECTION: 'mysql' | |
DB_DATABASE: 'scw__api' | |
DB_PORT: 33306 | |
#DB_HOST: 'mysql' | |
DB_USERNAME: 'scw__api' | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
run: touch database/db.sqlite; php artisan migrate | |
- name: Update submodules | |
run: git submodule update --init | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
env: | |
DB_CONNECTION: 'mysql' | |
DB_DATABASE: 'scw__api' | |
DB_PORT: 33306 | |
#DB_HOST: 'mysql' | |
DB_USERNAME: 'scw__api' | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
run: vendor/phpunit/phpunit/phpunit | |
main: | |
runs-on: ubuntu-latest | |
needs: | |
- laravel-test-sqlite | |
- laravel-test-sql | |
steps: | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: "${{ runner.os }}-buildx-${{ github.sha }}" | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
tags: scwiki/api:dev | |
push: true | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |