Update to 11.9.12 #122
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: Quality checks | |
on: | |
pull_request: { } | |
# Trigger workflow for release branches. | |
push: | |
branches: | |
- main | |
- "[0-9]+.[0-9]+.x" | |
jobs: | |
setup: | |
name: Project Setup | |
runs-on: ubuntu-22.04 | |
steps: | |
# We want to reuse our project setup to run different jobs at once. | |
- uses: actions/cache@v3 | |
id: opensocial-project-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ github.run_attempt }} | |
# Set PHP {{ matrix.php }} as default. | |
# https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
# We check out the code in a separate folder since we want to use the | |
# result of the merge rather than the pre-merged code. | |
# A separate path is used to keep our working directory clean. | |
- name: Setup a temporariy repository | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ github.workspace }}/tmp/repository | |
# Since composer must clone from this we require all the history. | |
fetch-depth: 0 | |
# Create a branch for the specific commit so that composer can check it | |
# out. | |
- name: Checkout out to current commit in temporary repository | |
run: cd $GITHUB_WORKSPACE/tmp/repository && git checkout -b $GITHUB_SHA | |
# Prepare our composer.json to do a full project set-up. | |
- name: Copy tests/composer.json to root of workspace | |
run: cp $GITHUB_WORKSPACE/tmp/repository/tests/composer.json composer.json | |
# Set up composer with our desired PHP version. | |
- name: Setup Composer Config similar to temporary repository | |
run: composer config repositories.social vcs $GITHUB_WORKSPACE/tmp/repository | |
# Install the version of Open Social under test. | |
- name: Composer require Open Social of current branch's latest commit. | |
run: composer require goalgorilla/open_social:dev-${{ github.sha }}#${{ github.sha }} | |
- name: Set file permissions | |
run: mkdir -p $GITHUB_WORKSPACE/sites/default/files && sudo chmod -R 664 $GITHUB_WORKSPACE/sites/default/files | |
phpstan: | |
needs: setup | |
name: PHPStan check | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/cache@v3 | |
id: opensocial-project-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ github.run_attempt }} | |
# Set PHP {{ matrix.php }} as default. | |
# https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
tools: cs2pr | |
- name: PHPStan Version | |
run: $GITHUB_WORKSPACE/vendor/bin/phpstan --version | |
# Run PHPStan | |
- name: Run PHPStan analysis | |
run: $GITHUB_WORKSPACE/vendor/bin/phpstan analyse -c $GITHUB_WORKSPACE/html/profiles/contrib/social/phpstan.neon --error-format=checkstyle | cs2pr | |
phpcs: | |
needs: setup | |
name: PHPCS check | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/cache@v3 | |
id: opensocial-project-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ github.run_attempt }} | |
# Set PHP {{ matrix.php }} as default. | |
# https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
tools: cs2pr | |
# Copy phpcs.xml folder to root. | |
- name: Copy PHPCS.xml file from temporary repository to root of workspace. | |
run: cp $GITHUB_WORKSPACE/tmp/repository/phpcs.xml phpcs.xml | |
- name: Run PHPCS checks | |
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml | |
# https://github.com/staabm/annotate-pull-request-from-checkstyle#using-php_codesniffer | |
- name: Show PHPCS results in PR | |
run: cs2pr ./phpcs-report.xml | |
phpunit: | |
needs: setup | |
name: PHPUnit Tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/cache@v3 | |
id: opensocial-project-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ github.run_attempt }} | |
# Set PHP {{ matrix.php }} as default. | |
# https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
ini-values: zend.assertions=1 | |
coverage: none | |
tools: cs2pr | |
# https://github.com/shivammathur/setup-php#phpunit | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
# Run PHPUnit testing. | |
- name: Run PHPUnit test suite | |
run: $GITHUB_WORKSPACE/vendor/bin/phpunit -c $GITHUB_WORKSPACE/html/profiles/contrib/social/phpunit.xml.dist --log-junit $GITHUB_WORKSPACE/test-reports/phpunit.xml | |
env: | |
SIMPLETEST_DB: sqlite://tmp/db.sqlite |