This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
Update README.md #11
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: Lint & Test | |
on: | |
push: | |
branches: | |
- 1.0.x | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- drupal: "10" | |
php: "8.2" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Cache dependencies | |
uses: wunderwerkio/cache-composer@main | |
with: | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.spoons.lock') }} | |
- name: Install drupal | |
uses: wunderwerkio/setup-drupal-spoons@main | |
with: | |
drupal-core-constraint: "^${{ matrix.drupal }}" | |
- name: Lint | |
run: composer run-script phpcs | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- drupal: "9" | |
php: "8.1" | |
- drupal: "10" | |
php: "8.1" | |
- drupal: "10" | |
php: "8.2" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP with Xdebug | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: xdebug | |
- name: Cache dependencies | |
uses: wunderwerkio/cache-composer@main | |
with: | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.spoons.lock') }} | |
- name: Install drupal | |
uses: wunderwerkio/setup-drupal-spoons@main | |
with: | |
drupal-core-constraint: "^${{ matrix.drupal }}" | |
- name: Test | |
run: composer run-script unit -- --coverage-clover=coverage.xml --coverage-filter src --coverage-filter modules | |
- name: Adjust coverage | |
if: matrix.drupal == '10' && matrix.php == '8.1' | |
run: | | |
mv web/coverage.xml coverage.xml | |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml | |
- name: Upload coverage | |
if: matrix.drupal == '10' && matrix.php == '8.1' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage.xml | |
sonarcloud: | |
name: Sonar Cloud | |
runs-on: ubuntu-latest | |
needs: ['test'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |