From 4a95344f0ca6100d0d925a2a2e526549f0edb264 Mon Sep 17 00:00:00 2001 From: Justin Kopepasah Date: Mon, 7 Nov 2022 15:10:08 -0600 Subject: [PATCH] Add tests, using GitHub Actions. (#7) * Add tests, using GitHub Actions. * Change workflow run on PRs to main branch. --- .github/workflows/test-terminus-version.yml | 38 ++++++++++++++ .github/workflows/test-terminus.yml | 57 +++++++++++++++++++++ action.yml | 1 + 3 files changed, 96 insertions(+) create mode 100644 .github/workflows/test-terminus-version.yml create mode 100644 .github/workflows/test-terminus.yml diff --git a/.github/workflows/test-terminus-version.yml b/.github/workflows/test-terminus-version.yml new file mode 100644 index 0000000..4f214fa --- /dev/null +++ b/.github/workflows/test-terminus-version.yml @@ -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 + diff --git a/.github/workflows/test-terminus.yml b/.github/workflows/test-terminus.yml new file mode 100644 index 0000000..1592fa3 --- /dev/null +++ b/.github/workflows/test-terminus.yml @@ -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 diff --git a/action.yml b/action.yml index b694c7e..31f24f2 100644 --- a/action.yml +++ b/action.yml @@ -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 }}"