Skip to content

Commit cdf2703

Browse files
committed
Improve CI and use pnpm
1 parent c7e8545 commit cdf2703

File tree

18 files changed

+5401
-202
lines changed

18 files changed

+5401
-202
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Bug Report
2+
description: Create a bug report to help us improve
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
Thanks for taking the time to fill out this bug report!
8+
- type: textarea
9+
id: description
10+
attributes:
11+
label: Bug Description
12+
description: A clear and concise description of what the bug is
13+
placeholder: Tell us what you see!
14+
validations:
15+
required: true
16+
- type: textarea
17+
id: reproduction
18+
attributes:
19+
label: To Reproduce
20+
description: Steps to reproduce the behavior
21+
placeholder: |
22+
1. Start the KurrentDB server
23+
2. Connect the client to the server
24+
3. Create a new stream
25+
4. Append an event to the stream
26+
5. Read the event from the stream
27+
6. Observe the issue
28+
validations:
29+
required: true
30+
- type: textarea
31+
id: expected
32+
attributes:
33+
label: Expected behavior
34+
description: A clear and concise description of what you expected to happen
35+
validations:
36+
required: true
37+
- type: markdown
38+
attributes:
39+
value: '## Environment'
40+
- type: input
41+
id: db
42+
attributes:
43+
label: KurrentDB Version
44+
placeholder: ex. 24.10.0
45+
validations:
46+
required: true
47+
- type: input
48+
id: client
49+
attributes:
50+
label: Client Version
51+
placeholder: ex. 1.0.0
52+
validations:
53+
required: true
54+
- type: input
55+
id: nodejs-version
56+
attributes:
57+
label: Node.js Version
58+
placeholder: ex. 18.16.0
59+
validations:
60+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Feature request
4+
url: https://discuss.eventstore.com/
5+
about: Suggest an idea for this project
6+
- name: Question / Problem
7+
url: https://discuss.eventstore.com/
8+
about: Questions and problems with n8n

.github/scripts/bump_versions.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import {promisify} from 'util';
2+
import assert from 'assert';
3+
import {resolve} from 'path';
4+
import semver from 'semver';
5+
import {exec as execCallback} from 'child_process';
6+
import {writeFile, readFile} from 'fs/promises';
7+
8+
const exec = promisify(execCallback);
9+
10+
async function updatePackageVersion(packagePath, currentVersion, releaseType) {
11+
const packageFile = resolve(packagePath, 'package.json');
12+
const packageJson = JSON.parse(await readFile(packageFile, 'utf-8'));
13+
14+
packageJson.version = semver.inc(currentVersion, releaseType);
15+
16+
await writeFile(packageFile, JSON.stringify(packageJson, null, 2) + '\n');
17+
}
18+
19+
async function main() {
20+
const releaseType = process.env.RELEASE_TYPE;
21+
assert.match(releaseType, /^(patch|minor|major)$/, 'Invalid RELEASE_TYPE');
22+
23+
const packages = JSON.parse((await exec('pnpm ls -r --only-projects --json')).stdout);
24+
25+
for (let {name, path, version, private: isPrivate} of packages) {
26+
if (isPrivate && name !== 'kurrent-node-client-repository') continue;
27+
await updatePackageVersion(path, version, releaseType);
28+
}
29+
}
30+
31+
main().catch(error => {
32+
console.error('Error updating package versions:', error);
33+
process.exit(1);
34+
});

.github/workflows/build_and_lint.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v3
17+
18+
- uses: pnpm/action-setup@v4
19+
with:
20+
version: 9.15.0
21+
1722
- name: Install
18-
run: npm install
23+
run: pnpm install
24+
1925
- name: Linting
20-
run: npm run lint
26+
run: pnpm run lint
27+
2128
- name: Build on Ubuntu
22-
run: npm run build
29+
run: pnpm run build
30+
2331
- name: All generated code is commited
2432
run: |
2533
git update-index --refresh
@@ -30,17 +38,28 @@ jobs:
3038
strategy:
3139
fail-fast: true
3240
matrix:
33-
os: [ubuntu-latest, macos-latest, windows-latest]
41+
os: [ ubuntu-latest, macos-latest, windows-latest ]
3442
runs-on: ${{ matrix.os }}
3543

3644
steps:
3745
- uses: actions/checkout@v4
46+
47+
- uses: pnpm/action-setup@v4
48+
with:
49+
version: 9.15.0
50+
3851
- uses: actions/setup-node@v4
3952
with:
4053
node-version-file: .github/files/.nvmrc
54+
4155
- name: NodeJS version
4256
run: node -v
57+
58+
- name: PNPM version
59+
run: pnpm --version
60+
4361
- name: Install
44-
run: npm install
62+
run: pnpm install
63+
4564
- name: Build
46-
run: npm run build
65+
run: pnpm run build

.github/workflows/release_pr.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'Release: Create Pull Request'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
base-branch:
7+
description: 'The branch, tag, or commit to create this release PR from.'
8+
required: true
9+
default: 'master'
10+
11+
release-type:
12+
description: 'A SemVer release type.'
13+
required: true
14+
type: choice
15+
default: 'minor'
16+
options:
17+
- patch
18+
- minor
19+
- major
20+
21+
jobs:
22+
create-release-pr:
23+
runs-on: ubuntu-latest
24+
25+
permissions:
26+
contents: write
27+
pull-requests: write
28+
29+
timeout-minutes: 5
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/[email protected]
34+
with:
35+
fetch-depth: 0
36+
ref: ${{ github.event.inputs.base-branch }}
37+
38+
- uses: pnpm/action-setup@v4
39+
with:
40+
version: 9.15.0
41+
42+
- run: npm install --prefix=.github/scripts --no-package-lock
43+
44+
- name: Bump package versions
45+
run: |
46+
echo "NEXT_RELEASE=$(node .github/scripts/bump_versions.mjs)" >> $GITHUB_ENV
47+
env:
48+
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
49+
50+
- name: Push the base branch
51+
run: |
52+
git push -f origin refs/remotes/origin/${{ github.event.inputs.base-branch }}:refs/heads/release/${{ env.NEXT_RELEASE }}
53+
54+
- name: Push the release branch, and Create the PR
55+
uses: peter-evans/create-pull-request@v6
56+
with:
57+
base: 'release/${{ env.NEXT_RELEASE }}'
58+
branch: 'release-pr/${{ env.NEXT_RELEASE }}'
59+
commit-message: 'Release ${{ env.NEXT_RELEASE }}'
60+
delete-branch: true
61+
labels: release,release:${{ github.event.inputs.release-type }}
62+
title: 'Release ${{ env.NEXT_RELEASE }}'

.github/workflows/release_publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: 'Release: Publish'
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- 'release/*'
9+
10+
jobs:
11+
publish-to-npm:
12+
name: Publish to NPM
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.merged == true
15+
timeout-minutes: 10
16+
permissions:
17+
id-token: write
18+
outputs:
19+
release: ${{ steps.set-release.outputs.release }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/[email protected]
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: pnpm/[email protected]
27+
with:
28+
version: 9.15.0
29+
30+
- run: pnpm install
31+
32+
- name: Build
33+
run: pnpm run build
34+
35+
- name: Cache build artifacts
36+
uses: actions/cache/[email protected]
37+
with:
38+
path: ./packages/**/dist
39+
key: ${{ github.sha }}-release:build
40+
41+
- name: Dry-run publishing
42+
run: pnpm publish -r --no-git-checks --dry-run
43+
44+
- name: Publish to NPM
45+
run: |
46+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
47+
pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --no-git-checks

.github/workflows/test_ee.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,38 @@ jobs:
3333
sudo apt-get update
3434
sudo apt-get install tailscale
3535
sudo tailscale up --authkey ${{ secrets.TAILSCALE_AUTH }} --hostname "node-client-ci-${{ env.KURRENT_VERSION }}-$(date +'%Y-%m-%d-%H-%M-%S')" --advertise-tags=tag:ci --accept-routes
36+
37+
- uses: pnpm/action-setup@v4
38+
with:
39+
version: 9.15.0
40+
3641
- uses: actions/setup-node@v4
3742
with:
3843
node-version-file: .github/files/.nvmrc
44+
cache: 'pnpm'
45+
3946
- name: NodeJS version
4047
run: node -v
48+
4149
- name: Login to Cloudsmith
4250
uses: docker/login-action@v3
4351
with:
4452
registry: docker.eventstore.com
4553
username: ${{ secrets.CLOUDSMITH_CICD_USER }}
4654
password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }}
55+
4756
- name: Install
48-
run: npm install
49-
- name: Build
50-
run: npm run build
57+
run: pnpm install
58+
59+
- name: Build
60+
run: pnpm run build
61+
5162
- name: Run Tests
52-
run: npm run test ${{ matrix.group.path }} --ci --run-in-band --forceExit
63+
run: pnpm run test ${{ matrix.group.path }} --ci --run-in-band --forceExit
5364
env:
5465
KURRENT_IMAGE: eventstore-ee:${{ env.KURRENT_VERSION }}
5566
EVENTSTORE_CLOUD_ID: ${{ secrets.EVENTSTORE_CLOUD_ID }}
67+
5668
- name: Disconnect from tailscale
5769
if: ${{ always() && matrix.group.tailscale && env.SECRETS_AVAILABLE == 'true' }}
5870
run: sudo tailscale down

.github/workflows/tests.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,31 @@ jobs:
5555
sudo apt-get update
5656
sudo apt-get install tailscale
5757
sudo tailscale up --authkey ${{ secrets.tailscale_auth }} --hostname "node-client-ci-${{ inputs.version }}-$(date +'%Y-%m-%d-%H-%M-%S')" --advertise-tags=tag:ci --accept-routes
58+
59+
- uses: pnpm/action-setup@v4
60+
with:
61+
version: 9.15.0
62+
5863
- uses: actions/setup-node@v4
5964
with:
6065
node-version-file: .github/files/.nvmrc
66+
cache: 'pnpm'
67+
6168
- name: NodeJS version
6269
run: node -v
70+
6371
- name: Install
64-
run: npm install
72+
run: pnpm install
73+
6574
- name: Build
66-
run: npm run build
75+
run: pnpm run build
76+
6777
- name: Run Tests
68-
run: npm run test ${{ matrix.group.path }} --ci --run-in-band --forceExit
78+
run: pnpm run test ${{ matrix.group.path }} --ci --run-in-band --forceExit
6979
env:
7080
KURRENT_IMAGE: eventstore-ce:${{ inputs.version }}
7181
EVENTSTORE_CLOUD_ID: ${{ secrets.eventstore_cloud_id }}
82+
7283
- name: Disconnect from tailscale
7384
if: ${{ always() && matrix.group.tailscale && env.SECRETS_AVAILABLE == 'true' }}
7485
run: sudo tailscale down

0 commit comments

Comments
 (0)