Skip to content

Commit

Permalink
feat(github): adds docker sanity test workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Nov 25, 2023
1 parent bf2f56b commit 668b276
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 53 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/_test-build-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🙈 Test, Build, & Publish

on:
workflow_dispatch:

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

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

jobs:
sanity-test:
name: Sanity Test
uses: ./.github/workflows/backstop-sanity-test.yml

smoke-test:
name: Smoke Test
uses: ./.github/workflows/backstop-smoke-test.yml

integration-test:
name: Integration Test
uses: ./.github/workflows/backstop-integration-test.yml

build-docker:
name: Build Docker
uses: ./.github/workflows/docker-build.yml

test-docker:
name: Test Docker
uses: ./.github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration Tests
name: Backstop Integration Tests

on:
pull_request:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sanity Tests
name: Backstop Sanity Tests

on:
pull_request:
Expand Down Expand Up @@ -33,6 +33,10 @@ jobs:
- name: ↧ Install
run: npm ci

- name: 🧪 Test
- name: 🧸 Test Puppeteer
run: |
npm run sanity-test
- name: 🎭 Test Playwright
run: |
npm run sanity-test-playwright
File renamed without changes.
42 changes: 0 additions & 42 deletions .github/workflows/dispatch.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Docker
name: Docker Build

on:
pull_request:
Expand All @@ -15,16 +15,13 @@ env:
permissions:
contents: write
pull-requests: write
packages: write

jobs:
build-and-push-image:
name: 🐳
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:

- name: Checkout
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/docker-sanity-test-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docker Test - Playwright

on:
pull_request:
branches: [master, develop]
workflow_dispatch:
workflow_call:

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 }}

permissions:
contents: write
pull-requests: write

jobs:
sanity-test-docker:
name: 🐳 BackstopJS Docker Puppeteer
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:

- name: Checkout
uses: actions/checkout@v3
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@v3
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: 🐳 Test Docker With Puppeteer
run: |
cd test/configs/ && docker run --rm -it --mount type=bind,source=\"$(pwd)\",target=/src $REGISTRY/$IMAGE_NAME_LC:$REF test --config=playwright"
66 changes: 66 additions & 0 deletions .github/workflows/docker-sanity-test-puppeteer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docker Tests - Puppeteer

on:
pull_request:
branches: [master, develop]
workflow_dispatch:
workflow_call:

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 }}

permissions:
contents: write
pull-requests: write

jobs:
sanity-test-docker:
name: 🐳 BackstopJS Docker Puppeteer
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:

- name: Checkout
uses: actions/checkout@v3
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@v3
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: 🐳 Test Docker With Puppeteer
run: |
cd test/configs/ && docker run --rm -it --mount type=bind,source=\"$(pwd)\",target=/src $REGISTRY/$IMAGE_NAME_LC:$REF test"
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ permissions:
jobs:
sanity-test:
name: Sanity Test
uses: ./.github/workflows/sanity-test.yml
uses: ./.github/workflows/backstop-sanity-test.yml

smoke-test:
name: Smoke Test
uses: ./.github/workflows/smoke-test.yml
uses: ./.github/workflows/backstop-smoke-test.yml

integration-test:
name: Integration Test
uses: ./.github/workflows/integration-test.yml
uses: ./.github/workflows/backstop-integration-test.yml
21 changes: 21 additions & 0 deletions .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Docker Tests

on:
pull_request:
branches: [master, develop]
workflow_call:
workflow_dispatch:

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

jobs:
sanity-test:
name: Sanity Test Puppeteer
uses: ./.github/workflows/docker-sanity-test-puppeteer.yml

smoke-test:
name: Sanity Test Playwright
uses: ./.github/workflows/docker-sanity-test-playwright.yml

0 comments on commit 668b276

Please sign in to comment.