Run lint before tests #2260
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: {} | |
jobs: | |
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 | |
env: | |
POSTGRES_DB: indexer_tests | |
POSTGRES_USER: testuser | |
POSTGRES_PASSWORD: testpass | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- 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 | |
POSTGRES_TEST_DATABASE: indexer_tests | |
POSTGRES_TEST_USERNAME: testuser | |
POSTGRES_TEST_PASSWORD: testpass | |
NODE_OPTIONS: "--dns-result-order=ipv4first" | |
INDEXER_TEST_JRPC_PROVIDER_URL: ${{ secrets.TESTS_RPC_PROVIDER }} | |
INDEXER_TEST_API_KEY: ${{ secrets.TESTS_API_KEY }} |