-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to create a release PR (#19)
* Add release pr workflow * Add codeowners * lint rules and wf * add dynamic version
- Loading branch information
1 parent
2420a0b
commit 5ea1ac3
Showing
29 changed files
with
5,977 additions
and
1,417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": "standard-with-typescript", | ||
"overrides": [ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"files": [ | ||
".eslintrc.{js,cjs}" | ||
], | ||
"parserOptions": { | ||
"sourceType": "script" | ||
} | ||
} | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"ignorePatterns": ["**/dist/**"], | ||
"rules": { | ||
"@typescript-eslint/strict-boolean-expressions": 0, | ||
"@typescript-eslint/comma-dangle": 0, | ||
"@typescript-eslint/dot-notation": 0, | ||
"@typescript-eslint/indent": 0, | ||
"@typescript-eslint/consistent-type-definitions": 0, | ||
"@typescript-eslint/non-nullable-type-assertion-style": 0, | ||
"no-useless-catch": 0, | ||
"new-cap": 0, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: 'Lint, Unit and E2E Tests' | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install SDK dependancies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Check eslint rules | ||
run: yarn run lint-ci | ||
|
||
- name: Build SDK | ||
run: yarn run build | ||
|
||
- name: Run unit tests | ||
run: yarn run test | ||
|
||
- name: Install e2e dependancies | ||
working-directory: ./test/sdk-package-test | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build e2e | ||
working-directory: ./test/sdk-package-test | ||
run: yarn run build | ||
|
||
- name: Run e2e tests | ||
working-directory: ./test/sdk-package-test | ||
run: yarn run test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Release PR | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
type: | ||
type: choice | ||
description: Choose release type | ||
options: | ||
- auto | ||
- patch | ||
- minor | ||
- major | ||
default: auto | ||
jobs: | ||
releaseIt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: git config | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
- name: Setup node | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: npm | ||
|
||
- name: Prepare release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TYPE_ARG: ${{ fromJSON('{"auto":"", "patch":"patch", "minor":"minor", "major":"major"}')[github.event.inputs.type] }} | ||
run: npm run release -- $TYPE_ARG --ci --verbose --no-git.push --no-git.commit --no-git.tag --no-github | ||
|
||
- name: Show git status | ||
if: failure() | ||
run: git status && git diff | ||
|
||
- name: get-npm-version | ||
id: package-version | ||
uses: martinbeentjes/npm-get-version-action@main | ||
|
||
- name: Extract release notes | ||
id: extract-release-notes | ||
uses: ffurrer2/extract-release-notes@v1 | ||
|
||
- name: Generate PR body | ||
id: body | ||
uses: mathiasvr/command-output@v1 | ||
with: | ||
run: node ./bin/pr.js | ||
|
||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v4 | ||
id: cpr | ||
with: | ||
branch: release | ||
delete-branch: true | ||
commit-message: 'chore(release): v${{ steps.package-version.outputs.current-version}}' | ||
title: '[Release] v${{ steps.package-version.outputs.current-version}}' | ||
body: | | ||
## Release notes: | ||
${{ steps.extract-release-notes.outputs.release_notes }} | ||
labels: | | ||
release | ||
automated pr | ||
signoff: false | ||
draft: false |
This file was deleted.
Oops, something went wrong.
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file sets up the designated owners of the infrastructure repo. | ||
# All PR's will require a review from a member of the codeowners team. | ||
|
||
* @ObolNetwork/sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Obol Labs, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import Ajv, { ErrorObject } from 'ajv'; | ||
import Ajv, { type ErrorObject } from 'ajv' | ||
|
||
export function validatePayload(data: any, schema: any): ErrorObject[] | undefined | null | boolean { | ||
const ajv = new Ajv(); | ||
const validate = ajv.compile(schema); | ||
const isValid = validate(data); | ||
if (!isValid) { | ||
throw new Error(`Schema compilation errors', ${validate.errors && validate.errors[0].message}`); | ||
} | ||
return isValid; | ||
} | ||
export function validatePayload ( | ||
data: any, | ||
schema: any, | ||
): ErrorObject[] | undefined | null | boolean { | ||
const ajv = new Ajv() | ||
const validate = ajv.compile(schema) | ||
const isValid = validate(data) | ||
if (!isValid) { | ||
throw new Error( | ||
`Schema compilation errors', ${validate.errors?.[0].message}`, | ||
) | ||
} | ||
return isValid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.