Skip to content

Commit

Permalink
ci: improve workflows (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa authored Jan 24, 2024
1 parent 6eb0436 commit ee8f570
Show file tree
Hide file tree
Showing 5 changed files with 975 additions and 60 deletions.
17 changes: 17 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Setup job'
description: ''

runs:
using: 'composite'
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.10.0
cache: yarn

- name: Run yarn install
shell: bash
run: yarn --frozen-lockfile
env:
CI: 'true'
30 changes: 30 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
pull_request:
types: [synchronize, edited, opened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
uses: ./.github/actions/setup
timeout-minutes: 10

- name: Lint commit messages
run: yarn commitlint --from $BASE_SHA --to $HEAD_SHA --verbose
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}

- name: Lint pull request title
run: echo $PR_TITLE | yarn commitlint --verbose
env:
PR_TITLE: ${{ github.event.pull_request.title }}
93 changes: 33 additions & 60 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ on:
pull_request:
push:


jobs:
unit-tests:
runs-on: ubuntu22-4x16
strategy:
matrix:
node-version: [20.10.0]
services:
storage-ftp:
image: garethflowers/ftp-server:0.7.0
Expand All @@ -28,20 +24,10 @@ jobs:
- '2222:22'
steps:
- uses: actions/checkout@v4
- name: Install yarn
run: corepack enable && yarn set version 4.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: npm install
run: yarn
- name: Lint commit messages
run: ./node_modules/.bin/commitlint --from $BASE_SHA --to $HEAD_SHA --verbose
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}

- name: Setup
uses: ./.github/actions/setup
timeout-minutes: 10

- name: Build
run: |
Expand Down Expand Up @@ -99,7 +85,6 @@ jobs:
runs-on: ubuntu22-4x16
strategy:
matrix:
node-version: [20.10.0]
postgres-version: [14]
services:
postgres:
Expand All @@ -113,20 +98,18 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install yarn
run: corepack enable && yarn set version 4.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: npm install
run: corepack enable && yarn set version 4.0.2 && yarn

- name: Setup
uses: ./.github/actions/setup
timeout-minutes: 10

- name: Build
run: |
./node_modules/.bin/tsc --build packages/postgres/tsconfig.json;
- name: Test
run: npm run test:coverage packages/postgres/

- name: Send coverage
run: ./node_modules/.bin/codecov -f coverage/*.json

Expand All @@ -136,7 +119,6 @@ jobs:
runs-on: ubuntu22-4x16
strategy:
matrix:
node-version: [20.10.0]
mysql-version: [8.0]
services:
mysql:
Expand All @@ -149,46 +131,39 @@ jobs:
- '3306:3306'
steps:
- uses: actions/checkout@v4
- name: Install yarn
run: corepack enable && yarn set version 4.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: npm install
run: corepack enable && yarn set version 4.0.2 && yarn

- name: Setup
uses: ./.github/actions/setup
timeout-minutes: 10

- name: Build
run: |
./node_modules/.bin/tsc --build packages/mysql/tsconfig.json
- name: Test
run: npm run test:coverage packages/mysql/

- name: Send coverage
run: ./node_modules/.bin/codecov -f coverage/*.json

orm-sqlite:
needs:
- unit-tests
runs-on: ubuntu22-4x16
strategy:
matrix:
node-version: [20.10.0]
steps:
- uses: actions/checkout@v4
- name: Install yarn
run: corepack enable && yarn set version 4.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: npm install
run: corepack enable && yarn set version 4.0.2 && yarn

- name: Setup
uses: ./.github/actions/setup
timeout-minutes: 10

- name: Build
run: |
./node_modules/.bin/tsc --build packages/sqlite/tsconfig.json
- name: Test
run: npm run test:coverage packages/sqlite/

- name: Send coverage
run: ./node_modules/.bin/codecov -f coverage/*.json

Expand All @@ -198,7 +173,6 @@ jobs:
runs-on: ubuntu22-4x16
strategy:
matrix:
node-version: [20.10.0]
mongo-version: [4.0]
services:
# this is used for the simple-auth test
Expand All @@ -218,20 +192,19 @@ jobs:
with:
mongodb-version: ${{ matrix.mongo-version }}
mongodb-replica-set: test-rs

- uses: actions/checkout@v4
- name: Install yarn
run: corepack enable && yarn set version 4.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install
run: corepack enable && yarn set version 4.0.2 && yarn

- name: Setup
uses: ./.github/actions/setup
timeout-minutes: 10

- name: Build
run: |
./node_modules/.bin/tsc --build packages/mongo/tsconfig.json
- name: Test
run: npm run test:coverage packages/mongo/

- name: Send coverage
run: ./node_modules/.bin/codecov -f coverage/*.json
Loading

0 comments on commit ee8f570

Please sign in to comment.