-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCargo.toml
149 lines (133 loc) · 5.16 KB
/
Cargo.toml
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
142
143
144
145
146
147
148
149
[package]
name = "languagetool-code-comments"
version = "0.6.3"
edition = "2021"
license = "MIT"
[dependencies]
anyhow = "=1.0.63"
async-std = { version = "=1.12.0", features = ["tokio1"] }
clap = "=3.2.17"
clap_complete = "=3.2.3"
dirs = "=4.0.0"
fstrings = "=0.2.3"
futures = { version = "=0.3.23", features = ["std"] }
languagetool-rust = { version = "=1.2.0", default-features = false, features = ["cli"] }
lazy_static = "=1.4.0"
owo-colors = "3.5.0"
serde = { version = "=1.0.143", features = ["derive"] }
serde_json = "=1.0.83"
tokio = { version = "=1.20.1", features = ["macros"] }
tree-sitter = "=0.20.8"
url = "=2.2.2"
xxhash-rust = { version = "=0.8.5", features = ["xxh3"] }
# Enable vendored features to simplify cross compilation.
reqwest = { version = "=0.11.11", default-features = false, features = ["native-tls-vendored", "json"] }
[dev-dependencies]
axum = "=0.5.15"
expectest = "=0.12.0"
[build-dependencies]
cc = { version = "=1.0.73", features = ["parallel"] }
vergen = { version = "=7.4.0", features = ["git"] }
[package.metadata.bin]
cargo-about = { version = "0.5.7" }
cargo-binstall = { version = "1.4.4" }
cargo-cmd = { version = "0.3.1" }
cargo-deny = { version = "0.13.5" }
cargo-gha = { version = "0.4.6" }
cargo-llvm-cov = { version = "0.5.25" }
cargo-nextest = { version = "0.9.57", locked = true }
git-cliff = { version = "1.3.1" }
rust-script = { version = "0.21.0" }
[package.metadata.gha]
targets = ["aarch64-apple-darwin"]
[package.metadata.gha.assets]
cli_cli = { tag = "v2.38.0", owner_repo = "cli/cli", binaries = ["gh"], target_archives = { aarch64-apple-darwin = "gh_{NOVTAG}_macOS_arm64.zip" } }
goreleaser_goreleaser = { tag = "v1.21.2", owner_repo = "goreleaser/goreleaser", binaries = ["goreleaser"], target_archives = { aarch64-apple-darwin = "goreleaser_Darwin_arm64.tar.gz" } }
[package.metadata.commands]
build-completions = '''set -e
rm -rf completions
mkdir completions
./target/debug/languagetool-code-comments completion --shell zsh > completions/languagetool-code-comments.zsh
./target/debug/languagetool-code-comments completion --shell bash > completions/languagetool-code-comments.bash
./target/debug/languagetool-code-comments completion --shell fish > completions/languagetool-code-comments.fish
'''
lint = '''set -e
cargo cmd setup-nightly
cargo +ltcc-nightly fmt --check
cargo clippy
cargo check
cargo bin cargo-deny check licenses
'''
lint-fix = '''set -e
cargo cmd setup-nightly
cargo clippy --fix --allow-dirty --allow-staged
cargo fix --allow-dirty --allow-staged
# Run twice as for some reason not all formatting is applied on the first try.
cargo +ltcc-nightly fmt
cargo +ltcc-nightly fmt
'''
goreleaser = '''set -e
export LTCC_VERSION=$(cat Cargo.toml | grep version | head -n1 | awk -F '"' '{print $2}')
cargo cmd build-completions
AUR_KEY=$(cat ~/.ssh/aur) cargo gha goreleaser --rm-dist
cargo bin git-cliff --latest --strip header | cargo gha gh release edit "v$LTCC_VERSION" --notes-file -
tools/apt.sh "$LTCC_VERSION" "$(realpath dist)"
tools/choco.sh "$LTCC_VERSION" "$(realpath dist)"
tools/nur.sh "$LTCC_VERSION" "$(realpath dist)"
tools/yum.sh "$LTCC_VERSION" "$(realpath dist)"
'''
release = '''set -e
docker ps >/dev/null || (echo "Docker is not running" && exit 1)
cargo check
cargo bin cargo-deny check licenses
./tools/thirdparty/run.sh
gh workflow run release.yml --ref main
sleep 5
while true; do
res=$(cargo gha gh run list -R dustinblackman/languagetool-code-comments -w build --json conclusion,databaseId | jq -rc '.[0]')
echo "Status: $res"
if (echo "$res" | grep -q "success"); then
break
fi
sleep 30
done;
rm -rf dist-gh
mkdir dist-gh
export GH_RUN_ID=$(cargo gha gh run list -R dustinblackman/languagetool-code-comments -w build --json databaseId | jq -rc '.[0].databaseId')
cargo gha gh run download -D dist-gh $GH_RUN_ID
fd -t f . './dist-gh' | xargs -L1 chmod +x
export LTCC_VERSION=$(cat Cargo.toml | grep version | head -n1 | awk -F '"' '{print $2}')
cargo bin git-cliff -o CHANGELOG.md --tag "v$LTCC_VERSION"
git add .
git commit -m "v$LTCC_VERSION"
git tag -a "v$LTCC_VERSION" -m "v$LTCC_VERSION"
cargo build
cargo bin rust-script ./tools/update-readme.rs
git add .
git commit --amend -m "v$LTCC_VERSION"
git tag -d "v$LTCC_VERSION"
git tag -a "v$LTCC_VERSION" -m "v$LTCC_VERSION"
git push
git push --tags
cargo cmd goreleaser
'''
get-nightly-name = 'echo ltcc-nightly'
setup-nightly = '''
export LTCC_NIGHTLY=nightly-2022-08-11
rustup toolchain install "$LTCC_NIGHTLY" --component llvm-tools-preview rustfmt --force
rustup toolchain link $(cargo cmd get-nightly-name | tail -n1) "$(rustup toolchain list -v | grep $LTCC_NIGHTLY | grep '^nightly-' | awk '{print $2}')"
'''
test = 'cargo nextest run'
test-coverage = '''
cargo llvm-cov nextest --ignore-filename-regex='_test.rs'
'''
test-coverage-html = '''
cargo llvm-cov nextest --open --ignore-filename-regex='_test.rs'
'''
test-coverage-lcov = '''
rm -f lcov.info
cargo llvm-cov nextest --lcov --output-path lcov.info --ignore-filename-regex='_test.rs'
'''
test-coverage-ci = '''
cargo llvm-cov nextest --html --output-dir ./coverage --ignore-filename-regex='_test.rs'
'''