diff --git a/.github/workflows/backstop-remote.yml b/.github/workflows/backstop-remote.yml new file mode 100644 index 000000000..7cc41d833 --- /dev/null +++ b/.github/workflows/backstop-remote.yml @@ -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/ngrok-tunneling-action@v0.1.4 + with: + timeout: 1h + port: 3000 + ngrok_authtoken: ${{ secrets.NGROK_AUTHTOKEN }} diff --git a/_ci/backstop/package.json b/_ci/backstop/package.json index 099d49023..a43c57e7d 100644 --- a/_ci/backstop/package.json +++ b/_ci/backstop/package.json @@ -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 )",