Terminus 3.x #2456
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: Terminus 3.x | |
on: | |
push: | |
schedule: | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
inputs: | |
functional_tests_group: | |
description: Run arbitrary functional tests group by name or all (short and long) tests (default) | |
required: true | |
default: all | |
tmate_enabled: | |
description: Enable tmate debugging | |
required: true | |
default: "0" | |
# Cancel previous runs of this same branch/PR/etc. | |
concurrency: | |
group: 'ci-${{ github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
# Checkout in separate job because docker image is alpine based and checkout action doesn't work. | |
checkout_build: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/pantheon-public/php-ci:v7.4 | |
name: Checkout & build Phar | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Save repo content as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: full-workspace | |
path: ${{ github.workspace }} | |
- name: Full Composer Install | |
run: composer install --dev | |
- name: Validate Code | |
run: composer code:lint | |
- name: Phar Build | |
run: | | |
mkdir $HOME/box | |
composer require humbug/box --working-dir=$HOME/box | |
export PATH=~/box/vendor/bin:$PATH | |
composer phar:build | |
- name: Save terminus.phar as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: terminus-phar | |
path: terminus.phar | |
if-no-files-found: error | |
functional: | |
runs-on: ${{ matrix.operating-system }} | |
name: Functional testing matrix - PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }} | |
if: ${{ github.repository_owner == 'pantheon-systems' }} | |
strategy: | |
matrix: | |
operating-system: [ 'macos-latest' ] | |
php-versions: [ '7.4', '8.2', '8.3' ] | |
max-parallel: 1 | |
env: | |
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }} | |
TERMINUS_SITE: ${{ vars.TERMINUS_SITE }} | |
TERMINUS_SITE_WP: ${{ vars.TERMINUS_SITE_WP }} | |
TERMINUS_SITE_WP_NETWORK: ${{ vars.TERMINUS_SITE_WP_NETWORK }} | |
TERMINUS_ORG: ${{ vars.TERMINUS_ORG }} | |
TERMINUS_BASE_DIR: ${{ vars.TERMINUS_BASE_DIR }} | |
TERMINUS_PLUGINS_DIR: ${{ vars.TERMINUS_PLUGINS_DIR }} | |
TERMINUS_PLUGINS2_DIR: ${{ vars.TERMINUS_PLUGINS2_DIR }} | |
TERMINUS_DEPENDENCIES_BASE_DIR: ${{ vars.TERMINUS_DEPENDENCIES_BASE_DIR }} | |
TERMINUS_USER: ${{ secrets.TERMINUS_USER }} | |
TERMINUS_HOST: ${{ vars.TERMINUS_HOST }} | |
TERMINUS_PORT: ${{ vars.TERMINUS_PORT }} | |
TERMINUS_VERIFY_HOST_CERT: ${{ vars.TERMINUS_VERIFY_HOST_CERT }} | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
HOMBEBREW_NO_AUTO_UPDATE: 1 | |
needs: [ checkout_build ] | |
steps: | |
- name: Install SSH key | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.TERMINUS_SITE_OWNER_SSH_PRIVATE_KEY }} | |
- run: brew update && brew upgrade icu4c | |
if: runner.os == 'macOS' | |
continue-on-error: true | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: gd, mbstring, zip, ssh2-1.4.1, pcov | |
coverage: pcov | |
ini-values: error_reporting=E_ALL | |
- name: Download repo content from artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: full-workspace | |
- name: Download terminus.phar as artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: terminus-phar | |
- name: Install Composer Dependencies | |
run: composer install --no-interaction --prefer-dist | |
- name: Setup tmate session | |
if: ${{ github.event.inputs.tmate_enabled == 1 }} | |
uses: mxschmitt/action-tmate@v3 | |
- name: Functional Tests (short) | |
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event.inputs.functional_tests_group == 'all' }} | |
run: composer test:short | |
- name: Functional Tests (long) | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.functional_tests_group == 'all' }} | |
run: composer test:long | |
- name: Functional Tests (arbitrary group) | |
if: ${{ github.event.inputs.functional_tests_group != '' && github.event.inputs.functional_tests_group != 'all' }} | |
run: composer test:group -- ${{ github.event.inputs.functional_tests_group }} | |
- name: Finish sesssion | |
if: ${{ always() && github.event.inputs.tmate_enabled == 1 }} | |
run: | | |
while [ ! -f /tmp/finish ] | |
do | |
sleep 2 | |
done | |
exit 0 | |
release: | |
runs-on: ubuntu-latest | |
name: Release | |
container: | |
image: quay.io/pantheon-public/php-ci:v7.4 | |
needs: [ functional ] | |
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }} | |
steps: | |
- name: Download terminus.phar as artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: terminus-phar | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: terminus.phar | |
env: | |
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} | |
package_macos: | |
runs-on: macos-latest | |
name: Package a Homebrew release | |
needs: [ release ] | |
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }} | |
steps: | |
- name: Bump Homebrew formula | |
uses: dawidd6/action-homebrew-bump-formula@v3 | |
with: | |
token: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}} | |
tap: pantheon-systems/external | |
tag: ${{github.ref}} | |
revision: ${{github.sha}} | |
formula: terminus |