Skip to content

Commit a3f1875

Browse files
authored
chore: add git flow with github actions [skip ci] (#1)
1 parent 7e6af39 commit a3f1875

File tree

8 files changed

+195
-155
lines changed

8 files changed

+195
-155
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Continuous Integration / Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
lint:
10+
name: Lint Code
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
# -------- pnpm + cache ----------
18+
- uses: pnpm/action-setup@v4
19+
with:
20+
version: 8 # Specify pnpm version (adjust to your preferred version)
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: 'pnpm'
25+
26+
# Try with --frozen-lockfile first, fallback to regular install if it fails
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile || pnpm install
29+
30+
- name: Run ESLint
31+
run: pnpm run lint
32+
33+
build:
34+
name: Build (Node ${{ matrix.node-version }})
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
node-version: [18.x, 20.x, 22.x]
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
# -------- pnpm + cache ----------
45+
- uses: pnpm/action-setup@v4
46+
with:
47+
version: 8 # Specify pnpm version
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version: ${{ matrix.node-version }}
51+
cache: 'pnpm'
52+
53+
# Try with --frozen-lockfile first, fallback to regular install if it fails
54+
- name: Install dependencies
55+
run: pnpm install --frozen-lockfile || pnpm install
56+
57+
- name: Build SDK
58+
run: pnpm run build
59+
60+
test:
61+
name: Run Tests
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
with:
66+
fetch-depth: 0
67+
68+
# -------- pnpm + cache ----------
69+
- uses: pnpm/action-setup@v4
70+
with:
71+
version: 8 # Specify pnpm version
72+
- uses: actions/setup-node@v4
73+
with:
74+
node-version: 20
75+
cache: 'pnpm'
76+
77+
# Try with --frozen-lockfile first, fallback to regular install if it fails
78+
- name: Install dependencies
79+
run: pnpm install --frozen-lockfile || pnpm install
80+
81+
- name: Run Jest tests
82+
run: pnpm run test

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: release
8+
cancel-in-progress: true
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write # needed for pushing version commits & creating releases
15+
issues: write # needed for commenting on issues
16+
pull-requests: write # needed for commenting on PRs
17+
id-token: write # needed for npm provenance
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
persist-credentials: false
24+
25+
- uses: pnpm/action-setup@v4
26+
with:
27+
version: 8 # Specify pnpm version
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
cache: 'pnpm'
32+
registry-url: 'https://registry.npmjs.org'
33+
provenance: true
34+
35+
# Try with --frozen-lockfile first, fallback to regular install if it fails
36+
- name: Install dependencies
37+
run: pnpm install --frozen-lockfile || pnpm install
38+
39+
- run: pnpm run test
40+
41+
- run: pnpm run build
42+
43+
- name: Install semantic-release
44+
run: pnpm add -D semantic-release @semantic-release/changelog @semantic-release/git conventional-changelog-conventionalcommits
45+
46+
- name: Run semantic-release
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
NPM_CONFIG_PROVENANCE: true
52+
run: npx semantic-release

.github/workflows/semantics.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Pull Request Semantics
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
types: [opened, edited, reopened, synchronize]
8+
9+
jobs:
10+
semantics:
11+
name: Semantics
12+
runs-on: ubuntu-latest
13+
permissions:
14+
pull-requests: read
15+
contents: read
16+
steps:
17+
- name: Validate PR Title
18+
run: |
19+
PR_TITLE="${{ github.event.pull_request.title }}"
20+
echo "Validating PR title: $PR_TITLE"
21+
22+
# Install commitlint
23+
npm init -y
24+
npm install --save-dev @commitlint/cli @commitlint/config-angular
25+
26+
# Configure commitlint
27+
echo "module.exports = { \
28+
extends: ['@commitlint/config-angular'], \
29+
rules: { \
30+
'subject-empty': [2, 'never'], \
31+
'scope-empty': [0, 'never'], \
32+
'type-case': [2, 'always', 'lower-case'], \
33+
'type-empty': [2, 'never'], \
34+
'type-enum': [2, 'always', ['chore','feat','fix','refactor']] \
35+
} \
36+
};" > commitlint.config.js
37+
38+
# Validate title
39+
echo "$PR_TITLE" | npx commitlint

.releaserc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"branches": ["master"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
["@semantic-release/release-notes-generator", { "preset": "conventionalcommits" }],
6+
"@semantic-release/changelog",
7+
["@semantic-release/npm", {
8+
"provenance": true
9+
}],
10+
["@semantic-release/git", {
11+
"assets": ["CHANGELOG.md", "package.json", "pnpm-lock.yaml"],
12+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
13+
}],
14+
"@semantic-release/github"
15+
]
16+
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

test/integration/deployments.real.int.test.ts

Lines changed: 0 additions & 152 deletions
This file was deleted.

test/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './response-helpers';
1+
export * from './response-helpers';

test/utils/response-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ErrorCode } from '../../src';
1+
import { ErrorCode } from '../../src/http/schemas';
22

33
/**
44
* Helper to create a success response envelope
@@ -55,4 +55,4 @@ export function createErrorResponse(error: {
5555
}
5656

5757
return response;
58-
}
58+
}

0 commit comments

Comments
 (0)