chore: Run tests against local build in CI #351
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: "Shortest Tests" | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
shortest: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
cache-dependency-path: '**/pnpm-lock.yaml' | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
- name: Pull and set up .env.local | |
run: | | |
pnpm dlx vercel pull --environment=preview --token=$VERCEL_TOKEN | |
cp .vercel/.env.preview.local .env.local | |
test -f .env.local || (echo ".env.local not created" && exit 1) | |
- name: Set up database | |
run: | | |
pnpm drizzle-kit generate | |
pnpm db:migrate | |
pnpm db:seed | |
- name: Install Playwright | |
run: pnpm exec playwright install chromium | |
- name: Build app | |
run: pnpm build | |
- name: Start app in background | |
run: pnpm start -p 3000 & sleep 10 | |
- name: Run Shortest tests | |
run: pnpm shortest --headless | |
- name: Upload artifacts | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: .shortest | |
if-no-files-found: error | |
include-hidden-files: true | |
retention-days: 7 |