-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Thanks Dan!
- Loading branch information
Showing
9 changed files
with
545 additions
and
0 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,46 @@ | ||
name: 🙈 Backstop & Docker CI | ||
run-name: "CI running on ${{ github.event_name == 'pull_request' && format('PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) || format('latest {0}', github.ref_name) }}" | ||
# Tests backstopjs alone, docker build, docker push to | ||
# ghcr.io, docker pull from ghcr.io, and backstopjs in | ||
# the docker docker build. | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [master, develop] | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
|
||
jobs: | ||
backstop-sanity-test: | ||
name: Sanity Test Backstop | ||
uses: ./.github/workflows/backstop-sanity-test.yml | ||
|
||
backstop-smoke-test: | ||
name: Smoke Test Backstop | ||
uses: ./.github/workflows/backstop-smoke-test.yml | ||
|
||
backstop-integration-test: | ||
name: Integration Test Backstop | ||
uses: ./.github/workflows/backstop-integration-test.yml | ||
|
||
build-publish-docker: | ||
name: Build Docker | ||
uses: ./.github/workflows/docker-build.yml | ||
|
||
docker-sanity-test: | ||
needs: build-publish-docker | ||
name: Sanity Test Docker | ||
uses: ./.github/workflows/docker-sanity-test.yml | ||
|
||
docker-smoke-test: | ||
needs: build-publish-docker | ||
name: Smoke Test Docker | ||
uses: ./.github/workflows/docker-smoke-test.yml |
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,36 @@ | ||
name: Backstop Integration Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
env: | ||
NODE_VERSION: 20 | ||
|
||
jobs: | ||
integration: | ||
name: 🧩 Integration | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci | ||
|
||
- name: "𓋏 Run `npm run integration-test`" | ||
run: | | ||
npm run integration-test |
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,60 @@ | ||
name: Backstop Sanity Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
env: | ||
NODE_VERSION: 20 | ||
|
||
jobs: | ||
sanity-puppeteer: | ||
name: 🤪 Puppeteer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci | ||
|
||
- name: "𓋏 Run `npm run sanity-test`" | ||
run: | | ||
npm run sanity-test | ||
sanity-playwright: | ||
name: 🤪 Playwright | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci | ||
|
||
- name: "🎭 Run `npm run sanity-test-playwright`" | ||
run: | | ||
npx playwright install --with-deps | ||
npm run sanity-test-playwright |
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,62 @@ | ||
name: Backstop Smoke Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
env: | ||
NODE_VERSION: 20 | ||
|
||
jobs: | ||
smoke-puppeteer: | ||
name: 💨 Puppeteer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci | ||
|
||
- name: "𓋏 Run `npm run smoke-test`" | ||
continue-on-error: true | ||
run: | | ||
npm run smoke-test | ||
smoke-playwright: | ||
name: 💨 Playwright | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci | ||
|
||
- name: "🎭 Run `npm run smoke-test-playwright`" | ||
continue-on-error: true | ||
run: | | ||
npx playwright install --with-deps | ||
npm run smoke-test-playwright |
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,70 @@ | ||
name: Docker Build & Push | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.event.pull_request.head_ref || github.event.pull_request.head.ref_name || github.head_ref || github.ref_name }} | ||
NODE_VERSION: 20 | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
name: 🐳 Build and Push | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: Set Name and Tag Vars | ||
env: | ||
name: "${{ env.BRANCH_NAME }}" | ||
run: | | ||
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >>${GITHUB_ENV} | ||
echo "TAG=${name/\//-}" >> $GITHUB_ENV | ||
echo "PV=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci --verbose --foreground-scripts | ||
|
||
- name: 🐳 Build Docker Builder | ||
run: | | ||
npm run --verbose --foreground-scripts init-docker-builder | ||
- name: 🐳 Build & Push Docker | ||
run: | | ||
docker buildx build --push --platform linux/amd64,linux/arm64 -t $REGISTRY/$IMAGE_NAME_LC:$TAG --build-arg BACKSTOPJS_VERSION=$PV docker | ||
# - name: 🐳 Load Docker | ||
# run: | | ||
# npm run --verbose --foreground-scripts load-docker | ||
|
||
# - name: 🐳 Push to ghcr.io | ||
# run: | | ||
# docker tag backstopjs/backstopjs:$PV $REGISTRY/$IMAGE_NAME_LC:$TAG | ||
# docker push $REGISTRY/$IMAGE_NAME_LC:$TAG |
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,114 @@ | ||
name: Docker Sanity Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.event.pull_request.head_ref || github.event.pull_request.head.ref_name || github.head_ref || github.ref_name }} | ||
NODE_VERSION: 20 | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
sanity-test-puppeteer: | ||
name: 🤪 Puppeteer | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: Set Name and Tag Vars | ||
env: | ||
name: "${{ env.BRANCH_NAME }}" | ||
run: | | ||
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >>${GITHUB_ENV} | ||
echo "TAG=${name/\//-}" >> $GITHUB_ENV | ||
echo "PV=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV | ||
echo "PLAYWRIGHT_VERSION=$(cat package.json | jq -r '.dependencies.playwright')" >> $GITHUB_ENV | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci | ||
|
||
- name: Pull Image | ||
run: | | ||
docker pull $REGISTRY/$IMAGE_NAME_LC:$TAG | ||
- name: "𓋏 Run `backstop test` in Docker" | ||
run: | | ||
cd test/configs/ && docker run --rm -t --mount type=bind,source="$(pwd)",target=/src $REGISTRY/$IMAGE_NAME_LC:$TAG test | ||
sanity-test-playwright: | ||
name: 🤪 Playwright | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.ref || github.ref }} | ||
|
||
- name: Set Name and Tag Vars | ||
env: | ||
name: "${{ env.BRANCH_NAME }}" | ||
run: | | ||
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >>${GITHUB_ENV} | ||
echo "TAG=${name/\//-}" >> $GITHUB_ENV | ||
echo "PV=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV | ||
echo "PLAYWRIGHT_VERSION=$(cat package.json | jq -r '.dependencies.playwright')" >> $GITHUB_ENV | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: ⬢ Setup Node & Cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: ↧ Install | ||
run: npm ci --verbose --foreground-scripts | ||
|
||
- name: Pull Image | ||
run: | | ||
docker pull $REGISTRY/$IMAGE_NAME_LC:$TAG | ||
- name: "🎭 Run `backstop test --confg=playwright` in Docker" | ||
run: | | ||
cd test/configs/ && docker run --rm -t --entrypoint='' --mount type=bind,source="$(pwd)",target=/src $REGISTRY/$IMAGE_NAME_LC:$TAG sh -c "chmod -R 777 /root && chmod -R 777 /opt/pw-browsers && npm --verbose --foreground-scripts i -D playwright && npx --verbose --foreground-scripts --yes playwright@$PLAYWRIGHT_VERSION install && backstop test --config=playwright" |
Oops, something went wrong.