From 023e549235cdd8fd45bb13ebd155df80b71f5efc Mon Sep 17 00:00:00 2001 From: Chris Nowicki <102450568+chris-nowicki@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:16:04 -0400 Subject: [PATCH] fix(#377): decouple tests into individual files --- .github/workflows/{ci.yml => e2e.yml} | 38 ++++----------------------- .github/workflows/jest.yml | 34 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 33 deletions(-) rename .github/workflows/{ci.yml => e2e.yml} (56%) create mode 100644 .github/workflows/jest.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/e2e.yml similarity index 56% rename from .github/workflows/ci.yml rename to .github/workflows/e2e.yml index b2e11284..94916b09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/e2e.yml @@ -1,38 +1,10 @@ -name: LGT Jest & Playwright Tests +name: E2E Tests on: pull_request: types: [opened, synchronize, reopened] jobs: - jest-test: - runs-on: ubuntu-latest - env: - NEXT_PUBLIC_APPWRITE_API_URL: ${{ secrets.NEXT_PUBLIC_APPWRITE_API_URL }} - NEXT_PUBLIC_APPWRITE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_APPWRITE_PROJECT_ID }} - NEXT_PUBLIC_APPWRITE_DATABASE_ID: ${{ secrets.NEXT_PUBLIC_APPWRITE_DATABASE_ID }} - APPWRITE_API_KEY: ${{ secrets.APPWRITE_API_KEY }} - strategy: - matrix: - node-version: ['20.x'] - - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - name: tests - run: pnpm test - test-e2e-setup: name: Setup E2E Tests runs-on: ubuntu-latest @@ -49,9 +21,9 @@ jobs: - name: Get URL run: echo "https://${{ steps.vercel_preview_url.outputs.preview_url }}" - test_e2e: + test-e2e: needs: test-e2e-setup - name: Playwright Tests + name: E2E Tests timeout-minutes: 5 runs-on: ubuntu-latest env: @@ -64,8 +36,8 @@ jobs: with: node-version: lts/* - run: npm install -g pnpm && pnpm install - - run: pnpm exec playwright install --with-deps - - run: pnpm exec playwright test + - run: pnpm exec playwright install --with-deps + - run: pnpm exec playwright test - name: Upload Artifacts uses: actions/upload-artifact@v4 if: always() diff --git a/.github/workflows/jest.yml b/.github/workflows/jest.yml new file mode 100644 index 00000000..0ba88e14 --- /dev/null +++ b/.github/workflows/jest.yml @@ -0,0 +1,34 @@ +name: Jest Unit Tests + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + jest-test: + runs-on: ubuntu-latest + env: + NEXT_PUBLIC_APPWRITE_API_URL: ${{ secrets.NEXT_PUBLIC_APPWRITE_API_URL }} + NEXT_PUBLIC_APPWRITE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_APPWRITE_PROJECT_ID }} + NEXT_PUBLIC_APPWRITE_DATABASE_ID: ${{ secrets.NEXT_PUBLIC_APPWRITE_DATABASE_ID }} + APPWRITE_API_KEY: ${{ secrets.APPWRITE_API_KEY }} + strategy: + matrix: + node-version: ['20.x'] + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + - name: tests + run: pnpm test