feat: enable prisma relation joins #209
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: Validate | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}-validate" | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
validate: | |
name: Validate | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: true | |
matrix: | |
node-version: [20.x] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Necessary because `actions/setup-node` does not yet support `corepack`. | |
# @see https://github.com/actions/setup-node/issues/531 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- 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 --frozen-lockfile | |
- name: Lint commit messages | |
uses: acdh-oeaw/commitlint-action@v1 | |
- name: Format | |
run: pnpm run format:check | |
- name: Lint | |
run: pnpm run lint:check | |
- name: Typecheck | |
run: pnpm run types:check | |
- name: Run unit tests | |
run: pnpm run test:unit | |
- name: Get playwright version | |
run: | | |
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version') | |
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
- name: Cache playwright browsers | |
uses: actions/cache@v4 | |
id: cache-playwright-browsers | |
with: | |
path: "~/.cache/ms-playwright" | |
key: "${{ matrix.os }}-playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}" | |
- name: Install playwright browsers | |
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
run: pnpm exec playwright install --with-deps | |
- name: Install playwright browsers (operating system dependencies) | |
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true' | |
run: pnpm exec playwright install-deps | |
- name: Cache Next.js build output | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: ${{ matrix.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }} | |
# TODO: local postgres instance for e2e tests | |
# TODO: create test user in local postgres instance for e2e tests | |
# TODO: ingest local postgres instance with seed/ingest for e2e tests | |
- name: Build app | |
run: pnpm run build | |
env: | |
AUTH_SECRET: "${{ secrets.K8S_SECRET_AUTH_SECRET }}" | |
AUTH_URL: "http://localhost:3000/api/auth" | |
DATABASE_DIRECT_URL: "postgresql://dariah-unr:dariah-unr@localhost:5432/dariah-unr?schema=public" | |
DATABASE_TEST_USER_COUNTRY_CODE: | |
"${{ secrets.K8S_SECRET_DATABASE_TEST_USER_COUNTRY_CODE }}" | |
DATABASE_TEST_USER_EMAIL: "${{ secrets.K8S_SECRET_DATABASE_TEST_USER_EMAIL }}" | |
DATABASE_TEST_USER_NAME: "${{ secrets.K8S_SECRET_DATABASE_TEST_USER_NAME }}" | |
DATABASE_TEST_USER_PASSWORD: "${{ secrets.K8S_SECRET_DATABASE_TEST_USER_PASSWORD }}" | |
DATABASE_URL: "postgresql://dariah-unr:dariah-unr@localhost:5432/dariah-unr?schema=public" | |
EMAIL_CONTACT_ADDRESS: "${{ secrets.K8S_SECRET_TEST_EMAIL_CONTACT_ADDRESS }}" | |
EMAIL_PASSWORD: "${{ secrets.K8S_SECRET_TEST_EMAIL_PASSWORD }}" | |
EMAIL_SMTP_PORT: "${{ vars.K8S_SECRET_TEST_EMAIL_SMTP_PORT }}" | |
EMAIL_SMTP_SERVER: "${{ vars.K8S_SECRET_TEST_EMAIL_SMTP_SERVER }}" | |
EMAIL_USER_NAME: "${{ secrets.K8S_SECRET_TEST_EMAIL_USER_NAME }}" | |
NEXT_PUBLIC_APP_BASE_URL: "http://localhost:3000" | |
NEXT_PUBLIC_MATOMO_BASE_URL: "${{ vars.NEXT_PUBLIC_MATOMO_BASE_URL }}" | |
NEXT_PUBLIC_REDMINE_ID: "${{ vars.SERVICE_ID }}" | |
SSHOC_MARKETPLACE_API_BASE_URL: "${{ vars.K8S_SECRET_SSHOC_MARKETPLACE_API_BASE_URL }}" | |
SSHOC_MARKETPLACE_BASE_URL: "${{ vars.K8S_SECRET_SSHOC_MARKETPLACE_BASE_URL }}" | |
SSHOC_MARKETPLACE_PASSWORD: "${{ secrets.K8S_SECRET_SSHOC_MARKETPLACE_PASSWORD }}" | |
SSHOC_MARKETPLACE_USER_NAME: "${{ secrets.K8S_SECRET_SSHOC_MARKETPLACE_USER_NAME }}" | |
- name: Run e2e tests | |
run: pnpm run test:e2e | |
env: | |
AUTH_SECRET: "${{ secrets.K8S_SECRET_AUTH_SECRET }}" | |
AUTH_URL: "http://localhost:3000/api/auth" | |
DATABASE_DIRECT_URL: "postgresql://dariah-unr:dariah-unr@localhost:5432/dariah-unr?schema=public" | |
DATABASE_TEST_USER_COUNTRY_CODE: | |
"${{ secrets.K8S_SECRET_DATABASE_TEST_USER_COUNTRY_CODE }}" | |
DATABASE_TEST_USER_EMAIL: "${{ secrets.K8S_SECRET_DATABASE_TEST_USER_EMAIL }}" | |
DATABASE_TEST_USER_NAME: "${{ secrets.K8S_SECRET_DATABASE_TEST_USER_NAME }}" | |
DATABASE_TEST_USER_PASSWORD: "${{ secrets.K8S_SECRET_DATABASE_TEST_USER_PASSWORD }}" | |
DATABASE_URL: "postgresql://dariah-unr:dariah-unr@localhost:5432/dariah-unr?schema=public" | |
EMAIL_CONTACT_ADDRESS: "${{ secrets.K8S_SECRET_TEST_EMAIL_CONTACT_ADDRESS }}" | |
EMAIL_PASSWORD: "${{ secrets.K8S_SECRET_TEST_EMAIL_PASSWORD }}" | |
EMAIL_SMTP_PORT: "${{ vars.K8S_SECRET_TEST_EMAIL_SMTP_PORT }}" | |
EMAIL_SMTP_SERVER: "${{ vars.K8S_SECRET_TEST_EMAIL_SMTP_SERVER }}" | |
EMAIL_USER_NAME: "${{ secrets.K8S_SECRET_TEST_EMAIL_USER_NAME }}" | |
NEXT_PUBLIC_APP_BASE_URL: "http://localhost:3000" | |
NEXT_PUBLIC_MATOMO_BASE_URL: "${{ vars.NEXT_PUBLIC_MATOMO_BASE_URL }}" | |
NEXT_PUBLIC_REDMINE_ID: "${{ vars.SERVICE_ID }}" | |
SSHOC_MARKETPLACE_API_BASE_URL: "${{ vars.K8S_SECRET_SSHOC_MARKETPLACE_API_BASE_URL }}" | |
SSHOC_MARKETPLACE_BASE_URL: "${{ vars.K8S_SECRET_SSHOC_MARKETPLACE_BASE_URL }}" | |
SSHOC_MARKETPLACE_PASSWORD: "${{ secrets.K8S_SECRET_SSHOC_MARKETPLACE_PASSWORD }}" | |
SSHOC_MARKETPLACE_USER_NAME: "${{ secrets.K8S_SECRET_SSHOC_MARKETPLACE_USER_NAME }}" | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
build-deploy: | |
if: ${{ github.event_name == 'push' }} | |
needs: [validate] | |
uses: ./.github/workflows/build-deploy.yml | |
secrets: inherit | |
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#access-and-permissions | |
permissions: | |
contents: read | |
packages: write |