Skip to content

Commit

Permalink
WIP (migrate away from rush)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 18, 2023
1 parent 72b5025 commit d365bb6
Show file tree
Hide file tree
Showing 123 changed files with 8,982 additions and 14,079 deletions.
54 changes: 15 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rush CI (changelog, build, test)
name: CI (build, test, format)
# All pull requests, and
# Workflow dispatch allows you to run this workflow manually from the Actions tab
on:
Expand All @@ -10,7 +10,7 @@ on:

env:
AFFECTED_OR_ALL: |
${{ github.ref_name == 'main' && ' ' || format('--to git:origin/{0}', github.base_ref) }}
${{ github.ref_name == 'main' && ' ' || '--filter=...[origin/main]' }}
jobs:
build:
Expand All @@ -20,55 +20,31 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
NodeVersion: [16, 18]
NodeVersion: [18]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Fetch base branch
if: github.ref_name != 'main'
run: git fetch origin ${{ github.base_ref }}
- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.NodeVersion }}
cache: 'pnpm'

- name: Cache Rush
uses: actions/cache@v3
with:
path: |
common/temp/install-run
~/.rush
key: cache-rush-${{ runner.os }}-${{ hashFiles('rush.json') }}
- name: Install dependencies
run: pnpm install

- name: Cache pnpm
uses: actions/cache@v3
with:
path: |
common/temp/pnpm-store
key: cache-pnpm-${{ runner.os }}
- name: Build packages
run: pnpm build ${{ env.AFFECTED_OR_ALL }}

- name: Rush install (install-run-rush)
run: |
node common/scripts/install-run-rush.js install ${{ env.AFFECTED_OR_ALL }}
- name: Rush build + test (install-run-rush)
run: |
node common/scripts/install-run-rush.js build --verbose ${{ env.AFFECTED_OR_ALL }}
node common/scripts/install-run-rush.js test --verbose ${{ env.AFFECTED_OR_ALL }}
env:
# Prevent time-based browserslist update warning
# See https://github.com/microsoft/rushstack/issues/2981
BROWSERSLIST_IGNORE_OLD_DATA: 1

- name: Rush format (install-run-rush)
if: github.ref_name != 'main'
run: |
node common/scripts/install-run-rush.js format:ci --verbose ${{ env.AFFECTED_OR_ALL }}
- name: Test packages
run: pnpm test ${{ env.AFFECTED_OR_ALL }}

- name: Rush verify Change Logs (install-run-rush)
- name: Verify source code formatting
if: github.ref_name != 'main'
run: |
node common/scripts/install-run-rush.js change --verify --target-branch origin/${{ github.base_ref }}
run: pnpm run format:ci ${{ env.AFFECTED_OR_ALL }}
56 changes: 56 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Migration notes

## What & Why

This monorepo is managed using Rush. The tool is opinionated and may work well
for certain projects and teams, yet it's not performing to our standards and
needs (which is also opinionated, lol). The main issue is that it's basically a
framework in front of everything. A framework works well, until it doesn't.

Let's follow widely used standards and the Unix philosophy a bit more: pick the
right tool for each job separately. So we can update and swap out tools
separately as the ~~trend~~ need arises.

## What jobs?

- Build and test packages
- Format and lint source code
- Cache results of builds and tests to save time and resources
- Build and test packages, and only those affected in a pull request
- Publish packages
- Dependency management, e.g. to fixate versions of dependencies across packages

## But how?

- `pnpm` does a lot out of the box already
- [turborepo][1] seems great for caching and "affected packages" logic
- [changesets][2] seems great for changelogs and publishing

## Guide

- Use more standards where possible, e.g. leverage `"private": true` for
packages that should not be published.
- Commands are run through the package manager (npm, pnpm, ...) based on the
standardized `package.json#scripts`. When we replace a tool the commands don't
change. You _can_ run `turbo build` instead of `pnpm build`, but that's on
you.

## TODO

- [ ] Find out wat heft/rigs actually do for us
- [ ] Look into version policies (e.g. to "group" packages)
- [ ] Enforce fixed version across monorepo for certain/all dependencies
- [ ] Fix build of `@kadena/client-examples`
- [ ] Implement alternative to [packageTable.ts][3]
- [ ] Propose flat `packages/*` structure

## Misc.

```sh
pnpm run test --filter @kadena/react-ui
pnpm -r run "/^format:(md|pkg|src)/"
```

[1]: https://turbo.build
[2]: https://github.com/changesets/changesets
[3]: packages/tools/remark-plugins/src/commentMarkers/packageTable.ts
10 changes: 0 additions & 10 deletions common/autoinstallers/rush-command-packages/package.json

This file was deleted.

Loading

0 comments on commit d365bb6

Please sign in to comment.