Skip to content

Commit

Permalink
ci: Automate more of the release process (no-changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Aug 20, 2024
1 parent eecb804 commit 68972fc
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- synchronize
branches:
- '**'
- '!release/*'
- '!release/v**'

jobs:
check-pr-title:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- '**'
- '!release/*'
- '!release/v**'
pull_request_target:
branches:
- master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
ref: ${{ inputs.branch }}
nodeVersion: ${{ matrix.node-version }}
cacheKey: ${{ github.sha }}-base:build
cache-key: ${{ github.sha }}-base:build
collectCoverage: ${{ matrix.node-version == '20.x' }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -56,7 +56,7 @@ jobs:
needs: install-and-build
with:
ref: ${{ inputs.branch }}
cacheKey: ${{ github.sha }}-base:build
cache-key: ${{ github.sha }}-base:build

notify-on-failure:
name: Notify Slack on failure
Expand Down
112 changes: 6 additions & 106 deletions .github/workflows/ci-postgres-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
- packages/cli/src/databases/**
- .github/workflows/ci-postgres-mysql.yml

concurrency:
group: db-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Install & Build
Expand All @@ -38,113 +34,17 @@ jobs:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests

sqlite-pooled:
name: SQLite Pooled
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
env:
DB_TYPE: sqlite
DB_SQLITE_POOL_SIZE: 4
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Setup build cache
uses: rharkor/caching-for-turbo@v1.5

- name: Restore cached build artifacts
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests

- name: Test SQLite Pooled
working-directory: packages/cli
run: pnpm jest

mysql:
name: MySQL
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
env:
DB_MYSQLDB_PASSWORD: password
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Setup build cache
uses: rharkor/caching-for-turbo@v1.5

- name: Restore cached build artifacts
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests

- name: Start MySQL
uses: isbang/compose-action@v2.0.0
with:
compose-file: ./.github/docker-compose.yml
services: |
mysql
- name: Test MySQL
working-directory: packages/cli
run: pnpm test:mysql --testTimeout 20000

postgres:
name: Postgres
runs-on: ubuntu-latest
db-tests:
name: DB tests
uses: ./.github/workflows/db-tests-reusable.yml
needs: build
timeout-minutes: 20
env:
DB_POSTGRESDB_PASSWORD: password
DB_POSTGRESDB_POOL_SIZE: 1 # Detect connection pooling deadlocks
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Setup build cache
uses: rharkor/caching-for-turbo@v1.5

- name: Restore cached build artifacts
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests

- name: Start Postgres
uses: isbang/compose-action@v2.0.0
with:
compose-file: ./.github/docker-compose.yml
services: |
postgres
- name: Test Postgres
working-directory: packages/cli
run: pnpm test:postgres
with:
cache-key: ${{ github.sha }}:db-tests

notify-on-failure:
name: Notify Slack on failure
runs-on: ubuntu-latest
needs: [mysql, postgres]
needs: [db-tests]
steps:
- name: Notify Slack on failure
uses: act10ns/slack@v2.0.0
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/ci-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build, unit test and lint branch

on: [pull_request]
on:
pull_request:
branches:
- '**'
- '!release/v**'

jobs:
install-and-build:
Expand Down Expand Up @@ -42,12 +46,12 @@ jobs:
needs: install-and-build
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
cacheKey: ${{ github.sha }}-base:build
cache-key: ${{ github.sha }}-base:build

lint:
name: Lint
uses: ./.github/workflows/linting-reusable.yml
needs: install-and-build
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
cacheKey: ${{ github.sha }}-base:build
cache-key: ${{ github.sha }}-base:build
113 changes: 113 additions & 0 deletions .github/workflows/db-tests-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Reusable DB test workflow

on:
workflow_call:
inputs:
cache-key:
description: Cache key for modules and build artifacts.
required: true
type: string

jobs:
sqlite-pooled:
name: SQLite Pooled
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
env:
DB_TYPE: sqlite
DB_SQLITE_POOL_SIZE: 4
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Setup build cache
uses: rharkor/caching-for-turbo@v1.5

- name: Restore cached build artifacts
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ inputs.cache-key }}

- name: Test SQLite Pooled
working-directory: packages/cli
run: pnpm jest

mysql:
name: MySQL
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
env:
DB_MYSQLDB_PASSWORD: password
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Setup build cache
uses: rharkor/caching-for-turbo@v1.5

- name: Restore cached build artifacts
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ inputs.cache-key }}

- name: Start MySQL
uses: isbang/compose-action@v2.0.0
with:
compose-file: ./.github/docker-compose.yml
services: |
mysql
- name: Test MySQL
working-directory: packages/cli
run: pnpm test:mysql --testTimeout 20000

postgres:
name: Postgres
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
env:
DB_POSTGRESDB_PASSWORD: password
DB_POSTGRESDB_POOL_SIZE: 1 # Detect connection pooling deadlocks
steps:
- uses: actions/checkout@v4.1.1
- run: corepack enable
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Setup build cache
uses: rharkor/caching-for-turbo@v1.5

- name: Restore cached build artifacts
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ inputs.cache-key }}

- name: Start Postgres
uses: isbang/compose-action@v2.0.0
with:
compose-file: ./.github/docker-compose.yml
services: |
postgres
- name: Test Postgres
working-directory: packages/cli
run: pnpm test:postgres
49 changes: 0 additions & 49 deletions .github/workflows/docker-images.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/linting-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: false
type: string
default: master
cacheKey:
cache-key:
description: Cache key for modules and build artifacts.
required: false
default: ''
Expand Down Expand Up @@ -37,15 +37,15 @@ jobs:
uses: rharkor/caching-for-turbo@v1.5

- name: Build
if: ${{ inputs.cacheKey == '' }}
if: ${{ inputs.cache-key == '' }}
run: pnpm build

- name: Restore cached build artifacts
if: ${{ inputs.cacheKey != '' }}
if: ${{ inputs.cache-key != '' }}
uses: actions/cache/restore@v4.0.0
with:
path: ./packages/**/dist
key: ${{ inputs.cacheKey }}
key: ${{ inputs.cache-key }}

- name: Lint Backend
run: pnpm lint:backend
Expand Down
Loading

0 comments on commit 68972fc

Please sign in to comment.