This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
Archive #14
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: DevOps | |
on: | |
[push, pull_request] | |
env: | |
phpLastVersion: '7.4' | |
jobs: | |
test_php: | |
runs-on: ubuntu-latest | |
name: Build and test | |
strategy: | |
matrix: | |
php-version: [ 7.3, 7.4 ] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: ${{ matrix.php-version }} | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install PHP dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest --no-scripts | |
- name: Run test suite | |
run: composer run-script test | |
- name: Fix code coverage paths for Sonar | |
working-directory: ./build/reports/ | |
run: sed -i 's/\/home\/runner\/work\/JunitXml\/JunitXml\//\/github\/workspace\//g' phpunit.coverage.xml | |
############################################################################## | |
# SonarCloud job | |
# | |
test_sonar: | |
needs: [ | |
test_php | |
] | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
name: SonarCloud analyse | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: SonarCloud Scan | |
if: matrix.php-version == ${{ env.phpLastVersion }} | |
uses: sonarsource/sonarcloud-github-action@master | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
############################################################################## | |
# Markdownlint job | |
# | |
test_markdownlint: | |
runs-on: ubuntu-latest | |
name: MarkdownLint | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Markdown lint | |
uses: nosborn/github-action-markdown-cli@v3.3.0 | |
with: | |
files: "*.md docs/*.md" | |
config_file: ".markdownlint.yaml" |