From 83a879c4cb4debe5531074be22acc5b430fc27e5 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 00:01:55 +0100 Subject: [PATCH] chore: add a simple github action workflow --- .github/workflows/tugboat.yml | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/tugboat.yml diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml new file mode 100644 index 0000000000..4c52ce99d6 --- /dev/null +++ b/.github/workflows/tugboat.yml @@ -0,0 +1,57 @@ +name: Tugboat E2E Tests +on: deployment_status + +jobs: + run: + # When the deployment event is success + if: github.event.deployment_status.state == 'success' + name: Run test suite against tugboat + runs-on: ubuntu-latest + steps: + # Set an initial commit status message to indicate that the tests are + # running. + - name: set pending status + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + debug: true + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: 'pending', + context: 'Nightwatch.js tests', + description: 'Running tests', + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }); + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '14' + - name: get deployment status + id: get-status-env + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + result-encoding: string + script: | + const result = await github.repos.getDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: context.payload.deployment.id, + status_id: context.payload.deployment_status.id, + headers: { + 'Accept': 'application/vnd.github.ant-man-preview+json' + }, + }); + console.log(result); + return result.data.environment_url; + - name: echo tugboat preview url + run: | + echo ${{ steps.get-status-env.outputs.result }} + # The first time you hit a Tugboat URL it can take a while to load, so + # we visit it once here to prime it. Otherwise the very first test + # will often timeout. + curl ${{ steps.get-status-env.outputs.result }} +