forked from blainehansen/postgres_migrator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
60 lines (47 loc) · 1.99 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
setup:
cargo install cargo-bump just
dev:
docker exec -it migrator-dev bash
test:
docker exec -it migrator-dev cargo test
full_test:
docker exec -it migrator-dev cargo test -- --ignored
build:
docker build -f release.Dockerfile -t blainehansen/postgres_migrator .
integration_test: test full_test build
#!/usr/bin/env bash
set -euo pipefail
PG_URL='postgres://experiment_user:asdf@localhost:5432/experiment-db?sslmode=disable'
docker run --rm -it --network host -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/working -e PG_URL=$PG_URL blainehansen/postgres_migrator migrate
docker run --rm -it --network host -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/working -e PG_URL=$PG_URL blainehansen/postgres_migrator --schema-directory schemas/schema.1 diff schema migrations
compose_test:
#!/usr/bin/env bash
set -euo pipefail
docker exec -it -u $(id -u ${USER}):$(id -g ${USER}) postgres_migrator postgres_migrator migrate
docker exec -it -u $(id -u ${USER}):$(id -g ${USER}) postgres_migrator postgres_migrator --schema-directory schemas/schema.1 diff schema migrations
docker exec -it -u $(id -u ${USER}):$(id -g ${USER}) postgres_migrator postgres_migrator --schema-directory schemas/schema.1 migrate --dry-run --actually-perform-onboard-migrations
_status_clean:
#!/usr/bin/env bash
set -euo pipefail
if [ -n "$(git status --porcelain)" ]; then
echo "git status not clean"
exit 1
fi
release SEMVER_PORTION: _status_clean build integration_test
#!/usr/bin/env bash
set -euxo pipefail
cargo bump {{SEMVER_PORTION}}
VERSION=$(grep '^version = "' Cargo.toml)
[[ $VERSION =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]
VERSION="${BASH_REMATCH[1]}"
echo $VERSION
GIT_VERSION="v$VERSION"
echo $GIT_VERSION
docker tag blainehansen/postgres_migrator blainehansen/postgres_migrator:$VERSION
docker push blainehansen/postgres_migrator:$VERSION
docker push blainehansen/postgres_migrator:latest
git commit -am $GIT_VERSION
git tag $GIT_VERSION
cargo publish
git push origin main
git push origin main --tags