Compare commits
4 Commits
27ef86c1b4
...
c21fb5813b
| Author | SHA1 | Date | |
|---|---|---|---|
| c21fb5813b | |||
| 33a5a1a262 | |||
| df8e69bce2 | |||
| 58fdcfba9f |
@@ -21,7 +21,8 @@ If you want, add yourself to the `CONTRIBUTORS` file in your pull request.
|
|||||||
|
|
||||||
For Rust, just use `cargo fmt`. For Python, use
|
For Rust, just use `cargo fmt`. For Python, use
|
||||||
[black](https://github.com/psf/black). I'd rather not spend any effort in
|
[black](https://github.com/psf/black). I'd rather not spend any effort in
|
||||||
configuring the formatters (not possible for black anyway).
|
configuring the formatters (not possible for black anyway). For shell scripts,
|
||||||
|
use [`shfmt`](https://github.com/mvdan/sh).
|
||||||
|
|
||||||
## Tooling
|
## Tooling
|
||||||
|
|
||||||
@@ -41,6 +42,9 @@ When contributing, consider whether it makes sense to add tests which could
|
|||||||
prevent regressions in the future. When fixing bugs, it makes sense to add
|
prevent regressions in the future. When fixing bugs, it makes sense to add
|
||||||
tests that expose the wrong behaviour beforehand.
|
tests that expose the wrong behaviour beforehand.
|
||||||
|
|
||||||
|
To also ensure proper formatting and that the linter is happy, use `just check`.
|
||||||
|
If that succeeds, your code is most likely fine to push!
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
The documentation lives in `docs` and uses
|
The documentation lives in `docs` and uses
|
||||||
|
|||||||
5
Justfile
5
Justfile
@@ -4,8 +4,6 @@ static_target := "x86_64-unknown-linux-musl"
|
|||||||
|
|
||||||
check: fmt-check lint test
|
check: fmt-check lint test
|
||||||
cargo check
|
cargo check
|
||||||
cargo fmt --check
|
|
||||||
cargo clippy --no-deps -- -Dwarnings
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cargo clean
|
cargo clean
|
||||||
@@ -14,13 +12,16 @@ clean:
|
|||||||
fmt:
|
fmt:
|
||||||
cargo fmt
|
cargo fmt
|
||||||
git ls-files | grep '\.py$' | xargs black
|
git ls-files | grep '\.py$' | xargs black
|
||||||
|
git ls-files | grep '\.sh$' | xargs -L 1 shfmt --indent 4 --write
|
||||||
|
|
||||||
fmt-check:
|
fmt-check:
|
||||||
cargo fmt --check
|
cargo fmt --check
|
||||||
git ls-files | grep '\.py$' | xargs black --check
|
git ls-files | grep '\.py$' | xargs black --check
|
||||||
|
git ls-files | grep '\.sh$' | xargs -L 1 shfmt --indent 4 --diff
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
cargo clippy --no-deps -- -Dwarnings
|
cargo clippy --no-deps -- -Dwarnings
|
||||||
|
git ls-files | grep '\.sh$' | xargs -L 1 shellcheck --norc
|
||||||
|
|
||||||
lint-fix:
|
lint-fix:
|
||||||
cargo clippy --no-deps --fix
|
cargo clippy --no-deps --fix
|
||||||
|
|||||||
27
release.sh
27
release.sh
@@ -45,12 +45,14 @@ if ! [[ "${new_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(git rev-parse --abbrev-ref HEAD) != "develop" ]] ; then
|
current_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
if [[ "${current_branch}" != "develop" ]]; then
|
||||||
printf '%s\n' 'You need to be on develop' >&2
|
printf '%s\n' 'You need to be on develop' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$(git status --porcelain)" ]] ; then
|
gitstatus="$(git status --porcelain)"
|
||||||
|
if [[ -n "${gitstatus}" ]]; then
|
||||||
printf '%s\n' 'There are uncommitted changes' >&2
|
printf '%s\n' 'There are uncommitted changes' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -83,7 +85,8 @@ if ! git merge-base --is-ancestor master develop ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $(git log --oneline master..develop | wc -l) == 0 )) ; then
|
changes="$(git log --oneline master..develop | wc -l)"
|
||||||
|
if ((changes == 0)); then
|
||||||
printf '%s\n' 'No changes between master and develop?' >&2
|
printf '%s\n' 'No changes between master and develop?' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -97,7 +100,7 @@ sed -i "0,/^version/{s/^version.*$/version = \"${new_version}\"/}" Cargo.toml
|
|||||||
cargo update --package git-repo-manager --precise "${new_version}"
|
cargo update --package git-repo-manager --precise "${new_version}"
|
||||||
|
|
||||||
diff="$(git diff --numstat)"
|
diff="$(git diff --numstat)"
|
||||||
if (( $(printf '%s\n' "${diff}" | wc -l) != 2 )) ; then
|
if (($(printf '%s\n' "${diff}" | wc -l || true) != 2)); then
|
||||||
printf '%s\n' 'Weird changes detected, bailing' >&2
|
printf '%s\n' 'Weird changes detected, bailing' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -116,9 +119,13 @@ git add Cargo.lock Cargo.toml
|
|||||||
|
|
||||||
git commit -m "Release v${new_version}"
|
git commit -m "Release v${new_version}"
|
||||||
|
|
||||||
git switch master 2>/dev/null || { [[ -d "../master" ]] && cd "../master" ; } || { printf '%s\n' 'Could not change to master' >&2 ; exit 1 ; }
|
git switch master 2>/dev/null || { [[ -d "../master" ]] && cd "../master"; } || {
|
||||||
|
printf '%s\n' 'Could not change to master' >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $(git rev-parse --abbrev-ref HEAD) != "master" ]] ; then
|
current_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
if [[ "${current_branch}" != "master" ]]; then
|
||||||
printf '%s\n' 'Looks like branch switching to master did not work' >&2
|
printf '%s\n' 'Looks like branch switching to master did not work' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -132,9 +139,13 @@ for remote in $(git remote) ; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
git switch develop 2>/dev/null || { [[ -d "../develop" ]] && cd "../develop" ; } || { printf '%s\n' 'Could not change to develop' >&2 ; exit 1 ; }
|
git switch develop 2>/dev/null || { [[ -d "../develop" ]] && cd "../develop"; } || {
|
||||||
|
printf '%s\n' 'Could not change to develop' >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $(git rev-parse --abbrev-ref HEAD) != "develop" ]] ; then
|
current_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
if [[ "${current_branch}" != "develop" ]]; then
|
||||||
printf '%s\n' 'Looks like branch switching to develop did not work' >&2
|
printf '%s\n' 'Looks like branch switching to develop did not work' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user