Skip to content

Commit

Permalink
Deploy test results to vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
adamws committed Oct 27, 2024
1 parent 61bed47 commit 14414e4
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build & Test

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
pull_request:
Expand Down Expand Up @@ -65,3 +69,23 @@ jobs:
path: tests/output.webm
retention-days: 2
if-no-files-found: error

deploy-preview:
name: Deploy tests results
needs:
- run-functional-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: output.webm
path: tests
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.zig-cache/
zig-out/
tools/.env
.vercel
13 changes: 13 additions & 0 deletions tests/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e
set -u

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DEPLOY_DIR=${SCRIPT_DIR}/../.vercel/output

rm -rf $DEPLOY_DIR
mkdir $DEPLOY_DIR

cp ${SCRIPT_DIR}/index.html $DEPLOY_DIR
cp ${SCRIPT_DIR}/*.webm $DEPLOY_DIR
13 changes: 13 additions & 0 deletions tests/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>adamws/klawa outputs</title>
</head>
<body>
<video controls>
<source src="output.webm" type="video/webm">
Your browser does not support the video tag.
</video>
</body>
</html>
4 changes: 4 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"buildCommand": "./tests/deploy.sh",
"outputDirectory": ".vercel/output"
}

0 comments on commit 14414e4

Please sign in to comment.