Skip to content

Terminus 3.x

Terminus 3.x #1519

Workflow file for this run

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"
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@v3
- name: Save repo content as artifact
uses: actions/upload-artifact@v3
with:
name: full-workspace
path: ${{ github.workspace }}
- name: Full Composer Install
run: composer install
- 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@v3
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' ]
max-parallel: 1
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ secrets.TERMINUS_SITE }}
TERMINUS_ORG: ${{ secrets.TERMINUS_ORG }}
TERMINUS_BASE_DIR: ${{ secrets.TERMINUS_BASE_DIR }}
TERMINUS_PLUGINS_DIR: ${{ secrets.TERMINUS_PLUGINS_DIR }}
TERMINUS_PLUGINS2_DIR: ${{ secrets.TERMINUS_PLUGINS2_DIR }}
TERMINUS_DEPENDENCIES_BASE_DIR: ${{ secrets.TERMINUS_DEPENDENCIES_BASE_DIR }}
TERMINUS_USER: ${{ secrets.TERMINUS_USER }}
needs: [ checkout_build ]
steps:
- name: Install SSH key
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.TERMINUS_SITE_OWNER_SSH_PRIVATE_KEY }}
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd, mbstring, zip, ssh2-1.3.1, pcov
coverage: pcov
ini-values: error_reporting=E_ALL
- name: Download repo content from artifact
uses: actions/download-artifact@v3
with:
name: full-workspace
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v3
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: Coverage Report
run: composer coverage
- name: Save coverage as artifact
uses: actions/upload-artifact@v3
with:
name: CoverageReport
path: docs/TestCoverage.md
- 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:1.x
needs: [ functional ]
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }}
steps:
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v2
with:
name: terminus-phar
- name: Release
uses: softprops/action-gh-release@v1
with:
files: terminus.phar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_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
package_linux:
runs-on: ubuntu-latest
name: Package .deb Release
container:
image: quay.io/pantheon-public/php-ci:v7.4
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
needs: [ release ]
steps:
- name: Download repo content from artifact
uses: actions/download-artifact@v2
with:
name: full-workspace
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v2
with:
name: terminus-phar
- name: Full Composer Install
run: composer install
- name: Prepare needed folder and fix permissions
run: mkdir -p ~/.terminus/cache/tokens && mv ./terminus.phar ./terminus && chmod +x ./terminus
- name: Passegers, gather ye packages
run: composer bundle:linux
- name: Save terminus deb as artifact
uses: actions/upload-artifact@v2
with:
name: terminus-deb
path: ./*.deb
if-no-files-found: error
publish_linux:
runs-on: ubuntu-latest
name: Publish .deb Release
strategy:
matrix:
# Add needed repositories in the form of <package_name>/<distro>/<version>.
repository:
- 'terminus/debian/buster'
- 'terminus/debian/bullseye'
- 'terminus/debian/bookworm'
- 'terminus/ubuntu/bionic'
- 'terminus/ubuntu/focal'
- 'terminus/ubuntu/groovy'
- 'terminus/ubuntu/hirsute'
- 'terminus/ubuntu/impish'
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
needs: [ 'package_linux' ]
steps:
- name: Download terminus deb as artifact
uses: actions/download-artifact@v2
with:
name: terminus-deb
- uses: docker://lpenz/ghaction-packagecloud:v0.2
with:
user: stovak
repository: ${{ matrix.repository }}
path: |
*.deb
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
# # NOT CURRENTLY USED
# behat_tests:
# runs-on: ubuntu-latest
# name: Behat Tests
# needs: [ checkout_build ]
# if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
# strategy:
# matrix:
# php-versions: [ '7.4', '8.0' ]
# fail-fast: false
# env:
# TERMINUS_VERBOSITY: 22
# TERMINUS_EXECUTABLE: terminus
# TERMINUS_TEST_MODE: 1
# TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
# steps:
# - name: Setup PHP with PECL extension
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: gd, mbstring, zip
# coverage: pcov
# - name: Download repo content from artifact
# uses: actions/download-artifact@v2
# with:
# name: full-workspace
# - name: Download terminus.phar as artifact
# uses: actions/download-artifact@v2
# with:
# name: terminus-phar
# - name: Install Composer Dependencies
# run: composer install --no-interaction --prefer-dist
# - name: Fix permissions
# run: chmod +x ./bin/terminus
# - name: Behat Tests
# run: composer test:behat
# # NOT CURRENTLY USED
# package_macos:
# runs-on: macos-latest
# name: Package a Homebrew release
# if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
# needs: [ 'functional_tests', 'behat_tests' ]
# steps:
# - name: Brew Tap Terminus
# run: brew install stovak/terminus/terminus
# - name: Update tap with new release
# run: brew bump-formula-pr --url=${{ steps.tagged.outputs.url }} --no-browse --no-audit --commit stovak/terminus/terminus