Skip to content

Commit

Permalink
Feat: update build pipeline (#73)
Browse files Browse the repository at this point in the history
* chore(deps): remove microbundle

* chore(deps): audit

* chore(deps): add rimraf

* chore: update ts config

* chore: remove unused var

* build: restructure package setup

* chore: remove vscode from gitignore

* build: add prepublishOnly script

* chore(deps): remove release dependencies

* chore: pkg json for test

* chore(deps): add changesets

* ci: changeset config

* ci: add changeset script

* ci: add changeset scripts

* ci: add install-dependencies github action

* ci: add workflows

* fix: add missing property

* ci: add branch trigger

* chore: update scripts

* ci: update verify workflow

* chore: cleanup script

* chore(deps): add ts-node

* fix: tests

* ci: update verify workflow

* chore: fix types

* fix: remove paths

* fix: prepublish script

* chore: remove test branch

* ci: remove superseeded workflows

* test: skip service tests

* ci: activate verify.test
  • Loading branch information
moritzkirstein authored Mar 18, 2024
1 parent 55956a1 commit b101213
Show file tree
Hide file tree
Showing 34 changed files with 19,424 additions and 10,126 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "deltaDAO/nautilus"
}
],
"commit": false,
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["test", "docs"]
}
14 changes: 14 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Install dependencies'
description: 'Prepare repository and all dependencies'

runs:
using: 'composite'
steps:
- name: Set up npm
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install dependencies
shell: bash
run: npm install
38 changes: 38 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release (Canary)
on:
push:
branches: [main, rc]
workflow_dispatch:

jobs:
canary:
name: Release canary
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Setup .npmrc file
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'

- name: Set version
run: |
jq --arg prop "workspaces" 'del(.[$prop])' package.json > package.tmp.json && rm package.json && cp package.tmp.json package.json && rm package.tmp.json
cd src
npm --no-git-tag-version version 0.0.0
npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S')
- name: Build
run: npm run build

- name: Publish to npm
run: cd src && npm publish --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66 changes: 66 additions & 0 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Changesets
on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

changesets:
name: Create version pull request
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Create Version Pull Request
uses: changesets/action@v1
with:
commit: 'chore: version package'
title: 'chore: version package'
version: npm run changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
id-token: write

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Publish to NPM
uses: changesets/action@v1
with:
createGithubReleases: ${{ github.ref == 'refs/heads/main' }}
publish: npm run changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# https://docs.npmjs.com/generating-provenance-statements
NPM_CONFIG_PROVENANCE: true
36 changes: 0 additions & 36 deletions .github/workflows/publish-pkg.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/release.yml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Verify
on:
workflow_call:
workflow_dispatch:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

# - name: Lint code
# run: npm format && npm lint:fix

- name: Lint code
run: npm run lint:fix

- uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'chore: format'
commit_user_name: 'github-actions[bot]'
commit_user_email: 'github-actions[bot]@users.noreply.github.com'

build:
name: Build
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Build
run: npm run build

types:
name: Types
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
typescript-version: ['5.0.2', 'latest']

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- run: npm i -D typescript@${{ matrix.typescript-version }}

- name: Check types
run: npm run typecheck

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Run tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: npm run test:mocha:unit
# env:
# SOME_ENV: ${{ vars.SOME_ENV }}

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
_cjs
_esm
_types
node_modules
.DS_STORE
.env*

dist
.vscode

.env*

tsconfig*.tsbuildinfo

.vercel
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"wix.vscode-import-cost"
]
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"search.exclude": {
"**/.next": true,
"**/out": true
}
}
Loading

0 comments on commit b101213

Please sign in to comment.