Orcid Publications Import Optimization #127
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: Profiles CI Workflow | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
profiles_tests: | |
name: Profiles Tests (PHP ${{ matrix.php-versions }}) | |
runs-on: ubuntu-latest | |
env: | |
DB_CONNECTION: mysql | |
DB_HOST: 127.0.0.1 | |
DB_DATABASE: profiles_ci | |
DB_USERNAME: root | |
DB_PASSWORD: password | |
BROADCAST_DRIVER: log | |
CACHE_DRIVER: redis | |
QUEUE_CONNECTION: redis | |
SESSION_DRIVER: redis | |
# Docs: https://docs.github.com/en/actions/using-containerized-services | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: profiles_ci | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
redis: | |
image: redis | |
ports: | |
- 6379/tcp | |
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.0'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP and install Composer dependencies | |
uses: ./.github/actions/composer-install | |
- name: Prepare the application | |
run: | | |
php -r "file_exists('.env') || copy('.env.ci', '.env');" | |
php artisan key:generate | |
php artisan storage:link | |
mkdir -p -m 777 storage/app/purify/HTML | |
chmod -R 777 storage bootstrap/cache | |
- name: Clear Config | |
run: php artisan config:clear | |
- name: Run Migration | |
run: php artisan migrate -v | |
env: | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} | |
- name: Test with phpunit | |
run: vendor/bin/phpunit --testdox | |
env: | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} | |
- name: Cache PSALM | |
uses: actions/cache@v3 | |
id: cache-psalm | |
with: | |
path: /tmp/psalm | |
key: ${{ runner.os }}-psalm-${{ hashFiles('**/app/**', '**/config/**', '**/database/**', '**/resources/views/**', '**/routes/**', '**/tests/**') }} | |
restore-keys: ${{ runner.os }}-psalm- | |
- name: Static analyze code (PSALM) | |
run: vendor/bin/psalm --long-progress | |
profiles_security: | |
name: Profiles Security Checks | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.0'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP and install Composer dependencies | |
uses: ./.github/actions/composer-install | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache PHP security DB | |
uses: actions/cache@v2 | |
id: cache-symfony-db | |
with: | |
path: ~/.symfony/cache | |
key: ${{ runner.os }}-symfony-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-symfony- | |
- name: Check PHP security with Symfony checker | |
uses: symfonycorp/security-checker-action@v4 | |
- name: Check PHP security with Composer audit | |
run: composer audit | |
- name: Check JS security | |
run: npm audit |