From f5816097717c08f9356fbae6e868ebded1567f49 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 22 Aug 2024 11:10:05 +0100 Subject: [PATCH 1/6] fix: remove seed lessons script --- packages/core/src/scripts/seedLessons.ts | 25 ------------------------ 1 file changed, 25 deletions(-) delete mode 100644 packages/core/src/scripts/seedLessons.ts diff --git a/packages/core/src/scripts/seedLessons.ts b/packages/core/src/scripts/seedLessons.ts deleted file mode 100644 index 9471c5271..000000000 --- a/packages/core/src/scripts/seedLessons.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { prisma } from "@oakai/db"; - -//import seedLessons from "@oakai/db/prisma/seed/lessons"; - -const main = async () => { - try { - //await seedLessons(); - console.log("Stubbed"); - } catch (e) { - console.error(e); - process.exit(1); - } finally { - await prisma.$disconnect(); - } -}; - -main() - .then(async () => { - await prisma.$disconnect(); - }) - .catch(async (e) => { - console.error(e); - await prisma.$disconnect(); - process.exit(1); - }); From 93b8df11ba353b9954f1cf1ac75ac850024b60c5 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 22 Aug 2024 11:20:35 +0100 Subject: [PATCH 2/6] fix: sonarcloud properties and pnpm on post-deployment workflow --- .github/workflows/post_deployment.yml | 20 ++++++++++++-------- sonar-project.properties | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/post_deployment.yml b/.github/workflows/post_deployment.yml index 2ccc95dfb..4b22e0513 100644 --- a/.github/workflows/post_deployment.yml +++ b/.github/workflows/post_deployment.yml @@ -15,16 +15,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # Note we can't use caching here, because caching needs GITHUB_REF to be defined, - # and Vercel deployment_status events set deployment.ref to the SHA, not the triggering - # branch or pull request. - # https://github.com/actions/cache/issues/319 - - name: Use Node.js + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + + - name: Setup Node 20 uses: actions/setup-node@v4 with: - node-version: 20.x - cache: "npm" - - run: npm ci + node-version: 20 + cache: "pnpm" + + - name: Install deps (with cache) + run: pnpm install - uses: ./.github/actions/ref_from_sha name: Get PR Ref from SHA diff --git a/sonar-project.properties b/sonar-project.properties index bd0059a6d..fe5f8b69b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,8 +1,8 @@ -sonar.projectKey=oaknational_ai-experiments +sonar.projectKey=oaknational_oak-ai-lesson-assistant sonar.organization=oaknational -sonar.projectName=Oak AI Projects -sonar.projectVersion=v1.38.0 +sonar.projectName=oak-ai-lesson-assistant +sonar.projectVersion=v1.41.1 sonar.projectDescription=Oak National Academy AI Web Application sonar.links.homepage=https://labs.thenational.academy/ From aad171fdd97fcdb9397b6bae6a36d574128d08b0 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 22 Aug 2024 11:23:04 +0100 Subject: [PATCH 3/6] fix: run e2e tests on merge into production and update deployment url to match new repo --- .github/workflows/playwright.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 5faeac861..c310f777f 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,11 +1,14 @@ name: Playwright on: deployment_status: + push: + branches: + - production jobs: test-e2e: timeout-minutes: 20 runs-on: ubuntu-latest - if: github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'ai-beta-nextjs') + if: github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'oak-ai-lesson-assistant') steps: - uses: actions/checkout@v4 - name: Setup pnpm From 3188b52441fb8078a81bfad055bc9b179db8a4d3 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 22 Aug 2024 11:33:32 +0100 Subject: [PATCH 4/6] fix: playwright tests for e2e --- .github/workflows/playwright.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index c310f777f..f2364eecb 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -40,13 +40,13 @@ jobs: working-directory: apps/nextjs # Only include @openai tests on RC branches run: | - if [[ "${{ steps.ref_from_sha.outputs.branch_name }}" =~ ^v[0-9\.]+-rc[0-9]+-branch$ ]]; then + if [[ "${{ steps.ref_from_sha.outputs.branch_name }}" =~ ^rc$ ]]; then pnpm test-e2e else pnpm test-e2e --grep-invert @openai fi env: - TEST_BASE_URL: ${{ github.event.deployment_status.target_url }} + TEST_BASE_URL: ${{ github.event.deployment_status.environment_url }} TEST_USER_EMAIL: ${{ steps.doppler.outputs.TEST_USER_EMAIL }} TEST_USER_PASSWORD: ${{ steps.doppler.outputs.TEST_USER_PASSWORD }} VERCEL_AUTOMATION_BYPASS_SECRET: ${{ steps.doppler.outputs.VERCEL_AUTOMATION_BYPASS_SECRET }} From 01c65e2e702e4e4afbcf6e9d6f1ab2ad7744abe5 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 22 Aug 2024 11:36:30 +0100 Subject: [PATCH 5/6] fix: job summary link --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index f2364eecb..5f184f5a4 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -68,7 +68,7 @@ jobs: message: | ### Playwright e2e tests - [Job summary](https://github.com/oaknational/ai-beta/actions/runs/${{github.run_id}}) + [Job summary](https://github.com/oaknational/oak-ai-lesson-assistant/actions/runs/${{github.run_id}}) [Download report](${{ steps.upload-report.outputs.artifact-url }}) From 0be4f780ec61ba0f70dec2d9926e1c972df3d11f Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 22 Aug 2024 11:47:56 +0100 Subject: [PATCH 6/6] fix: use vercel automation bypass from repo secrets --- .github/workflows/playwright.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 5f184f5a4..6fdbefbf9 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -46,10 +46,10 @@ jobs: pnpm test-e2e --grep-invert @openai fi env: - TEST_BASE_URL: ${{ github.event.deployment_status.environment_url }} + TEST_BASE_URL: ${{ github.event.deployment_status.target_url }} TEST_USER_EMAIL: ${{ steps.doppler.outputs.TEST_USER_EMAIL }} TEST_USER_PASSWORD: ${{ steps.doppler.outputs.TEST_USER_PASSWORD }} - VERCEL_AUTOMATION_BYPASS_SECRET: ${{ steps.doppler.outputs.VERCEL_AUTOMATION_BYPASS_SECRET }} + VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }} NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ steps.doppler.outputs.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }} CLERK_SECRET_KEY: ${{ steps.doppler.outputs.CLERK_SECRET_KEY }} - name: Upload Playwright report