diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a44caa..7a05045 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,83 +11,8 @@ on: - '*.md' jobs: - dependency-review: - name: Dependency Review - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Check out repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Dependency review - uses: actions/dependency-review-action@v2 - test: - runs-on: ubuntu-latest - permissions: - contents: read - strategy: - matrix: - node-version: [14, 16, 18] - services: - postgres: - image: postgres:11-alpine - env: - POSTGRES_USER: postgres - POSTGRES_DB: postgres - POSTGRES_PASSWORD: postgres - ports: - - '5432:5432' - options: >- - --health-cmd pg_isready --health-interval 10s --health-timeout 5s - --health-retries 5 - steps: - - name: Check out repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Install dependencies - run: npm i - - - name: CI environment setup - run: > - npm i node-gyp - - sudo apt-get install -yqq libpq-dev postgresql-client - - chmod 600 .pgpass - - PGPASSFILE=.pgpass psql -h localhost -p ${{ - job.services.postgres.ports[5432] }} -d postgres -c 'CREATE TABLE - users(id serial PRIMARY KEY, username VARCHAR (50) NOT NULL);' -U - postgres - - - name: Run tests - run: | - npm run test:ci - - automerge: - name: Automerge Dependabot PRs - if: > - github.event_name == 'pull_request' && - github.event.pull_request.user.login == 'dependabot[bot]' - needs: test - permissions: - pull-requests: write - contents: write - runs-on: ubuntu-latest - steps: - - uses: fastify/github-action-merge-dependabot@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - target: major + uses: fastify/workflows/.github/workflows/plugins-ci-postgres.yml@v3 + with: + license-check: true + lint: true diff --git a/package.json b/package.json index aecf764..78830da 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,12 @@ "types": "index.d.ts", "scripts": { "check-examples": "tsc --build examples/typescript/*", + "lint": "standard", "lint:fix": "standard --fix", "load-data": "docker exec -it fastify-postgres psql -c 'CREATE TABLE users(id serial PRIMARY KEY, username VARCHAR (50) NOT NULL);' -U postgres -d postgres", "postgres": "docker run -p 5432:5432 --name fastify-postgres -e POSTGRES_PASSWORD=postgres -d postgres:11-alpine", - "test": "standard && tap -J test/*.test.js && npm run test:typescript", - "test:ci": "standard && tap -J test/*.test.js --coverage-report=lcovonly && npm run test:typescript", + "test": "npm run test:unit && npm run test:typescript", + "test:unit": "tap -J test/*.test.js", "test:report": "standard && tap -J --coverage-report=html test/*.test.js", "test:typescript": "tsd", "test:verbose": "standard && tap -J test/*.test.js -Rspec"