Skip to content

Commit

Permalink
wip(github): adds backstop remote workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Jan 14, 2024
1 parent f632e05 commit e6e05a1
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/backstop-remote.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Backstop Remote
run-name: Running Backstop Remote

on:
workflow_dispatch:

permissions:
checks: write
contents: write
pull-requests: write

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
backstop:
name: 📱 BackstopJS
runs-on: ubuntu-latest
environment:
name: ${{ inputs.env }}

env:
DEPLOY_ENV: ${{ inputs.env }}

steps:
- name: 𐂷 Checkout
uses: actions/checkout@v4
with:
repository: dgrebb/dgrebb.com
ref: ${{ github.ref }}
token: ${{ github.token }}
fetch-depth: 1
sparse-checkout: |
_ci/backstop
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: |
_ci/backstop/package.json
_ci/backstop/pnpm-lock.yaml
_ci/backstop/node_modules
- name: ↧ Install Dependencies
run: cd _ci/backstop && pnpm install && npx playwright install --with-deps

- name: "Running Remote {ಠʖಠ}"
id: backstop
continue-on-error: true
run: cd _ci/backstop && ENV=$DEPLOY_ENV pnpm remote.gh

- name: Run ngrok
uses: apogiatzis/[email protected]
with:
timeout: 1h
port: 3000
ngrok_authtoken: ${{ secrets.NGROK_AUTHTOKEN }}
1 change: 1 addition & 0 deletions _ci/backstop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ref": "ENVIRONMENT=\"$ENV\" backstop reference --config=backstop.config.js",
"ref.gh": "ENVIRONMENT=gh-\"$ENV\" backstop reference --config=backstop.config.js",
"remote": "npx playwright install && ENVIRONMENT=\"$ENV\" backstop remote --config=backstop.config.js",
"remote.gh": "ENVIRONMENT=\"$ENV\" backstop remote --config=backstop.config.js",
"serve": "http-server -b -S -p 443 -a local.dgrebb.com -C ../../front/local.dgrebb.com.crt -K ../../front/local.dgrebb.com.key --cors='*' ../../front/build",
"start": "ENVIRONMENT=\"$ENV\" pm2 start ecosystem.config.js && pm2 monit",
"stop": "pm2 stop backstop && pm2 delete backstop && kill -9 $( lsof -i:3000 -t )",
Expand Down

0 comments on commit e6e05a1

Please sign in to comment.