Example GitHub Action workflow which runs Cypress using now's deployment for the current commit. See https://mobile.twitter.com/gr2m/status/1234602143719419904
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
name: End-to-end tests | |
on: [push] | |
jobs: | |
cypress-run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12 | |
# https://github.com/octokit/request-action/ | |
- uses: octokit/request-action@v2.x | |
id: get_statuses | |
with: | |
route: GET /repos/:repository/commits/:ref/statuses | |
repository: ${{ github.repository }} | |
ref: ${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# I assume that the most current status is set by now. | |
# Only works if there are no other integrations setting commit statuses (check runs don't matter) | |
# https://github.com/gr2m/get-json-paths-action/ | |
- id: parse_statuses | |
uses: gr2m/get-json-paths-action@v1.x | |
with: | |
json: ${{ steps.get_statuses.outputs.data }} | |
target_url: "[0].target_url" | |
# replace https://zeit.co/<user>/<project>/<id>" with "<id>" | |
- id: get_deployment_id | |
run: echo "::set-output name=deployment_id::`echo ${{ steps.parse_statuses.outputs.target_url }} | cut -d "/" -f6`" | |
- run: echo deployment id ${{ steps.get_deployment_id.outputs.deployment_id }} | |
- name: Run E2E tests | |
uses: cypress-io/github-action@v1 | |
with: | |
config: watchForFileChanges=false,baseUrl=https://my-now-app-${{ steps.get_deployment_id.outputs.deployment_id }}.now.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment