Skip to content

Commit

Permalink
Add tests, using GitHub Actions. (#7)
Browse files Browse the repository at this point in the history
* Add tests, using GitHub Actions.

* Change workflow run on PRs to main branch.
  • Loading branch information
kopepasah committed Nov 7, 2022
1 parent f7e6669 commit 4a95344
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/test-terminus-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Tests: Version'

on:
workflow_call:
inputs:
php-version:
required: false
type: number
default: 8
terminus-version:
required: false
type: string
default: 3.0.6

jobs:
test_version:
runs-on: ubuntu-latest
name: ${{ inputs.terminus-version }}
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}

- name: Setup Terminus
uses: ./
with:
terminus-version: ${{ inputs.terminus-version }}

- name: Expect to be version ${{ inputs.terminus-version }}
run: |
terminus -V --no-ansi
if [[ $(terminus -V --no-ansi) != *"${{ inputs.terminus-version }}" ]]; then exit 1; fi
57 changes: 57 additions & 0 deletions .github/workflows/test-terminus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: WIP Tests

on:
pull_request:
branches:
- main

jobs:
test_terminus:
runs-on: ubuntu-latest
name: Terminus Setup
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Setup Terminus
uses: ./

- name: Expect terminus command to be available
run: terminus -V

- name: Expect terminus to print art
run: terminus art

test_terminus_login:
runs-on: ubuntu-latest
name: Terminus Login
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Setup Terminus
uses: ./
with:
pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}

- name: Expect to be logged in
run: terminus whoami --no-ansi > /dev/null

test_terminus_version:
name: Terminus Version
uses: ./.github/workflows/test-terminus-version.yml

test_terminus_version_304:
name: Terminus Version
uses: ./.github/workflows/test-terminus-version.yml
with:
terminus-version: 3.0.4

test_terminus_version_266:
name: Terminus Version
uses: ./.github/workflows/test-terminus-version.yml
with:
php-version: 7.4
terminus-version: 2.6.6
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ runs:
TERMINUS_RELEASE: ${{ inputs.terminus-version || env.TERMINUS_RELEASE }}

- name: Login to Pantheon
if: ${{ inputs.pantheon-machine-token }}
shell: bash
run: |
terminus auth:login --machine-token="${{ inputs.pantheon-machine-token }}"

0 comments on commit 4a95344

Please sign in to comment.