Skip to content

Commit

Permalink
chore: add host env
Browse files Browse the repository at this point in the history
Signed-off-by: Vu Nguyen <[email protected]>
  • Loading branch information
vujita committed Nov 18, 2023
1 parent 69f56de commit 8ebc8e4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/playwright-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Playwright Tests
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
DATABASE_URL: ${{ secrets.DATABASE_PREVIEW_URL }}
HOST: https://vubnguyen.com
jobs:
test-e2e:
env:
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: supersecret
DISCORD_CLIENT_ID: STUBBED_ID
DISCORD_CLIENT_SECRET: STUBBED_SECRET
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/[email protected]

- name: Setup Node 18
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm run test:e2e

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
2 changes: 1 addition & 1 deletion apps/vubnguyen/e2e/example.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test } from "@playwright/test";

test("has title", async ({ page }) => {
await page.goto("http://localhost:3000/");
await page.goto(process.env.HOST ?? "http://localhost:3000/");

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/vubnguyen/);
Expand Down
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://turborepo.org/schema.json",
"globalDependencies": ["**/.env", "tsconfig.json"],
"globalEnv": ["CI", "DATABASE_URL", "DISCORD_CLIENT_ID", "DISCORD_CLIENT_SECRET", "EXPO_ROUTER_APP_ROOT", "NEXTAUTH_SECRET", "NEXTAUTH_URL", "NODE_ENV", "SKIP_ENV_VALIDATION", "VERCEL", "VERCEL_URL"],
"globalEnv": ["CI", "DATABASE_URL", "DISCORD_CLIENT_ID", "DISCORD_CLIENT_SECRET", "HOST", "NEXTAUTH_SECRET", "NEXTAUTH_URL", "NODE_ENV", "SKIP_ENV_VALIDATION", "VERCEL", "VERCEL_URL"],
"pipeline": {
"build": {
"dependsOn": ["db:generate", "^build"],
Expand Down

0 comments on commit 8ebc8e4

Please sign in to comment.