Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 1f39ec2

Browse files
committed
ci: fix lint
1 parent 9f3ba5b commit 1f39ec2

File tree

7 files changed

+27
-61
lines changed

7 files changed

+27
-61
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
- macos-latest
1717
runs-on: ${{ matrix.os }}
1818
steps:
19-
- name: asdf_plugin_test
20-
uses: asdf-vm/actions/plugin-test@v4
21-
with:
22-
command: zig env
19+
- name: Install asdf & tools
20+
uses: asdf-vm/actions/install@v4
21+
- run:
22+
asdf plugin test --asdf-tool-version 0.14.1 zig https://github.com/jiacai2050/asdf-zig
23+
zig env

.github/workflows/lint.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22

3-
# asdf-zig [![Build](https://github.com/jiacai2050/asdf-zig/actions/workflows/build.yml/badge.svg)](https://github.com/jiacai2050/asdf-zig/actions/workflows/build.yml) [![Lint](https://github.com/jiacai2050/asdf-zig/actions/workflows/lint.yml/badge.svg)](https://github.com/jiacai2050/asdf-zig/actions/workflows/lint.yml)
3+
# asdf-zig [![Build](https://github.com/jiacai2050/asdf-zig/actions/workflows/build.yml/badge.svg)](https://github.com/jiacai2050/asdf-zig/actions/workflows/build.yml)
44

55
[asdf-zig](https://github.com/jiacai2050/asdf-zig) plugin for the [asdf version manager](https://asdf-vm.com).
66

@@ -15,10 +15,7 @@
1515

1616
# Dependencies
1717

18-
**TODO: adapt this section**
19-
20-
- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
21-
- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x.
18+
- `bash`, `python3`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
2219

2320
# Install
2421

@@ -38,7 +35,7 @@ asdf list-all zig
3835
asdf install zig latest
3936

4037
# Set a version globally (on your ~/.tool-versions file)
41-
asdf global zig latest
38+
asdf set --home zig latest
4239

4340
# Now asdf-zig commands are available
4441
zig version

bin/download

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ release_file="${ASDF_DOWNLOAD_PATH}/zig-${ASDF_INSTALL_VERSION}.tar.xz"
1111

1212
"${plugin_dir}/lib/utils.py" download "${ASDF_INSTALL_VERSION}" "${release_file}"
1313
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1
14+
rm "$release_file"

bin/install

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
set -euo pipefail
44

55
install_version() {
6-
local install_type="$1"
7-
local version="$2"
8-
local install_path="$3"
6+
local install_type="$1"
7+
local version="$2"
8+
local install_path="$3"
99

10-
if [ "$install_type" != "version" ]; then
11-
fail "asdf-zig supports release installs only"
12-
fi
10+
if [ "$install_type" != "version" ]; then
11+
fail "asdf-zig supports release installs only"
12+
fi
1313

14-
(
15-
mkdir -p "$install_path"
16-
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"
14+
(
15+
mkdir -p "$install_path"
16+
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"
1717
mkdir -p "$install_path/bin"
1818
mv "$install_path/zig" "$install_path/bin/zig"
1919

20-
local tool_cmd="zig"
21-
if ! test -x "$install_path/bin/$tool_cmd"; then
20+
local tool_cmd="zig"
21+
if ! test -x "$install_path/bin/$tool_cmd"; then
2222
echo "Expected $install_path/bin/zig to be executable."
2323
exit 1
2424
fi
2525

26-
echo "zig $version installation was successful!"
27-
) || (
28-
rm -rf "$install_path"
29-
fail "An error occurred while installing $TOOL_NAME $version."
30-
)
26+
echo "zig $version installation was successful!"
27+
) || (
28+
rm -rf "$install_path"
29+
fail "An error occurred while installing $TOOL_NAME $version."
30+
)
3131
}
3232

3333
install_version "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"

lib/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def fetch_index():
4040
raise Exception(f"Fetch index.json error: {response.getcode()}")
4141

4242

43-
def all_versions():
44-
index = fetch_index()
43+
def all_versions(index=fetch_index()):
4544
versions = [k for k in index.keys() if k != "master"]
4645
versions.sort(key=lambda v: tuple(map(int, v.split("."))))
4746
return versions
@@ -98,7 +97,7 @@ def download(version, out_file):
9897
arch = ARCH_MAPPING.get(arch, arch)
9998
link_key = f"{arch}-{os_name}"
10099
if link_key not in links:
101-
raise Exception(f"No tarball link for {link_key}")
100+
raise Exception(f"No tarball link for {link_key} in {version}")
102101

103102
tarball_url = links[link_key]["tarball"]
104103
tarball_shasum = links[link_key]["shasum"]

scripts/lint.bash

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)