Compare commits
6 Commits
07ca0cae5a
...
renovate/c
| Author | SHA1 | Date | |
|---|---|---|---|
| fad31c2c3d | |||
| 7371bd2ea9 | |||
| a4679d62cf | |||
| e6e658e014 | |||
| 8260f0db4c | |||
| 85256bf559 |
112
.github/workflows/main.yaml
vendored
112
.github/workflows/main.yaml
vendored
@@ -6,71 +6,75 @@ on:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Lint code & run tests
|
||||
runs-on: ubuntu-22.04
|
||||
container: alpine:3.21
|
||||
name: Run lints & tests
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: apk add cargo coreutils docker git nodejs rust-clippy rustfmt tar zstd
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup rust
|
||||
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
|
||||
id: toolchain
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: x86_64-unknown-linux-musl
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Get Cargo.lock hash
|
||||
id: hash
|
||||
run: |
|
||||
hash="$(sha256sum Cargo.lock | awk '{print $1}')"
|
||||
echo "hash=$hash" >>"$GITHUB_OUTPUT"
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-${{ steps.toolchain.outputs.cachekey }}-
|
||||
cargo-
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: zpk-cargo-${{ steps.hash.outputs.hash }}
|
||||
restore-keys: |
|
||||
zpk-cargo-
|
||||
- name: Run fmt
|
||||
run: cargo fmt --all --check
|
||||
|
||||
- name: Run fmt
|
||||
run: cargo fmt --all --check
|
||||
- name: Run check
|
||||
run: cargo check
|
||||
|
||||
- name: Run check
|
||||
run: cargo check
|
||||
- name: Run clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
- name: Run clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
- name: Download apk
|
||||
run: |
|
||||
wget -O apk https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic//v2.14.10/x86_64/apk.static
|
||||
chmod +x apk
|
||||
echo "$(pwd)" >>"$GITHUB_PATH"
|
||||
|
||||
- name: Run unit tests
|
||||
run: cargo test
|
||||
- name: Run unit tests
|
||||
run: cargo test
|
||||
|
||||
- name: Build binary
|
||||
run: cargo build
|
||||
- name: Build binary
|
||||
run: cargo build --target x86_64-unknown-linux-musl
|
||||
|
||||
- name: Start test container
|
||||
id: container
|
||||
run: |
|
||||
id="$(docker run --rm --privileged -d alpine:3.21 tail -f /dev/null)"
|
||||
echo "id=$id" >>"$GITHUB_OUTPUT"
|
||||
- name: Start integration test container
|
||||
id: container
|
||||
run: |
|
||||
id="$(docker run --rm --privileged -d alpine:3.21 tail -f /dev/null)"
|
||||
echo "id=$id" >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Copy scripts
|
||||
run: |
|
||||
docker cp ./scripts/integration.sh "$ID":/tmp/
|
||||
docker cp ./target/debug/zpk "$ID":/usr/bin/
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
- name: Copy scripts
|
||||
run: |
|
||||
docker cp ./scripts/integration.sh "$ID":/tmp/
|
||||
docker cp ./target/x86_64-unknown-linux-musl/debug/zpk "$ID":/usr/bin/
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
|
||||
- name: Run tests
|
||||
run: docker exec -i -u 0 "$ID" /tmp/integration.sh
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
- name: Run integration tests
|
||||
run: docker exec -i -u 0 "$ID" /tmp/integration.sh
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
|
||||
- name: Stop test container
|
||||
if: always()
|
||||
run: docker stop "$ID"
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
- name: Stop integration test container
|
||||
if: always()
|
||||
run: docker stop -t0 "$ID"
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
"group:allNonMajor",
|
||||
"schedule:monthly",
|
||||
],
|
||||
"enabledManagers": ["cargo"],
|
||||
"enabledManagers": ["cargo", "github-actions"],
|
||||
"osvVulnerabilityAlerts": true
|
||||
}
|
||||
|
||||
131
Cargo.lock
generated
131
Cargo.lock
generated
@@ -132,23 +132,22 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
||||
|
||||
[[package]]
|
||||
name = "cmd_lib"
|
||||
version = "1.9.5"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "371c15a3c178d0117091bd84414545309ca979555b1aad573ef591ad58818d41"
|
||||
checksum = "1e1ac603509ec7e9696f35e836365c53f305040b1080dabcde26e00e58b264a7"
|
||||
dependencies = [
|
||||
"cmd_lib_macros",
|
||||
"env_logger",
|
||||
"faccess",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"os_pipe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmd_lib_macros"
|
||||
version = "1.9.5"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb844bd05be34d91eb67101329aeba9d3337094c04fd8507d821db7ebb488eaf"
|
||||
checksum = "2f213802401c6631f4ff5b3bfc40f07f01a431c53d736ab42a6d0d65be3e0266"
|
||||
dependencies = [
|
||||
"proc-macro-error2",
|
||||
"proc-macro2",
|
||||
@@ -216,16 +215,26 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.10.2"
|
||||
name = "env_filter"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
|
||||
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
|
||||
dependencies = [
|
||||
"humantime",
|
||||
"is-terminal",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.11.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"env_filter",
|
||||
"jiff",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -294,18 +303,6 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "indenter"
|
||||
version = "0.3.3"
|
||||
@@ -322,17 +319,6 @@ dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.1"
|
||||
@@ -345,6 +331,30 @@ version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "jiff"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
|
||||
dependencies = [
|
||||
"jiff-static",
|
||||
"log",
|
||||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jiff-static"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
@@ -375,9 +385,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
version = "0.4.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
@@ -411,9 +421,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "os_pipe"
|
||||
version = "1.2.1"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982"
|
||||
checksum = "db335f4760b14ead6290116f2427bf33a14d4f0617d49f78a246de10c1831224"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
@@ -425,6 +435,21 @@ version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic-util"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
|
||||
dependencies = [
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.20"
|
||||
@@ -458,18 +483,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.92"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -623,9 +648,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.90"
|
||||
version = "2.0.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -645,15 +670,6 @@ dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.64"
|
||||
@@ -742,15 +758,6 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.4", features = ["derive", "string"] }
|
||||
cmd_lib = "1.9.3"
|
||||
cmd_lib = "2.0.0"
|
||||
confy = "0.6.1"
|
||||
ctrlc = "3.4.4"
|
||||
directories = "5.0.1"
|
||||
|
||||
@@ -18,7 +18,7 @@ fn get_repo_dir_from(path: &Path) -> eyre::Result<String> {
|
||||
.lines()
|
||||
.filter(|line| line.starts_with("REPODEST="))
|
||||
.map(|line| line.trim_start_matches("REPODEST="))
|
||||
.last();
|
||||
.next_back();
|
||||
let home_dir = dirs_sys::home_dir().unwrap();
|
||||
let repo_dir = PathBuf::from(if let Some(repodest) = repodest {
|
||||
// This should probably be done with proper shell interpolation.
|
||||
|
||||
Reference in New Issue
Block a user