Ensure Integrity #733
Workflow file for this run
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: 'Ensure Integrity' | |
on: | |
pull_request: null | |
push: | |
branches: [master] | |
merge_group: | |
types: [ checks_requested ] | |
release: | |
types: [ created ] | |
env: | |
OWNER: yes-theory-fam | |
jobs: | |
docker-build-server: | |
name: "Docker Build Server" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/docker-build | |
name: "Build Container" | |
with: | |
sub-project: server | |
token: ${{ secrets.GITHUB_TOKEN }} | |
docker-build-web: | |
name: "Docker Build Web" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/docker-build | |
name: "Build Container" | |
with: | |
sub-project: web | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build-args: | | |
NEXT_PUBLIC_FRONTEND_URL=${{ github.ref == 'refs/heads/master' && 'https://staging.yestheory.family' || 'https://yestheory.family' }} | |
chromatic-deployment: | |
name: "Chromatic Deployment" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/install-yarn | |
name: "Install dependencies" | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
with: | |
exitZeroOnChanges: true | |
workingDir: packages/web | |
buildScriptName: storybook:build:test | |
token: ${{ secrets.GITHUB_TOKEN }} | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
e2e-test: | |
name: "Playwright E2E-Test" | |
needs: [ docker-build-server, docker-build-web ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/get-image-tag | |
id: image-tag | |
# Uses fake ternary operator to use latest for master and pr-# for PRs https://github.community/t/do-expressions-support-ternary-operators-to-change-their-returned-value/18114/3 | |
- name: Bake e2e test YAML | |
run: sed -i 's/COMMIT_HASH/${{ github.ref == 'refs/heads/master' && 'master' || steps.image-tag.outputs.tag }}/g' docker-compose.e2e.yml | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run e2e tests | |
run: | | |
docker compose -f docker-compose.e2e.yml up --no-build -d server web | |
docker compose -f docker-compose.e2e.yml run playwright | |
docker compose -f docker-compose.e2e.yml down | |
# TODO upload artifacts like videos / reports | |
remove-test-containers: | |
name: "Clean" | |
# Run even if e2e-test failed | |
if: ${{ always() }} | |
needs: e2e-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Delete server image | |
uses: ./.github/actions/delete-image | |
with: | |
sub-project: server | |
token: ${{ secrets.PR_IMAGE_DELETION_SECRET }} | |
- name: Delete web image | |
uses: ./.github/actions/delete-image | |
with: | |
sub-project: web | |
token: ${{ secrets.PR_IMAGE_DELETION_SECRET }} |