Fixed code rating #7
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: Magicmake Unit Tests | |
on: | |
push: | |
pull_request: | |
jobs: | |
byte_level: | |
name: "Byte-level" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Checkout code" | |
uses: "actions/checkout@v3" | |
- name: "Check file permissions" | |
run: | | |
test "$(find . -type f -not -path './.git/*' -executable)" == "" | |
- name: "Find non-printable ASCII characters" | |
run: | | |
! LC_ALL=C.UTF-8 find ./src -type f -name "*.php" -print0 | xargs -0 -- grep -PHn "[^ -~]" | |
syntax_errors: | |
name: "Syntax errors" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Set up PHP" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "8.2" | |
tools: "parallel-lint" | |
- name: "Checkout code" | |
uses: "actions/checkout@v3" | |
# - name: "Validate Composer configuration" | |
# run: "composer validate --strict" | |
- name: "Check source code for syntax errors" | |
run: "composer exec -- parallel-lint src/" | |
unit_tests: | |
name: "Unit Tests" | |
needs: | |
- "byte_level" | |
- "syntax_errors" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: 8.1 | |
extension-csv: mbstring, bcmath | |
- name: "Checkout code" | |
uses: "actions/checkout@v3" | |
- name: Composer install | |
run: composer install | |
- name: "Execute unit tests" | |
run: "composer run-script test" | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/php@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
args: --all-projects | |
command: test |