Skip to content

trigger-staging-checks #986

trigger-staging-checks

trigger-staging-checks #986

Workflow file for this run

name: Check Staging
on:
repository_dispatch:
types: [trigger-staging-checks]
workflow_dispatch:
jobs:
cache-pnpm-store:
name: Install everything with PNPM and cache it
secrets: inherit
uses: ./.github/workflows/cache-pnpm-install.yml
take-screenshot:
name: Take Screenshot
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
steps:
- name: Cancel existing runs on this branch
uses: fauguste/auto-cancellation-running-action@0.1.4
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check out the repo
uses: actions/checkout@v2
- name: Cache .pnpm-store
uses: actions/cache@v2
with:
path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }}
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location
- name: Install Puppeteer Libraries
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Run Puppeteer
id: run-screenshot-test
env:
AWS_S3_BUCKET: ${{secrets.PERFORMANCE_GRAPHS_BUCKET}}
AWS_ACCESS_KEY_ID: ${{ secrets.PERFORMANCE_GRAPHS_ACCESS_KEY}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PERFORMANCE_GRAPHS_SECRET_KEY }}
AWS_REGION: ${{ secrets.STAGING_BUNDLE_REGION }}
HEADLESS: 'true'
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "cd puppeteer-tests; pnpm install --unsafe-perm; pnpm run screenshot-test"
- name: Build Discord Message
env:
TEMPLATE: >-
[
{
"title": "Staging:",
"color": 2369839,
"image": {
"url": $screenshot_url
}
}
]
SCREENSHOT_URL: ${{ steps.run-screenshot-test.outputs.screenshot }}
run: |
echo "DISCORD_EMBEDS=$(jq -nc --arg screenshot_url "$SCREENSHOT_URL" "$TEMPLATE")" >> $GITHUB_ENV
- name: Send Discord Notification
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Puppeteer'
DISCORD_AVATAR: https://octodex.github.com/images/puppeteer.png
MESSAGE: 'Screenshot of latest Staging deploy'
with:
args: ${{ env.MESSAGE }}
collaboration-test:
name: Run Collaboration Tests
timeout-minutes: 12
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
env:
UTOPIA_SHA: ${{ github.sha }}
AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu
AUTH0_ENDPOINT: utopia-staging.us.auth0.com
steps:
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Check out the repo
uses: actions/checkout@v2
- name: Cache .pnpm-store
uses: actions/cache@v2
with:
path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }}
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location
- name: Build Comments Tests
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests"
- name: Run Comments Test
id: run-comments-test
env:
BASE_URL: 'https://utopia.pizza'
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-collaboration-test"
post-failure-to-discord:
name: Post Failure Message To Discord
timeout-minutes: 5
runs-on: ubuntu-latest
if: failure()
needs: [take-screenshot, collaboration-test]
steps:
- name: Discord Notification
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Staging Checks Failure'
with:
args: 'Staging checks failed: https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}'