Add CI job to check GraphQL schema #29143
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: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
env: | |
TZ: UTC | |
OC_ENV: ci | |
NODE_ENV: test | |
WEBSITE_URL: http://localhost:3000 | |
API_URL: http://localhost:3060 | |
PDF_SERVICE_URL: http://localhost:3002 | |
API_KEY: dvl-1510egmf4a23d80342403fb599qd | |
CI: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run lint:quiet | |
prettier: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run prettier:check | |
depcheck: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run depcheck | |
ts-unused-exports: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run ts-unused-exports | |
check-langs: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run langs:check | |
check-graphql: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run graphql:check | |
check-graphql-alt: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- name: Run GraphQL update | |
run: | | |
npm run graphql:update | tee /dev/stdout | |
- name: Check for schema changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Error: GraphQL schema is not up to date. Please update the schema and commit changes." && exit 1 | |
else | |
echo "GraphQL schema is up to date." | |
fi | |
check-codegen: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run graphql:codegen-check -- --verbose 2>&1 | tee codegen.log | |
check-codegen-alt: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run graphql:codegen-check -- --verbose 2>&1 | tee codegen.log | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- name: Restore NextJS build cache | |
uses: actions/cache@v4 | |
with: | |
path: .next/cache | |
# Generate a new cache whenever packages or source files change | |
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache | |
restore-keys: | | |
${{ runner.os }}-${{ secrets.CACHE_VERSION }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
${{ runner.os }}-${{ secrets.CACHE_VERSION }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
${{ runner.os }}-${{ secrets.CACHE_VERSION }}-nextjs- | |
- name: Build | |
run: PRESERVE_NEXT_CACHE=true npm run build | |
- name: Save NextJS build | |
uses: actions/cache@v4 | |
with: | |
path: .next | |
key: ${{ runner.os }}-next-build-${{ github.sha }} | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run test:jest | |
typescript: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run type:check | |
build-components: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup project | |
uses: ./.github/actions/setup-project | |
with: | |
CACHE_VERSION: ${{ secrets.CACHE_VERSION }} | |
- run: npm run build:components | |
e2e: | |
if: github.ref_name != 'i18n/crowdin' | |
needs: build | |
uses: ./.github/workflows/e2e.yml | |
secrets: inherit |