Skip to content

Commit a1a0b13

Browse files
committed
Merge branch 'release'
2 parents 81e4bce + 8c24742 commit a1a0b13

File tree

12 files changed

+208
-40
lines changed

12 files changed

+208
-40
lines changed

Diff for: .github/workflows/release.yml

+9-13
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
strategy:
7878
matrix:
7979
build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc]
80+
feature: ["lean", "small"]
8081
include:
8182
- build: linux
8283
os: ubuntu-18.04
@@ -119,12 +120,6 @@ jobs:
119120
run: |
120121
ci/macos-install-packages
121122
122-
- name: Patch Cargo.toml (Windows)
123-
if: matrix.os == 'windows-2019'
124-
shell: bash
125-
run: |
126-
cat Cargo.toml.windows-suffix >> Cargo.toml
127-
128123
- name: Install Rust
129124
uses: actions-rs/toolchain@v1
130125
with:
@@ -166,11 +161,12 @@ jobs:
166161
echo "release version: $RELEASE_VERSION"
167162
168163
- name: Build release binary
169-
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }}
164+
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} --no-default-features --features ${{ matrix.feature }}
170165

171166
- name: Strip release binary (linux and macos)
172167
if: matrix.build == 'linux' || matrix.build == 'macos'
173-
run: strip "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}"
168+
shell: bash
169+
run: strip target/${{ matrix.target }}/release/${{ env.BIN_NAME }}{,p}
174170

175171
- name: Strip release binary (arm)
176172
if: matrix.build == 'linux-arm'
@@ -179,22 +175,22 @@ jobs:
179175
"$PWD/target:/target:Z" \
180176
rustembedded/cross:arm-unknown-linux-gnueabihf \
181177
arm-linux-gnueabihf-strip \
182-
/target/arm-unknown-linux-gnueabihf/release/${{ env.BIN_NAME }}
178+
/target/arm-unknown-linux-gnueabihf/release/${{ env.BIN_NAME }}{,p}
183179
184180
- name: Build archive
185181
shell: bash
186182
run: |
187-
staging="${{ env.BIN_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
183+
staging="${{ env.BIN_NAME }}-${{ matrix.feature }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
188184
mkdir -p "$staging"
189185
190-
cp {README.md,LICENSE,CHANGELOG.md} "$staging/"
186+
cp {README.md,LICENSE.md,CHANGELOG.md} "$staging/"
191187
192188
if [ "${{ matrix.os }}" = "windows-2019" ]; then
193-
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" "$staging/"
189+
cp target/${{ matrix.target }}/release/${{ env.BIN_NAME }}{,p}.exe "$staging/"
194190
7z a "$staging.zip" "$staging"
195191
echo "::set-env name=ASSET::$staging.zip"
196192
else
197-
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$staging/"
193+
cp target/${{ matrix.target }}/release/${{ env.BIN_NAME }}{,p} "$staging/"
198194
tar czf "$staging.tar.gz" "$staging"
199195
echo "::set-env name=ASSET::$staging.tar.gz"
200196
fi

Diff for: CHANGELOG.md

Whitespace-only changes.

Diff for: Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ test = false
2222
doctest = false
2323

2424
[features]
25-
default = ["fast", "pretty-cli"]
25+
default = ["max"]
26+
max = ["fast", "pretty-cli"]
27+
lean = ["fast", "lean-cli"]
28+
small = ["lean-cli"]
29+
2630
fast = ["git-features/parallel", "git-features/fast-sha1"]
2731
pretty-cli = ["structopt",
2832
"git-features/progress-prodash",

Diff for: Makefile

+13-13
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ interactive-developer-environment-in-docker: ## Use docker for all dependencies
1313

1414
##@ Release Builds
1515

16-
release-default: always ## the default build, big bug pretty (builds in ~2min 35s)
16+
release-default: always ## the default build, big but pretty (builds in ~2min 35s)
1717
cargo build --release
1818

1919
release-lean: always ## lean and fast (builds in ~1min 10s)
20-
cargo build --release --no-default-features --features lean-cli,fast
20+
cargo build --release --no-default-features --features lean
2121

2222
release-small: always ## minimal dependencies, at cost of performance (builds in ~46s)
23-
cargo build --release --no-default-features --features lean-cli
23+
cargo build --release --no-default-features --features small
2424

2525
##@ Development
2626

2727
target/release/gio: always
28-
cargo build --release --no-default-features --features lean-cli
28+
cargo build --release --no-default-features --features small
2929

3030
lint: ## Run lints with clippy
3131
cargo clippy
@@ -39,14 +39,14 @@ benchmark: target/release/gio ## see how fast things are, powered by hyperfine
3939

4040
##@ Testing
4141

42-
tests: check unit-tests journey-tests journey-tests-lean-cli ## run all tests, including journey tests
42+
tests: check unit-tests journey-tests journey-tests-small ## run all tests, including journey tests
4343

4444
check: ## Build all code in suitable configurations
4545
cargo check --all
4646
cargo check --all --all-features
47-
cargo check --no-default-features --features lean-cli
48-
cargo check --no-default-features --features pretty-cli
49-
cargo check --no-default-features --features lean-cli,fast
47+
cargo check --no-default-features --features small
48+
cargo check --no-default-features --features lean
49+
cargo check --no-default-features --features max
5050
cd gitoxide-core && cargo check --all-features
5151
cd git-object && cargo check --all-features
5252
cd git-odb && cargo check --all-features
@@ -60,13 +60,13 @@ unit-tests: ## run all unit tests
6060
continuous-unit-tests: ## run all unit tests whenever something changes
6161
watchexec -w src $(MAKE) unit-tests
6262

63-
journey-tests: always ## run stateless journey tests (pretty-cli)
63+
journey-tests: always ## run stateless journey tests (max)
6464
cargo build
65-
./tests/stateless-journey.sh target/debug/gio target/debug/giop pretty_and_fast
65+
./tests/stateless-journey.sh target/debug/gio target/debug/giop max
6666

67-
journey-tests-lean-cli: always ## run stateless journey tests (lean-cli)
68-
cargo build --no-default-features --features lean-cli
69-
./tests/stateless-journey.sh target/debug/gio target/debug/giop lean_and_small
67+
journey-tests-small: always ## run stateless journey tests (lean-cli)
68+
cargo build --no-default-features --features small
69+
./tests/stateless-journey.sh target/debug/gio target/debug/giop small
7070

7171
continuous-journey-tests: ## run stateless journey tests whenever something changes
7272
watchexec $(MAKE) journey-tests

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ The top-level command-line interface.
172172
* **lean-cli** _(mutually exclusive to pretty-cli)_
173173
* Use `argh` to produce a usable binary with decent documentation that is smallest in size, usually 300kb less than `pretty-cli`.
174174
* If `pretty-cli` is enabled as well, `small-cli` will take precedence, and you pay for building unnecessary dependencies.
175+
176+
There are convenience features, which combine common choices of the above into one name
177+
178+
* **max** = *pretty-cli* + *fast*
179+
* **lean** = *lean-cli* + *fast*
180+
* **small** = *lean-cli*
175181

176182
### git-features
177183

Diff for: ci/install.sh

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
help() {
6+
cat <<'EOF'
7+
Install a binary release of a Rust crate hosted on GitHub
8+
9+
Usage:
10+
install.sh [options]
11+
12+
Options:
13+
-h, --help Display this message
14+
--git SLUG Get the crate from "https://github/$SLUG"
15+
-f, --force Force overwriting an existing binary
16+
--crate NAME Name of the crate to install (default <repository name>)
17+
--tag TAG Tag (version) of the crate to install (default <latest release>)
18+
--target TARGET Install the release compiled for $TARGET (default <`rustc` host>)
19+
--to LOCATION Where to install the binary (default ~/.cargo/bin)
20+
EOF
21+
}
22+
23+
say() {
24+
echo "install.sh: $1"
25+
}
26+
27+
say_err() {
28+
say "$1" >&2
29+
}
30+
31+
err() {
32+
if [ ! -z $td ]; then
33+
rm -rf $td
34+
fi
35+
36+
say_err "ERROR $1"
37+
exit 1
38+
}
39+
40+
need() {
41+
if ! command -v $1 > /dev/null 2>&1; then
42+
err "need $1 (command not found)"
43+
fi
44+
}
45+
46+
force=false
47+
while test $# -gt 0; do
48+
case $1 in
49+
--crate)
50+
crate=$2
51+
shift
52+
;;
53+
--force | -f)
54+
force=true
55+
;;
56+
--git)
57+
git=$2
58+
shift
59+
;;
60+
--help | -h)
61+
help
62+
exit 0
63+
;;
64+
--tag)
65+
tag=$2
66+
shift
67+
;;
68+
--target)
69+
target=$2
70+
shift
71+
;;
72+
--to)
73+
dest=$2
74+
shift
75+
;;
76+
*)
77+
;;
78+
esac
79+
shift
80+
done
81+
82+
# Dependencies
83+
need basename
84+
need curl
85+
need install
86+
need mkdir
87+
need mktemp
88+
need tar
89+
90+
# Optional dependencies
91+
if [ -z $crate ] || [ -z $tag ] || [ -z $target ]; then
92+
need cut
93+
fi
94+
95+
if [ -z $tag ]; then
96+
need rev
97+
fi
98+
99+
if [ -z $target ]; then
100+
need grep
101+
need rustc
102+
fi
103+
104+
if [ -z $git ]; then
105+
err 'must specify a git repository using `--git`. Example: `install.sh --git japaric/cross`'
106+
fi
107+
108+
url="https://github.com/$git"
109+
say_err "GitHub repository: $url"
110+
111+
if [ -z $crate ]; then
112+
crate=$(echo $git | cut -d'/' -f2)
113+
fi
114+
115+
say_err "Crate: $crate"
116+
117+
url="$url/releases"
118+
119+
if [ -z $tag ]; then
120+
tag=$(curl -s "$url/latest" | cut -d'"' -f2 | rev | cut -d'/' -f1 | rev)
121+
say_err "Tag: latest ($tag)"
122+
else
123+
say_err "Tag: $tag"
124+
fi
125+
126+
if [ -z $target ]; then
127+
target=$(rustc -Vv | grep host | cut -d' ' -f2)
128+
fi
129+
130+
say_err "Target: $target"
131+
132+
if [ -z $dest ]; then
133+
dest="$HOME/.cargo/bin"
134+
fi
135+
136+
say_err "Installing to: $dest"
137+
138+
url="$url/download/$tag/$crate-$tag-$target.tar.gz"
139+
140+
say_err "Downloading: $url"
141+
td=$(mktemp -d || mktemp -d -t tmp)
142+
curl -sL $url | tar -C $td -xz
143+
144+
for f in $(cd $td && find . -type f); do
145+
test -x $td/$f || continue
146+
147+
if [ -e "$dest/$f" ] && [ $force = false ]; then
148+
err "$f already exists in $dest"
149+
else
150+
mkdir -p $dest
151+
install -v -m 755 $td/$f $dest
152+
fi
153+
done
154+
155+
rm -rf $td

Diff for: ci/macos-install-packages

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+

Diff for: ci/ubuntu-install-packages

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
sudo apt-get update
4+
sudo apt-get install -y --no-install-recommends \
5+
xz-utils liblz4-tool musl-tools

Diff for: src/plumbing/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod options {
1212
use structopt::{clap::AppSettings, StructOpt};
1313

1414
#[derive(Debug, StructOpt)]
15-
#[structopt(name = "gio-plumbing", about = "The pretty git underworld")]
15+
#[structopt(name = "gio-plumbing", about = "The git underworld")]
1616
#[structopt(settings = &[AppSettings::SubcommandRequired,
1717
AppSettings::ColoredHelp])]
1818
pub struct Args {

Diff for: src/porcelain/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod options {
66
use structopt::{clap::AppSettings, StructOpt};
77

88
#[derive(Debug, StructOpt)]
9-
#[structopt(about = "The pretty git")]
9+
#[structopt(about = "The git")]
1010
#[structopt(settings = &[AppSettings::SubcommandRequired,
1111
AppSettings::ColoredHelp])]
1212
pub struct Args {

0 commit comments

Comments
 (0)