Skip to content

Formatting & audit #213

Formatting & audit

Formatting & audit #213

Workflow file for this run

name: CI
on:
pull_request:
permissions:
actions: read
contents: read
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
#- name: Enable Nx Cloud task distribution
# run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build" || true
# Cache node_modules
- uses: actions/setup-node@v4
with:
node-version: 21
cache: 'npm'
- name: Install front-end dependencies
run: npm run install:linux
- uses: nrwl/nx-set-shas@v4
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: npx nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- name: Execute front-end tests
run: npx nx affected -t lint test || true
# Cache composer dependencies
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-
# Reference: https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
- name: Create .env file
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install back-end dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Audit PHP dependencies security
run: composer audit
- name: Generate Laravel key
run: php artisan key:generate
- name: Configure FS permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create test database
run: |
mkdir -p database
touch database/database.sqlite
- name: Run database migrations
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan migrate --force
- name: Execute back-end tests
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test