Skip to content

Commit

Permalink
Simplify the release process (no more build script or release branche…
Browse files Browse the repository at this point in the history
…s) (#281)

* Simplify the release process (no more build script or release branches)

* Remove the `bin/` submodule

* npm run pack

* Use a different YAML syntax

Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>

* Use simpler (but equivalent) logic

Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>

* Fix a logic bug

* Remove some job matrices

Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>

* Intentionally fail a job (to make sure that `finalize` thus also fails)

* Revert "Intentionally fail a job (to make sure that `finalize` thus also fails)"

This reverts commit cd7944c.

---------

Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
  • Loading branch information
DilumAluthge and omus committed Sep 23, 2024
1 parent 54be0dc commit a0a0978
Show file tree
Hide file tree
Showing 12 changed files with 38,635 additions and 148 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/checkin.yml

This file was deleted.

222 changes: 222 additions & 0 deletions .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
name: PR Checks
on:
pull_request:
push:
branches:
- master
tags: '*'
concurrency:
# Skip intermediate builds: all builds except for builds on the `master` branch
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
permissions:
contents: read
jobs:
finalize-pr-checks:
if: always() # this line is important to keep the `finalize` job from being marked as skipped; do not change or delete this line
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- checked-in-files
- build
- npm-run-test
- make-targets
- stalecheck-npm-install
steps:
- run: |
echo checked-in-files: ${{ needs.checked-in-files.result }}
echo build: ${{ needs.build.result }}
echo npm-run-test: ${{ needs.npm-run-test.result }}
echo make-targets: ${{ needs.make-targets.result }}
echo stalecheck-npm-install: ${{ needs.stalecheck-npm-install.result }}
- run: exit 1
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
checked-in-files:
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
### Check out the repo:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
### Cleanall:
- run: make cleanall
### Install NodeJS
# Unix (non-Windows):
- uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
if: runner.os != 'Windows'
- run: make unix-asdf-install
if: runner.os != 'Windows'
# Windows:
# Windows does not support asdf, so we have to use `actions/setup-node`
# to install asdf:
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
if: runner.os == 'Windows'
with:
node-version-file: '.tool-versions'
### Install the NodeJS packages that we depend on:
- run: make install-packages
### Print some debugging info:
- name: Print the NodeJS version (for debugging)
run: |
which -a node
node --version
which -a npm
npm --version
### Build:
- run: make pack
### Clean (not cleanall!):
- run: make clean
### Make sure there are no uncommited changes
- uses: julia-actions/setup-julia@780022b48dfc0c2c6b94cfee6a9284850107d037
with:
version: '1'
- run: git --no-pager status
- run: git --no-pager diff
- run: julia ./ci/check_uncommitted_changes.jl
build:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
### Check out the repo:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
### Cleanall:
- run: make cleanall
### Install NodeJS
# Unix (non-Windows):
- uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
if: runner.os != 'Windows'
- run: make unix-asdf-install
if: runner.os != 'Windows'
# Windows:
# Windows does not support asdf, so we have to use `actions/setup-node`
# to install asdf:
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
if: runner.os == 'Windows'
with:
node-version-file: '.tool-versions'
### Install the NodeJS packages that we depend on:
- run: make install-packages
### Print some debugging info:
- name: Print the NodeJS version (for debugging)
run: |
which -a node
node --version
which -a npm
npm --version
### Build:
- run: make build
- run: make pack
### Make sure some other `make` targets don't bitrot:
- name: Run some other `make` targets to ensure that they don't bitrot
run: |
make clean
make cleanall
- name: Run all of the "cleaning" `make` targets to ensure that they don't bitrot
run: |
make clean
make cleanall
npm-run-test:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
### Check out the repo:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
### Cleanall:
- run: make cleanall
### Install NodeJS
# Unix (non-Windows):
- uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
if: runner.os != 'Windows'
- run: make unix-asdf-install
if: runner.os != 'Windows'
# Windows:
# Windows does not support asdf, so we have to use `actions/setup-node`
# to install asdf:
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
if: runner.os == 'Windows'
with:
node-version-file: '.tool-versions'
### Install the NodeJS packages that we depend on:
- run: make install-packages
### Print some debugging info:
- name: Print the NodeJS version (for debugging)
run: |
which -a node
node --version
which -a npm
npm --version
### Build:
- run: make build
- run: make test
make-targets: # This is a job to make sure that none of the `make` targets bitrot
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
### Check out the repo:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
### Cleanall:
- run: make cleanall
### Install NodeJS
# Unix (non-Windows):
- uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
if: runner.os != 'Windows'
- run: make unix-asdf-install
if: runner.os != 'Windows'
### Install the NodeJS packages that we depend on:
- run: make install-packages
### Make sure some other `make` targets don't bitrot:
- name: Run some other `make` targets to ensure that they don't bitrot
run: |
make unix-asdf-install
make install-packages
make build
make pack
make everything-from-scratch
- name: Run all of the "cleaning" `make` targets to ensure that they don't bitrot
run: |
make clean
make cleanall
stalecheck-npm-install:
# In this job, we are basically trying to check if `package-lock.json` is in
# sync with `package-lock.json`.
#
# So, for example, if someone manually edits the `package.json` file, we want
# to make sure that the `package-lock.json` file is not out of sync with the
# `package.json` file.
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
### Check out the repo:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false
### Install NodeJS
# Unix (non-Windows):
- uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
if: runner.os != 'Windows'
- run: make unix-asdf-install
if: runner.os != 'Windows'
### Run the master commands for this job:
- run: make clean
- run: npm ci
# - run: npm install --package-lock-only
- run: npm install
### Make sure there are no uncommited changes
- uses: julia-actions/setup-julia@780022b48dfc0c2c6b94cfee6a9284850107d037
with:
version: '1'
- run: git --no-pager status
- run: git --no-pager diff
- run: julia ./ci/check_uncommitted_changes.jl
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
__tests__/runner/*
dist/
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "bin"]
path = bin
url = git@github.com:julia-actions/bin.git
49 changes: 49 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.NOTPARALLEL:

# This is the default target:
.PHONY: pack
pack: build
npm run pack

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.PHONY: everything-from-scratch
everything-from-scratch: cleanall install-packages build pack clean

# build does `npm run build`, but does not run `npm run pack`
.PHONY: build
build:
npm run build

.PHONY: test
test:
npm run test

.PHONY: install-packages
install-packages:
rm -rf node_modules/
# Note: we use `npm ci` instead of `npm install`, because we want to make sure
# that we respect the versions in the `package-lock.json` lockfile.
npm ci

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.PHONY: clean
clean:
rm -rf node_modules/

.PHONY: cleanall
cleanall: clean
rm -rf lib/
rm -rf dist/

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# asdf does not support Windows.
# On Windows, users need to install the correct version of NodeJS themselves.
.PHONY: unix-asdf-install
unix-asdf-install:
asdf plugin add nodejs # update this list when we add more tools to `.tool-versions`
asdf install

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 change: 0 additions & 1 deletion bin
Submodule bin deleted from 0f674f
16 changes: 16 additions & 0 deletions ci/check_uncommitted_changes.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const cmd = `git --no-pager diff --exit-code --stat`

const proc = run(pipeline(cmd; stdin, stdout, stderr); wait = false)

wait(proc)

@info "" success(proc) proc.exitcode

if !success(proc)
recommended_cmd = "make everything-from-scratch"
msg = "##[error] found changed files after build. " *
"Please run `$(recommended_cmd)` and " *
"then check in all changes."
println(stderr, msg)
exit(1)
end
2 changes: 2 additions & 0 deletions devdocs/local_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ First, `cd` to your clone of the repo. Now you can run the following commands:
npm ci

npm run build

npm run pack
```

When you are ready, you can commit your changes and push them to your PR.
Loading

0 comments on commit a0a0978

Please sign in to comment.