From 141891bd7d8d6542bbd08039ce1bf166ef1c4f4d Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 25 Apr 2025 13:09:46 -0700 Subject: [PATCH 1/6] ci: test with authentication --- .github/workflows/test-terminus-auth.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/test-terminus-auth.yml diff --git a/.github/workflows/test-terminus-auth.yml b/.github/workflows/test-terminus-auth.yml new file mode 100644 index 0000000..d258f12 --- /dev/null +++ b/.github/workflows/test-terminus-auth.yml @@ -0,0 +1,22 @@ +name: Terminus Github Action Tests with Auth + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + name: Test with Authentication + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Terminus + uses: ./ + with: + pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} + - name: Terminus Command is available + run: terminus -V + - name: Who Am I? + run: terminus auth:whoami \ No newline at end of file From 83bf65b4c0e7b6e2dee7bfe2ed3bf0b6806c7f26 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 25 Apr 2025 13:31:47 -0700 Subject: [PATCH 2/6] add additional runs --- .github/workflows/test-terminus-auth.yml | 37 ++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-terminus-auth.yml b/.github/workflows/test-terminus-auth.yml index d258f12..06cf3b1 100644 --- a/.github/workflows/test-terminus-auth.yml +++ b/.github/workflows/test-terminus-auth.yml @@ -6,7 +6,7 @@ on: - main jobs: - test: + test-with-login: runs-on: ubuntu-latest name: Test with Authentication steps: @@ -19,4 +19,37 @@ jobs: - name: Terminus Command is available run: terminus -V - name: Who Am I? - run: terminus auth:whoami \ No newline at end of file + run: terminus auth:whoami + test-using-cache: + runs-on: ubuntu-latest + name: Test Cache is Used + needs: test + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Terminus + uses: ./ + with: + pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} + - name: Terminus Command is available + run: terminus -V + - name: Who Am I? + run: terminus auth:whoami + # TODO: Assert Cache used + test-cache-not-used-when-disabled: + runs-on: ubuntu-latest + name: Test Cache is ignored when disabled + needs: test + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Terminus + uses: ./ + with: + pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} + disable-cache: true + - name: Terminus Command is available + run: terminus -V + - name: Who Am I? + run: terminus auth:whoami + # TODO: Assert Cache not used \ No newline at end of file From 0e8acf31ce205d3731a3631ca1337ed7c0af1592 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 25 Apr 2025 13:35:56 -0700 Subject: [PATCH 3/6] fixup --- .github/workflows/test-terminus-auth.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-terminus-auth.yml b/.github/workflows/test-terminus-auth.yml index 06cf3b1..e51edae 100644 --- a/.github/workflows/test-terminus-auth.yml +++ b/.github/workflows/test-terminus-auth.yml @@ -23,7 +23,7 @@ jobs: test-using-cache: runs-on: ubuntu-latest name: Test Cache is Used - needs: test + needs: test-with-login steps: - name: Checkout uses: actions/checkout@v4 @@ -39,7 +39,7 @@ jobs: test-cache-not-used-when-disabled: runs-on: ubuntu-latest name: Test Cache is ignored when disabled - needs: test + needs: test-with-login steps: - name: Checkout uses: actions/checkout@v4 From 5df52d4b7c24504632f2288a2d938088179be9bf Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 25 Apr 2025 13:57:42 -0700 Subject: [PATCH 4/6] Add action output and check it --- .github/workflows/test-terminus-auth.yml | 7 ++++++- action.yml | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-terminus-auth.yml b/.github/workflows/test-terminus-auth.yml index e51edae..0030000 100644 --- a/.github/workflows/test-terminus-auth.yml +++ b/.github/workflows/test-terminus-auth.yml @@ -36,6 +36,9 @@ jobs: - name: Who Am I? run: terminus auth:whoami # TODO: Assert Cache used + - name: Fail if Cache Not Recovered + if: ${{ ! steps.test-with-login.outputs.session_found }} + run: exit 1 test-cache-not-used-when-disabled: runs-on: ubuntu-latest name: Test Cache is ignored when disabled @@ -52,4 +55,6 @@ jobs: run: terminus -V - name: Who Am I? run: terminus auth:whoami - # TODO: Assert Cache not used \ No newline at end of file + - name: Fail if Cache Recovered and Used + if: ${{ steps.test-with-login.outputs.session_found }} + run: exit 1 \ No newline at end of file diff --git a/action.yml b/action.yml index b7668cd..68b959f 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,11 @@ inputs: required: false default: false +outputs: + session_found: + description: "Whether a valid session was found from the cache and used" + value: ${{ steps.decrypt.outputs.session_found }} + runs: using: composite steps: From 854a2e10919a6ffff8604c8c87b67c9902c82389 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 25 Apr 2025 13:59:38 -0700 Subject: [PATCH 5/6] check strings not a bool --- .github/workflows/test-terminus-auth.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-terminus-auth.yml b/.github/workflows/test-terminus-auth.yml index 0030000..d15101f 100644 --- a/.github/workflows/test-terminus-auth.yml +++ b/.github/workflows/test-terminus-auth.yml @@ -37,7 +37,7 @@ jobs: run: terminus auth:whoami # TODO: Assert Cache used - name: Fail if Cache Not Recovered - if: ${{ ! steps.test-with-login.outputs.session_found }} + if: ${{ steps.test-with-login.outputs.session_found == 'false' }} run: exit 1 test-cache-not-used-when-disabled: runs-on: ubuntu-latest @@ -56,5 +56,5 @@ jobs: - name: Who Am I? run: terminus auth:whoami - name: Fail if Cache Recovered and Used - if: ${{ steps.test-with-login.outputs.session_found }} + if: ${{ steps.test-with-login.outputs.session_found == 'true' }} run: exit 1 \ No newline at end of file From 2714cc64a54639b22b8b24c658a246eed2485c78 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 25 Apr 2025 14:08:33 -0700 Subject: [PATCH 6/6] Bump autotag to v1 --- .github/workflows/tag-release.yml | 5 +- .github/workflows/test-terminus-auth.yml | 60 ----------------------- .github/workflows/test-terminus.yml | 61 +++++++++++++++++------- 3 files changed, 48 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/test-terminus-auth.yml diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 9000449..94b596b 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pantheon-systems/action-autotag@v0 + - uses: pantheon-systems/action-autotag@v1 with: - gh-token: ${{ github.token }} \ No newline at end of file + gh-token: ${{ github.token }} + push-major-version-branch: true \ No newline at end of file diff --git a/.github/workflows/test-terminus-auth.yml b/.github/workflows/test-terminus-auth.yml deleted file mode 100644 index d15101f..0000000 --- a/.github/workflows/test-terminus-auth.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Terminus Github Action Tests with Auth - -on: - pull_request: - branches: - - main - -jobs: - test-with-login: - runs-on: ubuntu-latest - name: Test with Authentication - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Terminus - uses: ./ - with: - pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} - - name: Terminus Command is available - run: terminus -V - - name: Who Am I? - run: terminus auth:whoami - test-using-cache: - runs-on: ubuntu-latest - name: Test Cache is Used - needs: test-with-login - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Terminus - uses: ./ - with: - pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} - - name: Terminus Command is available - run: terminus -V - - name: Who Am I? - run: terminus auth:whoami - # TODO: Assert Cache used - - name: Fail if Cache Not Recovered - if: ${{ steps.test-with-login.outputs.session_found == 'false' }} - run: exit 1 - test-cache-not-used-when-disabled: - runs-on: ubuntu-latest - name: Test Cache is ignored when disabled - needs: test-with-login - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Terminus - uses: ./ - with: - pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} - disable-cache: true - - name: Terminus Command is available - run: terminus -V - - name: Who Am I? - run: terminus auth:whoami - - name: Fail if Cache Recovered and Used - if: ${{ steps.test-with-login.outputs.session_found == 'true' }} - run: exit 1 \ No newline at end of file diff --git a/.github/workflows/test-terminus.yml b/.github/workflows/test-terminus.yml index 8c6fda3..b9f7287 100644 --- a/.github/workflows/test-terminus.yml +++ b/.github/workflows/test-terminus.yml @@ -6,32 +6,61 @@ on: - main jobs: - test_terminus: + test-with-login: runs-on: ubuntu-latest - name: Terminus Setup + name: Test with Authentication steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Terminus uses: ./ - - - name: Expect terminus command to be available + with: + pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} + - name: Terminus Command is available run: terminus -V - + - name: Who Am I? + run: terminus auth:whoami - name: Expect terminus to print art run: terminus art - - test_terminus_login: + test-using-cache: runs-on: ubuntu-latest - name: Terminus Login + name: Test Cache is Used + needs: test-with-login steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Terminus - uses: ./ - + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Terminus + uses: ./ + with: + pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} + - name: Terminus Command is available + run: terminus -V + - name: Who Am I? + run: terminus auth:whoami + # TODO: Assert Cache used + - name: Fail if Cache Not Recovered + if: ${{ steps.test-with-login.outputs.session_found == 'false' }} + run: exit 1 + test-cache-not-used-when-disabled: + runs-on: ubuntu-latest + name: Test Cache is ignored when disabled + needs: test-with-login + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Terminus + uses: ./ + with: + pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN_CI }} + disable-cache: true + - name: Terminus Command is available + run: terminus -V + - name: Who Am I? + run: terminus auth:whoami + - name: Fail if Cache Recovered and Used + if: ${{ steps.test-with-login.outputs.session_found == 'true' }} + run: exit 1 + test_terminus_version: name: Terminus Version uses: ./.github/workflows/test-terminus-version.yml @@ -47,4 +76,4 @@ jobs: uses: ./.github/workflows/test-terminus-version.yml with: php-version: 7.4 - terminus-version: 2.6.6 + terminus-version: 2.6.6 \ No newline at end of file