chore(cli): Add unit tests workflow #4
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: "Web / Tests" | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
shortest: | |
name: "End-to-end" | |
# Skip running on forks, as there is no access to secrets | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
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 nextjs:test:e2e --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 |