forked from railwayapp/railpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
141 lines (117 loc) · 4.31 KB
/
mise.toml
File metadata and controls
141 lines (117 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
[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"]
# ensures homebrew go, etc doesn't take precedence
activate_aggressive = true
env_shell_expand = true
[tasks.setup]
run = [
"mise install",
"mise run run-buildkit-container || true",
]
[tasks.run-buildkit-container]
run = "docker run --rm --privileged -d --name buildkit -e BUILDKIT_DEBUG=1 moby/buildkit:latest"
[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/railwayapp/railpack/cmd/cli --"
# build the CLI binary (`./bin/railpack`) for local use outside the project
[tasks.build]
run = "go build -o bin/railpack cmd/cli/main.go"
[tasks.clean]
run = [
"rm -rf bin dist docs/dist",
# clean up buildkit cache, avoids cached layers from being used
"docker exec buildkit buildctl prune",
"rm -f *.test",
# stop all railpack containers
"docker stop $(docker ps -q --filter name=railpack)",
# 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 {}",
"go clean -testcache",
"mise cache clear",
"rm -rf /tmp/railpack",
]
# 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
[tasks.test-integration-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")
echo "Running integration test for: $example_name"
go test -v ./integration_tests -run "TestExamplesIntegration/$example_name"
"""
[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 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 . -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
[tasks.check]
run = ["go vet ./...", "go fmt ./...", "golangci-lint run", "go mod verify"]
[tasks.upgrade]
description = "Upgrade all Go and Mise packages"
run = [
# ensures we are using the latest version of mise locally
"mise self-update",
# updates lockfiles
"mise upgrade --local",
# 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"]
[tasks.image-builder-build]
run = "docker build --build-arg MISE_VERSION=$RAILPACK_MISE_VERSION -f images/debian/build/Dockerfile -t railpack-builder:local ."
[tasks.image-runtime-build]
run = "docker build -f images/debian/runtime/Dockerfile -t railpack-runtime:local ."