Skip to content
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

chore: Add release and pull request CI workflows #1300

Merged
merged 7 commits into from
Oct 22, 2024
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
66 changes: 0 additions & 66 deletions .circleci/config.yml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Pull Request

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

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Validate Pull Request Title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "$PR_TITLE" | npx commitlint

build:
runs-on: ubuntu-latest
needs: validate
strategy:
matrix:
build-type: [umd, node]
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build:${{ matrix.build-type }}

lint:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

test:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Test
run: yarn test:ci
156 changes: 156 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Release & Publish

on:
workflow_dispatch:

jobs:
validate-user:
runs-on: ubuntu-latest
steps:
- name: Validate User
id: check
env:
GITHUB_TOKEN: ${{ secrets.FEATHERY_BOT_TOKEN }}
run: |
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/orgs/feathery-org/members/$GITHUB_ACTOR")
if echo "$response" | grep -q '"message": "Not Found"'; then
echo "$GITHUB_ACTOR is not a member of the organization. Exiting."
exit 1
fi

setup:
runs-on: ubuntu-latest
needs: validate-user
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.FEATHERY_BOT_TOKEN }}

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install --frozen-lockfile

build:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
build-type: [umd, node]
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.FEATHERY_BOT_TOKEN }}

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build:${{ matrix.build-type }}

lint:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.FEATHERY_BOT_TOKEN }}

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

test:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.FEATHERY_BOT_TOKEN }}

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Test
run: yarn test:ci

release:
runs-on: ubuntu-latest
needs:
- build
- lint
- test
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.FEATHERY_BOT_TOKEN }}

- name: Setup Node.js and Cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Setup Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.FEATHERY_BOT_TOKEN }}
run: yarn release

- name: Push Changes
env:
GITHUB_TOKEN: ${{ secrets.FEATHERY_BOT_TOKEN }}
run: |
git push --follow-tags origin master

- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn publish --non-interactive --new-version $(node -p "require('./package.json').version")
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
9 changes: 9 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"releaseCommitMessageFormat": "chore(release): v{{currentTag}} - [skip ci]",
"tagPrefix": "v",
"commitAll": true,
"noVerify": true,
"skip": {
"changelog": true
}
}
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @bo-dun-1 @JakeKo
* @bo-dun-1
23 changes: 23 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [2, 'always', 'sentence-case'],
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'chore',
'style',
'refactor',
'ci',
'test',
'revert',
'perf',
'wip'
]
]
}
};
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"analyze-prod-bundle": "webpack --mode production --config webpack.development.js --env analyze",
"prepublishOnly": "yarn build",
"test": "jest --coverage",
"lint": "eslint ."
"test:ci": "jest --silent --maxWorkers=50% --ci",
"lint": "eslint ./src",
"release": "standard-version",
"prepare": "husky"
},
"peerDependencies": {
"react": ">=16",
Expand All @@ -33,6 +36,8 @@
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.2.1",
"@types/html2canvas": "^1.0.0",
Expand Down Expand Up @@ -61,13 +66,15 @@
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-typescript": "^0.14.0",
"husky": "^9.1.6",
"jest": "^26.6.3",
"npm-run-all": "^4.1.5",
"path": "^0.12.7",
"prettier": "^2.0.4",
"react": "18.2",
"react-dom": "18.2",
"react-test-renderer": "^17.0.2",
"standard-version": "^9.5.0",
"ts-loader": "^9.3.0",
"typescript": "^4.7.3",
"webpack": "^5.11.0",
Expand Down
Loading
Loading