Skip to content

Commit

Permalink
ci: refactor security workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 12, 2024
1 parent 47f4cc8 commit 29f776d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 48 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/lint-php-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ name: 🧹 Fix PHP coding standards

jobs:
coding-standards:
runs-on: ubuntu-latest
timeout-minutes: 4
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: coding-standards-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
strategy:
matrix:
os:
- ubuntu-latest
php-version:
- '8.2'
dependencies:
Expand Down
89 changes: 42 additions & 47 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,60 @@
name: Security
name: 🔐 Security analysis

on:
pull_request:
paths-ignore:
- 'docs/**'
- 'bin/**'
- 'resources/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'bin/**'
- 'resources/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
- 'psalm.xml'

jobs:
security:
name: Security Checks (PHP ${{ matrix.php }}, OS ${{ matrix.os }})
security-analysis:
timeout-minutes: 4
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: security-analysis-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
strategy:
fail-fast: false
fail-fast: true
matrix:
# Note: This workflow requires only the LATEST version of PHP
php: [ 8.2 ]
os: [ ubuntu-latest ]
os:
- ubuntu-latest
php-version:
- '8.2'
dependencies:
- locked
steps:
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, sockets, grpc, curl
- name: 📦 Check out the codebase
uses: actions/checkout@v4.1.4

- name: Check Out Code
uses: actions/checkout@v4
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@2.30.4
with:
fetch-depth: 1
php-version: ${{ matrix.php-version }}
extensions: none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, sockets
ini-values: error_reporting=E_ALL
coverage: none

- name: 🛠️ Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: Cache Dependencies
uses: actions/cache@v3
- name: 🔍 Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.0.0

- name: ♻️ Restore cached dependencies installed with composer
uses: actions/cache@v4.0.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php-${{ matrix.php }}-${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: php-${{ matrix.php }}-${{ runner.os }}-composer-
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: Install Composer Dependencies
run: composer install --prefer-dist --no-interaction
- name: 📥 Install "${{ matrix.dependencies }}" dependencies
uses: wayofdev/gh-actions/actions/composer/install@v3.0.0
with:
dependencies: ${{ matrix.dependencies }}

- name: Verify
- name: 🐛 Check installed packages using roave/security-advisories
run: composer require --dev roave/security-advisories:dev-latest

- name: 🐛 Check installed packages for security vulnerability advisories
run: composer audit --ansi

0 comments on commit 29f776d

Please sign in to comment.