Compare commits
6 Commits
07ca0cae5a
...
renovate/c
| Author | SHA1 | Date | |
|---|---|---|---|
| 6842a09195 | |||
| 7371bd2ea9 | |||
| a4679d62cf | |||
| e6e658e014 | |||
| 8260f0db4c | |||
| 85256bf559 |
46
.github/workflows/main.yaml
vendored
46
.github/workflows/main.yaml
vendored
@@ -6,35 +6,33 @@ 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: Get Cargo.lock hash
|
||||
id: hash
|
||||
run: |
|
||||
hash="$(sha256sum Cargo.lock | awk '{print $1}')"
|
||||
echo "hash=$hash" >>"$GITHUB_OUTPUT"
|
||||
- name: Setup rust
|
||||
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
|
||||
id: toolchain
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: x86_64-unknown-linux-musl
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: zpk-cargo-${{ steps.hash.outputs.hash }}
|
||||
key: cargo-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: |
|
||||
zpk-cargo-
|
||||
cargo-${{ steps.toolchain.outputs.cachekey }}-
|
||||
cargo-
|
||||
|
||||
- name: Run fmt
|
||||
run: cargo fmt --all --check
|
||||
@@ -45,13 +43,19 @@ jobs:
|
||||
- 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: Build binary
|
||||
run: cargo build
|
||||
run: cargo build --target x86_64-unknown-linux-musl
|
||||
|
||||
- name: Start test container
|
||||
- name: Start integration test container
|
||||
id: container
|
||||
run: |
|
||||
id="$(docker run --rm --privileged -d alpine:3.21 tail -f /dev/null)"
|
||||
@@ -60,17 +64,17 @@ jobs:
|
||||
- name: Copy scripts
|
||||
run: |
|
||||
docker cp ./scripts/integration.sh "$ID":/tmp/
|
||||
docker cp ./target/debug/zpk "$ID":/usr/bin/
|
||||
docker cp ./target/x86_64-unknown-linux-musl/debug/zpk "$ID":/usr/bin/
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
|
||||
- name: Run tests
|
||||
- name: Run integration tests
|
||||
run: docker exec -i -u 0 "$ID" /tmp/integration.sh
|
||||
env:
|
||||
ID: ${{ steps.container.outputs.id }}
|
||||
|
||||
- name: Stop test container
|
||||
- name: Stop integration test container
|
||||
if: always()
|
||||
run: docker stop "$ID"
|
||||
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
|
||||
}
|
||||
|
||||
74
Cargo.lock
generated
74
Cargo.lock
generated
@@ -174,13 +174,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "confy"
|
||||
version = "0.6.1"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45b1f4c00870f07dc34adcac82bb6a72cc5aabca8536ba1797e01df51d2ce9a0"
|
||||
checksum = "f29222b549d4e3ded127989d523da9e928918d0d0d7f7c1690b439d0d538bae9"
|
||||
dependencies = [
|
||||
"directories",
|
||||
"directories 6.0.0",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"thiserror 2.0.12",
|
||||
"toml",
|
||||
]
|
||||
|
||||
@@ -200,7 +200,16 @@ version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
"dirs-sys 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "directories"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
|
||||
dependencies = [
|
||||
"dirs-sys 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -211,10 +220,22 @@ checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"redox_users 0.4.6",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users 0.5.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.10.2"
|
||||
@@ -512,7 +533,18 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
"thiserror 1.0.64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -660,7 +692,16 @@ version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
"thiserror-impl 1.0.64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -674,6 +715,17 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.19"
|
||||
@@ -748,7 +800,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -943,8 +995,8 @@ dependencies = [
|
||||
"cmd_lib",
|
||||
"confy",
|
||||
"ctrlc",
|
||||
"directories",
|
||||
"dirs-sys",
|
||||
"directories 5.0.1",
|
||||
"dirs-sys 0.4.1",
|
||||
"eyre",
|
||||
"nix",
|
||||
"rand",
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
clap = { version = "4.5.4", features = ["derive", "string"] }
|
||||
cmd_lib = "1.9.3"
|
||||
confy = "0.6.1"
|
||||
confy = "1.0.0"
|
||||
ctrlc = "3.4.4"
|
||||
directories = "5.0.1"
|
||||
dirs-sys = "0.4.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