[Meta] Add daily.sh script #79
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: Run Tests | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
laravel-tests: | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: 'mariadb:10.9' | |
env: | |
MARIADB_RANDOM_ROOT_PASSWORD: 'yes' | |
MARIADB_DATABASE: 'attendance_api' | |
MARIADB_USER: 'attendance_user' | |
MARIADB_PASSWORD: 'password' | |
options: >- | |
--health-cmd "/usr/local/bin/healthcheck.sh --connect" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:3306 | |
steps: | |
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e | |
with: | |
php-version: '8.1' | |
- uses: actions/checkout@v3 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Install Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
env: | |
DB_CONNECTION: mysql | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 5432 | |
run: vendor/bin/phpunit | |
defaults: | |
run: | |
working-directory: attendance-api | |
angular-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
cache-dependency-path: attendance-web/package-lock.json | |
- name: Install Dependencies | |
run: npm ci | |
- name: Execute tests | |
run: npm test -- --no-watch --no-progress --browsers=ChromeHeadless | |
defaults: | |
run: | |
working-directory: attendance-web |