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

Commit 8578f57

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

File tree

9 files changed

+36
-80
lines changed

9 files changed

+36
-80
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
- main
77
pull_request:
88

9+
env:
10+
ASDF_DOWNLOAD_PATH: /tmp/asdf-download
11+
ASDF_INSTALL_VERSION: 0.14.1
12+
ASDF_INSTALL_TYPE: version
13+
ASDF_INSTALL_PATH: /tmp/asdf-install
14+
915
jobs:
1016
plugin_test:
1117
name: asdf plugin test
@@ -16,7 +22,10 @@ jobs:
1622
- macos-latest
1723
runs-on: ${{ matrix.os }}
1824
steps:
19-
- name: asdf_plugin_test
20-
uses: asdf-vm/actions/plugin-test@v4
21-
with:
22-
command: zig env
25+
- uses: actions/checkout@v4
26+
- run: |
27+
bin/download
28+
- run: |
29+
bin/install
30+
- run: |
31+
${ASDF_INSTALL_PATH}/bin/zig env

.github/workflows/lint.yml

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

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 The asdf-vm core AUTHORS
3+
Copyright (c) 2025 Jiacai Liu <dev@liujiacai.net>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 12 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
@@ -47,12 +44,6 @@ zig version
4744
Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to
4845
install & manage versions.
4946

50-
# Contributing
51-
52-
Contributions of any kind welcome! See the [contributing guide](contributing.md).
53-
54-
[Thanks goes to these contributors](https://github.com/jiacai2050/asdf-zig/graphs/contributors)!
55-
5647
# License
5748

5849
See [LICENSE](LICENSE) © [jiacai2050](https://github.com/jiacai2050/)

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"

contributing.md

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

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)