-
Notifications
You must be signed in to change notification settings - Fork 14
/
Justfile
95 lines (84 loc) · 2.98 KB
/
Justfile
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
# This Justfile contains rules/targets/scripts/commands that are used when
# developing. Unlike a Makefile, running `just <cmd>` will always invoke
# that command. For more information, see https://github.com/casey/just
#
#
# this setting will allow passing arguments through to tasks, see the docs here
# https://just.systems/man/en/chapter_24.html#positional-arguments
set positional-arguments
# print all available commands by default
default:
just --list
# test pgtestdb
test *args='./...':
go test -race "$@"
# test pgtestdb + migrators
test-all *args='':
#!/usr/bin/env bash
go test -race github.com/peterldowns/pgtestdb/... "$@"
# lint pgtestdb
lint *args:
golangci-lint run --fix --config .golangci.yaml "$@"
# lint pgtestdb + migrators
lint-all:
golangci-lint run --fix --config .golangci.yaml ./ ./migrators/*/
# lint nix files
lint-nix:
find . -name '*.nix' | xargs nixpkgs-fmt
# (attempt) to tidy all go.mod files
tidy:
#!/usr/bin/env bash
go mod tidy -go=1.21.0 -compat=1.21.0
for subdir in ./migrators/*/; do
pushd $subdir
go mod tidy -go=1.21.0 -compat=1.21.0
popd
done
rm -f go.work.sum
go mod tidy -go=1.21.0 -compat=1.21.0
go work sync
go mod tidy -go=1.21.0 -compat=1.21.0
# tag pgtestdb with current version
tag:
#!/usr/bin/env bash
set -e
raw="$(cat VERSION)"
git tag "$raw"
# commit="${raw}+commit.$(git rev-parse --short HEAD)"
# git tag "$commit"
# tag migrators with current version.
tag-migrators:
#!/usr/bin/env bash
set -e
raw="$(cat VERSION)"
git tag "migrators/pgmigrator/$raw"
git tag "migrators/golangmigrator/$raw"
git tag "migrators/goosemigrator/$raw"
git tag "migrators/dbmatemigrator/$raw"
git tag "migrators/atlasmigrator/$raw"
git tag "migrators/sqlmigrator/$raw"
git tag "migrators/bunmigrator/$raw"
git tag "migrators/ternmigrator/$raw"
goproxy-release:
#!/usr/bin/env bash
set -e
export GOPROXY=proxy.golang.org
version="$(cat VERSION)"
go list -m github.com/peterldowns/pgtestdb@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/pgmigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/golangmigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/goosemigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/dbmatemigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/atlasmigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/sqlmigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/bunmigrator@${version}
go list -m github.com/peterldowns/pgtestdb/migrators/ternmigrator@${version}
# set the VERSION and go.mod versions.
bump-version version:
#!/usr/bin/env bash
OLD_VERSION=$(cat VERSION)
NEW_VERSION=$1
echo "bumping $OLD_VERSION -> $NEW_VERSION"
echo $NEW_VERSION > VERSION
sed -i -e "s/$OLD_VERSION/$NEW_VERSION/g" README.md
sed -i -e "s,github.com/peterldowns/pgtestdb $OLD_VERSION,github.com/peterldowns/pgtestdb $NEW_VERSION,g" migrators/*/go.mod