Skip to content

Commit b2a1c14

Browse files
authored
fix: move all make commands to just (#548)
1 parent d79050f commit b2a1c14

11 files changed

Lines changed: 106 additions & 120 deletions

File tree

.github/workflows/canary.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ jobs:
1212
steps:
1313
- name: Checkout code
1414
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
15-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
16-
with:
17-
go-version: '^1.16.3'
15+
- name: Init Hermit
16+
uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # ratchet:cashapp/activate-hermit@v1
1817
- name: Build Hermit
1918
run: |
20-
make GOOS=linux GOARCH=amd64 CHANNEL=canary build
21-
make GOOS=linux GOARCH=arm64 CHANNEL=canary build
22-
make GOOS=darwin GOARCH=amd64 CHANNEL=canary build
23-
make GOOS=darwin GOARCH=arm64 CHANNEL=canary build
19+
just build canary linux amd64
20+
just build canary linux arm64
21+
just build canary darwin amd64
22+
just build canary darwin arm64
2423
INSTALLER_VERSION=$(go run -ldflags "-X main.channel=canary" ./cmd/hermit gen-installer --dest=build/install.sh)
2524
cp build/install.sh build/install-"${INSTALLER_VERSION}".sh
2625
- name: Release canary

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Init Hermit
5454
uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # ratchet:cashapp/activate-hermit@v1
5555
- name: Test
56-
run: make -C docs schema
56+
run: just docs-schema
5757
it:
5858
# The integration tests cannot be run in an active Hermit environment,
5959
# so we don't activate it here.

.github/workflows/docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout Repo
11-
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # ratchet:actions/checkout@master
11+
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # ratchet:actions/checkout@master
1212
with:
1313
submodules: true
1414
- name: Init Hermit
@@ -19,8 +19,7 @@ jobs:
1919
. .venv/bin/activate
2020
echo PATH=$PATH >> $GITHUB_ENV
2121
- name: Generate Schema Docs
22-
run: |
23-
make -C docs schema
22+
run: just docs-schema
2423
- name: Setup mkdocs
2524
working-directory: ./docs
2625
run: pip install -r requirements.txt

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ jobs:
1212
steps:
1313
- name: Checkout code
1414
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
15-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
16-
with:
17-
go-version: "^1.16.3"
15+
- name: Init Hermit
16+
uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # ratchet:cashapp/activate-hermit@v1
1817
- name: Build Hermit
1918
run: |
20-
make GOOS=linux GOARCH=amd64 CHANNEL=stable build
21-
make GOOS=linux GOARCH=arm64 CHANNEL=stable build
22-
make GOOS=darwin GOARCH=amd64 CHANNEL=stable build
23-
make GOOS=darwin GOARCH=arm64 CHANNEL=stable build
19+
just build stable linux amd64
20+
just build stable linux arm64
21+
just build stable darwin amd64
22+
just build stable darwin arm64
2423
INSTALLER_VERSION=$(go run -ldflags "-X main.channel=stable" ./cmd/hermit gen-installer --dest=build/install.sh)
2524
cp build/install.sh build/install-"${INSTALLER_VERSION}".sh
2625
- name: Release versioned

Justfile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
repo := "cashapp/hermit"
2+
root := justfile_directory()
3+
build_dir := root / "build"
4+
version := `git describe --tags --dirty --always`
5+
goos := `go env GOOS`
6+
goarch := `go env GOARCH`
7+
export HERMIT_EXE := ""
8+
9+
_help:
10+
@just --list
11+
12+
# Run lint, test, and build
13+
all: lint test build
14+
15+
# Run golangci-lint
16+
lint:
17+
golangci-lint run
18+
19+
# Run tests
20+
test:
21+
go test ./...
22+
23+
# Run integration tests
24+
test-integration:
25+
go test -count=1 -tags integration -v ./integration
26+
27+
# Build binary and gzip it
28+
build channel="canary" os=goos arch=goarch: (build-binary channel os arch)
29+
gzip -f9 {{ build_dir / ("hermit-" + os + "-" + arch) }}
30+
31+
# Build binary
32+
build-binary channel="canary" os=goos arch=goarch:
33+
mkdir -p {{ build_dir }}
34+
CGO_ENABLED=0 GOOS={{ os }} GOARCH={{ arch }} go build -ldflags "-X main.version={{ version }} -X main.channel={{ channel }}" -o {{ build_dir / ("hermit-" + os + "-" + arch) }} {{ root / "cmd/hermit" }}
35+
36+
# Create a new patch release (e.g. v0.49.1 -> v0.49.2)
37+
release: (_release "patch")
38+
39+
# Create a new minor release (e.g. v0.49.1 -> v0.50.0)
40+
release-minor: (_release "minor")
41+
42+
_release bump:
43+
#!/usr/bin/env bash
44+
set -euo pipefail
45+
git fetch --tags --quiet
46+
latest=$(git tag --sort=-v:refname | head -1)
47+
major=$(echo "$latest" | sed 's/^v//' | cut -d. -f1)
48+
minor=$(echo "$latest" | sed 's/^v//' | cut -d. -f2)
49+
patch=$(echo "$latest" | sed 's/^v//' | cut -d. -f3)
50+
if [ "{{ bump }}" = "minor" ]; then
51+
next="v${major}.$((minor + 1)).0"
52+
else
53+
next="v${major}.${minor}.$((patch + 1))"
54+
fi
55+
echo "Latest release: $latest"
56+
echo "{{ bump }} release: $next"
57+
if [ "{{ bump }}" = "patch" ]; then
58+
echo "(Run 'just release-minor' to bump the minor version instead)"
59+
fi
60+
read -p "Proceed? [y/N] " confirm
61+
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
62+
echo "Aborted."
63+
exit 1
64+
fi
65+
gh release create "$next" \
66+
--repo "{{ repo }}" \
67+
--target master \
68+
--generate-notes
69+
70+
# Check the status of the most recent release workflow run
71+
release-status:
72+
gh run list \
73+
--repo "{{ repo }}" \
74+
--workflow release.yml \
75+
--limit 5
76+
77+
# Watch the latest release workflow run
78+
release-watch:
79+
gh run watch \
80+
--repo "{{ repo }}" \
81+
$(gh run list --repo "{{ repo }}" --workflow release.yml --limit 1 --json databaseId --jq '.[0].databaseId')
82+
83+
# List recent releases
84+
release-list:
85+
gh release list --repo "{{ repo }}" --limit 10
86+
87+
# Generate docs schema
88+
docs-schema:
89+
go run ./cmd/gendocs ./docs/docs/packaging/schema/
90+
go run ./cmd/hermit dump-user-config-schema | sed 's,//,#,g' > docs/docs/usage/user-config-schema.hcl

Makefile

Lines changed: 0 additions & 35 deletions
This file was deleted.

bin/.make-4.4.pkg

Lines changed: 0 additions & 1 deletion
This file was deleted.

bin/make

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/Makefile

Lines changed: 0 additions & 9 deletions
This file was deleted.

it/check_script_sha.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd "${SCRIPT_DIR}/.."
77
for channel in "canary" "stable"; do
88
rm -rf build
99
# Build on native architecture
10-
make CHANNEL="${channel}" build
10+
./bin/just build "${channel}"
1111
gunzip -c build/hermit*.gz > build/hermit
1212
chmod +x build/hermit
1313
build/hermit version

0 commit comments

Comments
 (0)