Added support for updated CircleCI SSH fingerprint format. Part 11. #15
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: Build, test and deploy | |
on: | |
push: | |
branches: | |
- 1.x | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- 1.x | |
- feature/** | |
jobs: | |
build_and_test: | |
runs-on: 'ubuntu-22.04' | |
strategy: | |
matrix: | |
include: | |
- php-version: '8.1' | |
drupal-version: stable | |
- php-version: '8.2' | |
drupal-version: stable | |
- php-version: '8.1' | |
drupal-version: '9.5' | |
drupal-project-hash: '9.x' | |
- php-version: '8.2' | |
drupal-version: '9.5' | |
drupal-project-hash: '9.x' | |
- php-version: '8.2' | |
drupal-version: '10@beta' | |
env: | |
DRUPAL_VERSION: ${{ matrix.drupal-versions }} | |
DRUPAL_PROJECT_SHA: ${{ matrix.drupal-project-hash }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache Composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/composer-cache | |
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Build the codebase | |
run: .devtools/build-codebase.sh | |
- name: Start built-in PHP server | |
run: .devtools/start-server.sh | |
- name: Provision site | |
run: .devtools/provision.sh | |
- name: Lint code with PHPCS | |
working-directory: build | |
run: vendor/bin/phpcs || [ "${CI_PHPCS_IGNORE_FAILURE:-0}" -eq 1 ] | |
- name: Lint code with PHPStan | |
working-directory: build | |
run: vendor/bin/phpstan || [ "${CI_PHPSTAN_IGNORE_FAILURE:-0}" -eq 1 ] | |
- name: Lint code with Rector | |
working-directory: build | |
run: vendor/bin/rector --clear-cache --dry-run || [ "${CI_RECTOR_IGNORE_FAILURE:-0}" -eq 1 ] | |
- name: Lint code with PHPMD | |
working-directory: build | |
run: vendor/bin/phpmd . text phpmd.xml || [ "${CI_PHPMD_IGNORE_FAILURE:-0}" -eq 1 ] | |
- name: Lint code with Twigcs | |
working-directory: build | |
run: vendor/bin/twigcs || [ "${CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ] | |
- name: Run tests | |
run: .devtools/test.sh || [ "${CI_TEST_IGNORE_FAILURE:-0}" -eq 1 ] | |
- name: Process artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Artifacts (${{ join(matrix.*, ', ') }}) | |
path: build/web/sites/simpletest/browser_output | |
deploy: | |
needs: | |
- build_and_test | |
runs-on: 'ubuntu-22.04' | |
env: | |
DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} | |
DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_NAME }} | |
DEPLOY_REMOTE: ${{ secrets.DEPLOY_REMOTE }} | |
DEPLOY_PROCEED: ${{ secrets.DEPLOY_PROCEED }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
name: id_rsa | |
known_hosts: unnecessary | |
config: | | |
Host * | |
StrictHostKeyChecking no | |
- name: Deploy to Remote | |
run: DEPLOY_BRANCH=${DEPLOY_BRANCH:-${GITHUB_REF_NAME}} .devtools/deploy.sh |