mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
RailpackBuilderImage and RailpackRuntimeImage named
ghcr.io/railwayapp/railpack-{builder,runtime}, so every `pack build`
pulled the upstream vendor's images instead of our own. Point them at
ghcr.io/hanzoai/pack-{builder,runtime}, published by the release
pipeline as of the prior commit.
Also updates the local-dev mirrors of the same reference: the
mise-builder-shell task, the run-with-frontend script, the mise clean
task's image cleanup list, and a stale comment in buildkit/frontend.go.
Snapshots refreshed with the project's own task
(UPDATE_SNAPS=true go test -short ./...) and inspected line by line:
every changed line is exactly the builder/runtime image string, nothing
else. The pre-existing, unrelated php-vanilla frankenphp version drift
that the same refresh also touches was left untouched here.
Do not merge until a release tag has gone through the pipeline from the
prior commit and ghcr.io/hanzoai/pack-builder and pack-runtime actually
exist -- until then this is a correct diff sitting ahead of its own
prerequisite, not something to land on main.
Co-authored-by: Hanzo Dev <[email protected]>
177 lines
6.1 KiB
TOML
177 lines
6.1 KiB
TOML
[env]
|
|
BUILDKIT_HOST = "docker-container://buildkit"
|
|
RAILPACK_MISE_VERSION = "{{read_file(path='core/mise/version.txt')}}"
|
|
|
|
_.path = './bin'
|
|
|
|
[tools]
|
|
go = "1.26"
|
|
golangci-lint = "latest"
|
|
bun = "1.3"
|
|
|
|
[settings]
|
|
experimental = true
|
|
# without this, navigating into various examples/ will output an annoying warning
|
|
idiomatic_version_file_enable_tools = ["python", "node", "ruby", "bun"]
|
|
# ensures homebrew go, etc doesn't take precedence
|
|
activate_aggressive = true
|
|
env_shell_expand = true
|
|
locked = true
|
|
|
|
[tasks.setup]
|
|
run = [
|
|
"mise install",
|
|
"mise run run-buildkit-container",
|
|
]
|
|
|
|
[tasks.run-buildkit-container]
|
|
# Mount buildkitd.toml so host.docker.internal:7890 (local registry) is reachable over HTTP
|
|
# `.template` ensures it isn't picked up by the mise task management
|
|
run = '''
|
|
docker rm -f buildkit 2>/dev/null || true
|
|
docker run --rm --privileged -d --name buildkit \
|
|
-e BUILDKIT_DEBUG=1 \
|
|
-v "$PWD/.mise/tasks/buildkitd.toml.template:/etc/buildkit/buildkitd.toml:ro" \
|
|
moby/buildkit:latest \
|
|
--config /etc/buildkit/buildkitd.toml
|
|
'''
|
|
|
|
[tasks.cli]
|
|
run = "go run cmd/cli/main.go"
|
|
|
|
# run a go debugging against the CLI entrypoint
|
|
[tasks.debug-cli]
|
|
run = "dlv debug github.com/hanzoai/pack/cmd/cli --"
|
|
|
|
# build the CLI binary (`./bin/pack`) for local use outside the project
|
|
[tasks.build]
|
|
run = "go build -o bin/pack cmd/cli/main.go"
|
|
|
|
[tasks.clean]
|
|
run = [
|
|
"rm -rf bin dist docs/dist",
|
|
"find . -type d -name node_modules -prune -exec rm -rf {} +",
|
|
# clean up buildkit cache, avoids cached layers from being used
|
|
"docker exec buildkit buildctl prune",
|
|
"rm -f *.test",
|
|
# stop all railpack containers
|
|
"docker ps -q --filter name=railpack | xargs -r docker stop",
|
|
# remove all images created by the integration test suite
|
|
"docker images 'railpack-test-*' -q | xargs -r docker rmi -f",
|
|
# remove images created by manually running `railpack build` against a project example
|
|
"find examples -name test.json -exec dirname {} \\; | xargs -n 1 basename | xargs -r -I {} docker rmi -f {}",
|
|
# remove railpack builder/frontend base images (ghcr + local tags)
|
|
"docker images 'ghcr.io/hanzoai/pack-builder' -q | xargs -r docker rmi -f",
|
|
"docker images 'ghcr.io/hanzoai/pack-frontend' -q | xargs -r docker rmi -f",
|
|
"docker images 'railpack-builder' -q | xargs -r docker rmi -f",
|
|
"docker images 'railpack-frontend' -q | xargs -r docker rmi -f",
|
|
# tear down Apple container machine + host Docker TCP proxy used by mise-linux-shell
|
|
"mise run mise-linux-shell --stop",
|
|
"go clean -testcache",
|
|
"mise cache clear",
|
|
"rm -rf /tmp/railpack",
|
|
# delete all top-level node_modules in examples/, this can cause state issues which cause snapshots to generate incorrectly
|
|
"find examples -maxdepth 2 -type d -name node_modules -exec rm -rf {} +",
|
|
# same goes for python .venv folders
|
|
"find examples -maxdepth 2 -type d -name .venv -exec rm -rf {} +",
|
|
]
|
|
|
|
# if a example folder does not have a test.json file, it will be skipped
|
|
[tasks.examples-without-tests]
|
|
run = "find examples -mindepth 1 -maxdepth 1 -type d ! -exec [ -f \"{}/test.json\" ] \\; -print "
|
|
|
|
# run unit tests
|
|
[tasks.test]
|
|
run = "go test -short ./..."
|
|
|
|
# Runs *all* integration tests. It is extremely slow, do not run this locally.
|
|
# Instead, only run the test that you are currently working on:
|
|
# `mise run test-integration -- -run "TestExamplesIntegration/config-file"`
|
|
[tasks.test-integration]
|
|
run = "go test -v ./integration_tests"
|
|
|
|
# run integration test for the example directory you're currently in
|
|
# optionally filter to a single test.json case: `mise run test-integration-cwd -- 1`
|
|
[tasks.test-integration-cwd]
|
|
usage = 'arg "[case]" help="Optional 0-based test.json case index (e.g. 1 for the second case)"'
|
|
run = """
|
|
if [[ ! "$MISE_ORIGINAL_CWD" =~ /examples/ ]]; then
|
|
echo "Error: must be run from within an examples/ directory"
|
|
exit 1
|
|
fi
|
|
|
|
example_name=$(basename "$MISE_ORIGINAL_CWD")
|
|
run_filter="TestExamplesIntegration/$example_name"
|
|
if [[ -n "${usage_case:-}" ]]; then
|
|
run_filter="$run_filter/case-${usage_case}$"
|
|
echo "Running integration test for: $example_name (case $usage_case)"
|
|
else
|
|
echo "Running integration test for: $example_name"
|
|
fi
|
|
go test -v ./integration_tests -run "$run_filter"
|
|
"""
|
|
|
|
[tasks.run-example-cwd]
|
|
run = """
|
|
if [[ ! "$MISE_ORIGINAL_CWD" =~ /examples/ ]]; then
|
|
echo "Error: must be run from within an examples/ directory"
|
|
exit 1
|
|
fi
|
|
|
|
example_name=$(basename "$MISE_ORIGINAL_CWD")
|
|
mise run cli --verbose build $MISE_ORIGINAL_CWD --show-plan --progress=plain --env MISE_VERBOSE=1
|
|
echo "Running example: 'docker run $example_name'"
|
|
"""
|
|
|
|
# update all test snapshots, if you've updated a example/ project, run this to update the snapshots
|
|
[tasks.test-update-snapshots]
|
|
run = [
|
|
"UPDATE_SNAPS=true go test -short ./...",
|
|
"find . -path ./tmp -prune -o -type d -name '__snapshots__' -exec git add -- {} +",
|
|
"echo 'test: update snapshots' > $(git rev-parse --git-dir)/COMMIT_EDITMSG",
|
|
]
|
|
|
|
# modernize code using the latest Go fixers
|
|
[tasks.fix]
|
|
description = "Modernize code using the latest Go fixers"
|
|
run = ["golangci-lint run --fix",
|
|
"go fix ./..."]
|
|
|
|
# linting, formatting, and static analysis
|
|
# `go build` leads because it asks a question none of the others do. vet, lint
|
|
# and the unit suite all compile _test.go files, so a package whose non-test code
|
|
# depends on a symbol declared in a _test.go file passes every one of them while
|
|
# `go build ./...` fails. That is not hypothetical: integration_tests did exactly
|
|
# that, and the gate stayed green over a tree that would not build.
|
|
[tasks.check]
|
|
run = ["go build ./...", "go vet ./...", "go fmt ./...", "golangci-lint run", "go mod verify"]
|
|
|
|
[tasks.upgrade]
|
|
description = "Upgrade all Go and Mise packages"
|
|
# this task is intentionally run in the same shell so changes caused by version updates are picked up
|
|
run = '''
|
|
# ensures we are using the latest version of mise locally
|
|
mise self-update
|
|
|
|
# updates lockfiles
|
|
mise upgrade --local
|
|
eval "$(mise hook-env)"
|
|
|
|
# get latest go packages
|
|
go get -u ./...
|
|
go mod tidy
|
|
|
|
# update packages, respecting semver
|
|
cd docs && bun update
|
|
'''
|
|
|
|
# build docs for production
|
|
[tasks.docs-build]
|
|
dir = "docs"
|
|
run = ["bun install --frozen-lockfile", "bun run build"]
|
|
|
|
[tasks.docs-dev]
|
|
dir = "docs"
|
|
run = ["bun install", "bun run dev"]
|
|
|