-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
130 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Reusable workflow to run e2e tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: The git commit, sha or other ref to checkout of the e2e repo. | ||
required: false | ||
type: string | ||
default: main | ||
jibril-image: | ||
description: The Jibril image to use for testing. | ||
required: false | ||
type: string | ||
default: ghcr.io/listendev/jibril:main | ||
jibril-server-image: | ||
description: The Jibril-server image to use for testing. | ||
required: false | ||
type: string | ||
default: ghcr.io/listendev/jibril-server:main | ||
lstn-use-release: | ||
description: Use the public release of lstn rather than a local uploaded version. | ||
required: false | ||
type: boolean | ||
default: true | ||
lstn-binary-artefact: | ||
description: An uploaded artefact to download from this current run if lstn-use-release is false. | ||
required: false | ||
type: string | ||
default: artifact-linux | ||
secrets: | ||
github-token: | ||
description: The Github token to checkout the repo and access container images. | ||
required: true | ||
|
||
jobs: | ||
run-e2e: | ||
name: Run e2e tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: listendev/listen-e2e | ||
ref: ${{ inputs.ref }} | ||
token: ${{ secrets.github-token }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the GHCR registry | ||
uses: docker/#-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.github-token }} | ||
|
||
- name: Pull images | ||
run: | | ||
docker pull ${{ inputs.jibril-image }} | ||
docker pull ${{ inputs.jibril-server-image }} | ||
shell: bash | ||
|
||
- name: Get CLI binary from local artefacts | ||
if: ${{ !inputs.lstn-use-release }} | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.lstn-binary-artefact }} | ||
path: bin/ | ||
|
||
- name: Add CLI to path | ||
if: ${{ !inputs.lstn-use-release }} | ||
run: echo "$PWD/bin" >> $GITHUB_PATH | ||
shell: bash | ||
|
||
- name: Install released CLI | ||
if: inputs.lstn-use-release | ||
run: curl -sSfL https://lstn.dev/get | sh -s -- -b /usr/local/bin | ||
shell: bash | ||
|
||
- name: Verify CLI version | ||
run: lstn version | ||
shell: bash | ||
|
||
- name: Setup Bats and bats libs | ||
id: setup-bats | ||
uses: bats-core/bats-action@3.0.0 | ||
with: | ||
support-path: "${{ github.workspace }}/bats/bats-support" | ||
assert-path: "${{ github.workspace }}/bats/bats-assert" | ||
detik-path: "${{ github.workspace }}/bats/bats-detik" | ||
file-path: "${{ github.workspace }}/bats/bats-file" | ||
|
||
- name: Run e2e tests | ||
run: ./run-bats.sh | ||
shell: bash | ||
env: | ||
JIBRIL_IMAGE: ${{ inputs.jibril-image }} | ||
JIBRIL_SERVER_IMAGE: ${{ inputs.jibril-server-image }} | ||
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} | ||
TERM: xterm |
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