Update endpoints #1694
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: Unit Tests | |
on: | |
push: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:11.0.5 | |
env: | |
MARIADB_DATABASE: testing | |
MARIADB_USER: user | |
MARIADB_PASSWORD: password | |
MARIADB_ROOT_PASSWORD: password | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="healthcheck.sh --connect --innodb_initialized" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite | |
coverage: none | |
- name: Get Composer cache directory | |
id: get-composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Restore Composer cache | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.get-composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-v3-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --ignore-platform-reqs --no-interaction | |
- name: Prepare .env file | |
run: cp .env.ci .env | |
- name: Get npm cache directory | |
id: get-npm-cache | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
- name: Restore npm cache | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.get-npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-v3-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Calculate front-end asset hash | |
id: get-assets-cache | |
uses: theowenyoung/[email protected] | |
with: | |
path: | | |
resources/js | |
resources/sass | |
public | |
- name: Restore front-end asset cache | |
id: assets-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
resources/js | |
resources/sass | |
public | |
key: ${{ runner.os }}-assets-v1-${{ steps.get-assets-cache.outputs.hash }}-${{ hashFiles('package-lock.json') }} | |
- name: Build front-end assets | |
if: steps.assets-cache.outputs.cache-hit != 'true' | |
run: npm run build | |
- name: Prepare .env file | |
run: | | |
cp .env.example .env | |
echo "DB_HOST=127.0.0.1" >> .env | |
echo "DB_USERNAME=root" >> .env | |
echo "DB_PASSWORD=password" >> .env | |
- name: Prepare Laravel | |
run: | | |
php artisan key:generate | |
chmod -R 755 storage bootstrap/cache | |
- name: Prepare database | |
run: php artisan migrate | |
- name: Run tests | |
env: | |
DB_HOST: 127.0.0.1 | |
MYSQL_USER: root | |
MYSQL_ROOT_PASSWORD: root | |
run: php artisan test |