Server side validation #1162
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: CI | |
on: | |
- pull_request | |
jobs: | |
lint: | |
name: Code formatting & linting | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Set up Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: web/pnpm-lock.yaml | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Check formatting with Prettier | |
run: pnpm format:check | |
- name: Lint | |
run: pnpm lint | |
- name: Check Typescript | |
run: pnpm typecheck | |
build: | |
name: Test build | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Set up Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: web/pnpm-lock.yaml | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
env: | |
GENERAL_SECRET_KEY: unsafe_test_key | |
HASURA_GRAPHQL_JWT_SECRET: '{"key": "unsafe_AnEsZxveGsAWoENHGAnEsZxveGsAvxgMtDq9UxgTsDq9UxgTsNHGWoENIoJ", "type": "HS512"}' | |
JWT_ISSUER: invalid.localhost | |
run: pnpm build | |
docker-build: | |
name: Test Docker build | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/docker | |
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} | |
- name: Build Docker image | |
run: docker build --cache-from developer-portal-test:latest -t developer-portal-test:latest . | |
# - name: Run API tests | |
# run: docker run developer-portal-test pnpm test:api | |
api-tests: | |
name: API Tests | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Set up Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: web/pnpm-lock.yaml | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run API tests | |
run: | | |
pnpm test:api | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: satackey/[email protected] | |
continue-on-error: true | |
- name: Run services | |
run: | | |
docker compose -f ../docker-compose-test.yaml up -d hasura_test | |
- name: Set up Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: web/pnpm-lock.yaml | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run integration tests | |
run: | | |
pnpm test:integration | |
e2e-tests: | |
name: End-to-end Tests | |
runs-on: ubuntu-20.04 | |
environment: development | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
- uses: satackey/[email protected] | |
continue-on-error: true | |
- name: Run backend services | |
run: | | |
docker compose -f ../docker-compose.yaml up -d | |
- name: Set up Node 20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: web/pnpm-lock.yaml | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Install Chromium | |
run: pnpm exec playwright install chromium | |
- name: Run end-to-end tests | |
run: pnpm test:e2e | |
env: | |
NEXT_PUBLIC_APP_URL: ${{ vars.NEXT_PUBLIC_APP_URL }} | |
NEXT_PUBLIC_GRAPHQL_API_URL: ${{ vars.NEXT_PUBLIC_GRAPHQL_API_URL }} | |
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }} | |
HASURA_GRAPHQL_JWT_SECRET: ${{ secrets.HASURA_GRAPHQL_JWT_SECRET }} | |
JWT_ISSUER: ${{ vars.JWT_ISSUER }} | |
INTERNAL_ENDPOINTS_SECRET: ${{ secrets.INTERNAL_ENDPOINTS_SECRET }} | |
GENERAL_SECRET_KEY: ${{ secrets.GENERAL_SECRET_KEY }} | |
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }} | |
AUTH0_SECRET: ${{ secrets.AUTH0_SECRET }} | |
AUTH0_BASE_URL: ${{ vars.AUTH0_BASE_URL }} | |
AUTH0_ISSUER_BASE_URL: ${{ secrets.AUTH0_ISSUER_BASE_URL }} | |
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} | |
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} | |
TEST_USER_AUTH0_ID: ${{ secrets.TEST_USER_AUTH0_ID }} | |
TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }} | |
TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }} | |
QASE_MODE: ${{ vars.QASE_MODE }} | |
QASE_TESTOPS_API_TOKEN: ${{ secrets.QASE_TESTOPS_API_TOKEN }} | |
unit-tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Set up Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: web/pnpm-lock.yaml | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run unit tests | |
run: | | |
pnpm test:unit |