From 1947cbfa0b689f38c10e9e678efd11f6ee1f4c26 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 15 Jul 2024 15:39:06 -0400 Subject: [PATCH] ci: run linting first then tests --- .github/workflows/check-formatting.yml | 21 ------------------ .github/workflows/ci.yml | 30 ++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/check-formatting.yml diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml deleted file mode 100644 index 931fd4811..000000000 --- a/.github/workflows/check-formatting.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Check Formatting" - -on: - push: - branches: [main] - pull_request: {} - -jobs: - check: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Node.js v20 - uses: actions/setup-node@v2.1.5 - with: - node-version: 20 - - name: Build and Format - run: yarn - - name: Check Formatting - run: git diff --exit-code diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dd015805..4a114a1c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,34 @@ on: pull_request: {} jobs: - build: + check: + name: Lint and Format Check + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - uses: the-guild-org/shared-config/setup@main + name: Setup Env + with: + nodeVersion: 20 + packageManager: yarn + + - name: Check Formatting + run: yarn format:check + + - name: Lint + run: yarn lint + + test: + needs: [check] strategy: matrix: node-version: [18, 20, 22] system: - os: ubuntu-22.04 runs-on: ${{ matrix.system.os }} + name: Test on Node.js v${{ matrix.node-version }} (${{ matrix.system.os }}) services: postgres: image: postgres:13 @@ -32,19 +53,24 @@ jobs: --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v3 + - name: update OS run: | sudo apt-get update sudo apt install -y --no-install-recommends gcc g++ make build-essential + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} registry-url: https://registry.npmjs.org/ + - run: yarn install --frozen-lockfile env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - run: yarn test:ci env: POSTGRES_TEST_HOST: localhost