Skip to content

chore: add git flow with github actions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Continuous Integration / Pull Request

on:
pull_request:
branches:
- master

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# -------- pnpm + cache ----------
- uses: pnpm/action-setup@v4
with:
version: 8 # Specify pnpm version (adjust to your preferred version)
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

# Try with --frozen-lockfile first, fallback to regular install if it fails
- name: Install dependencies
run: pnpm install --frozen-lockfile || pnpm install

- name: Run ESLint
run: pnpm run lint

build:
name: Build (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# -------- pnpm + cache ----------
- uses: pnpm/action-setup@v4
with:
version: 8 # Specify pnpm version
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

# Try with --frozen-lockfile first, fallback to regular install if it fails
- name: Install dependencies
run: pnpm install --frozen-lockfile || pnpm install

- name: Build SDK
run: pnpm run build

test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# -------- pnpm + cache ----------
- uses: pnpm/action-setup@v4
with:
version: 8 # Specify pnpm version
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

# Try with --frozen-lockfile first, fallback to regular install if it fails
- name: Install dependencies
run: pnpm install --frozen-lockfile || pnpm install

- name: Run Jest tests
run: pnpm run test
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

on:
workflow_dispatch:

concurrency:
group: release
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # needed for pushing version commits & creating releases
issues: write # needed for commenting on issues
pull-requests: write # needed for commenting on PRs
id-token: write # needed for npm provenance

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: pnpm/action-setup@v4
with:
version: 8 # Specify pnpm version
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
provenance: true

# Try with --frozen-lockfile first, fallback to regular install if it fails
- name: Install dependencies
run: pnpm install --frozen-lockfile || pnpm install

- run: pnpm run test

- run: pnpm run build

- name: Install semantic-release
run: pnpm add -D semantic-release @semantic-release/changelog @semantic-release/git conventional-changelog-conventionalcommits

- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: npx semantic-release
39 changes: 39 additions & 0 deletions .github/workflows/semantics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Pull Request Semantics

on:
pull_request:
branches:
- master
types: [opened, edited, reopened, synchronize]

jobs:
semantics:
name: Semantics
runs-on: ubuntu-latest
permissions:
pull-requests: read
contents: read
steps:
- name: Validate PR Title
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
echo "Validating PR title: $PR_TITLE"

# Install commitlint
npm init -y
npm install --save-dev @commitlint/cli @commitlint/config-angular

# Configure commitlint
echo "module.exports = { \
extends: ['@commitlint/config-angular'], \
rules: { \
'subject-empty': [2, 'never'], \
'scope-empty': [0, 'never'], \
'type-case': [2, 'always', 'lower-case'], \
'type-empty': [2, 'never'], \
'type-enum': [2, 'always', ['chore','feat','fix','refactor']] \
} \
};" > commitlint.config.js

# Validate title
echo "$PR_TITLE" | npx commitlint
16 changes: 16 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/release-notes-generator", { "preset": "conventionalcommits" }],
"@semantic-release/changelog",
["@semantic-release/npm", {
"provenance": true
}],
["@semantic-release/git", {
"assets": ["CHANGELOG.md", "package.json", "pnpm-lock.yaml"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
"@semantic-release/github"
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
152 changes: 0 additions & 152 deletions test/integration/deployments.real.int.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './response-helpers';
export * from './response-helpers';
4 changes: 2 additions & 2 deletions test/utils/response-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorCode } from '../../src';
import { ErrorCode } from '../../src/http/schemas';

/**
* Helper to create a success response envelope
Expand Down Expand Up @@ -55,4 +55,4 @@ export function createErrorResponse(error: {
}

return response;
}
}
Loading