Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

feat: standardised CI/CD for smaller packages #48

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Setup
runs:
using: composite
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action caches global node_modules by default, when cache is present. I cleaned up the widgets version that had custom caching for readability and easier maintenance. I think we don't need a node_modules specific caching for smaller packages, Yarn will be fast anyway re-instantiating from global cache.

This is open discussion!

with:
node-version: 16
cache: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
21 changes: 21 additions & 0 deletions .github/workflows/check-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This workflow will check the pull request title for a valid semantic commit message
# For more information see: https://semantic-release.gitbook.io/semantic-release/#commit-message-format
name: Check PR Title

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/lint.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release

# This workflow can be triggered manually by the user through the GitHub UI.
on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup
- run: yarn test
- run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

# This workflow will run automatically on every PR against `main` branch. It can be also trigerred
# manually via the Github UI.
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup
- run: yarn lint

deps:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup
- run: yarn deduplicate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating whether we should contain all scripts this action runs within action, or use package.json scripts. Ended up moving entirely there to unify.


test:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup
- run: yarn test

build:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup
- run: yarn build
27 changes: 0 additions & 27 deletions .github/workflows/unit-tests.yml

This file was deleted.

27 changes: 26 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"test": "tsdx test",
"build": "tsdx build",
"start": "tsdx watch",
"deduplicate": "yarn-deduplicate --strategy=highest --list --fail",
"release": "semantic-release",
"lint": "prettier . --check",
"prepublishOnly": "tsdx build"
},
"repository": {
Expand All @@ -33,13 +36,35 @@
"@uniswap/v3-sdk": "^3.10.0"
},
"devDependencies": {
"@semantic-release/commit-analyzer": "^10.0.4",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.0.4",
"@semantic-release/npm": "^10.0.5",
"@semantic-release/release-notes-generator": "^11.0.7",
"@types/jest": "^24.0.25",
"prettier": "^2.4.1",
"tsdx": "^0.14.1"
"semantic-release": "^21.1.1",
"tsdx": "^0.14.1",
"yarn-deduplicate": "^6.0.2"
},
"prettier": {
"printWidth": 120,
"semi": false,
"singleQuote": true
},
"release": {
"branches": "main",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github",
"@semantic-release/npm"
]
}
}
Loading
Loading