Merge branch 'main' into dependabot/github_actions/asdf-vm/actions-3

This commit is contained in:
Zitao Xiong
2024-11-04 23:43:02 +08:00
committed by GitHub
6 changed files with 35 additions and 17 deletions

View File

@@ -10,14 +10,14 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- run: scripts/lint.bash
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check workflow files
uses: docker://rhysd/actionlint:1.6.23
with:

View File

@@ -13,6 +13,6 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v3
- uses: GoogleCloudPlatform/release-please-action@v4
with:
release-type: simple

View File

@@ -15,10 +15,7 @@
# Dependencies
**TODO: adapt this section**
- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x.
# Install

View File

@@ -10,14 +10,13 @@ source "${plugin_dir}/lib/utils.bash"
mkdir -p "$ASDF_DOWNLOAD_PATH"
# TODO: Adapt this to proper extension and adapt extracting strategy.
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
# Download tar.gz file to the download directory
download_release "$ASDF_INSTALL_VERSION" "$release_file"
# Extract contents of tar.gz file into the download directory
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
# Remove the tar.gz file since we don't need to keep it
rm "$release_file"

View File

@@ -5,8 +5,7 @@ Testing Locally:
```shell
asdf plugin test <plugin-name> <plugin-url> [--asdf-tool-version <version>] [--asdf-plugin-gitref <git-ref>] [test-command*]
# TODO: adapt this
asdf plugin test foundry-zksync https://github.com/caoer/asdf-foundry-zksync.git "forge --version"
asdf plugin test foundry-zksync https://github.com/placeholder-soft/foundry-zksync.git "forge --version"
```
Tests are automatically run in GitHub Actions on push and PR.

View File

@@ -2,8 +2,7 @@
set -euo pipefail
# TODO: Ensure this is the correct GitHub homepage where releases can be downloaded for foundry-zksync.
GH_REPO="https://github.com/placeholder-soft/foundry-zksync"
GH_REPO="https://github.com/matter-labs/foundry-zksync"
TOOL_NAME="foundry-zksync"
TOOL_TEST="forge --version"
@@ -31,8 +30,6 @@ list_github_tags() {
}
list_all_versions() {
# TODO: Adapt this. By default we simply list the tag names from GitHub releases.
# Change this function if foundry-zksync has other means of determining installable versions.
list_github_tags
}
@@ -40,9 +37,36 @@ download_release() {
local version filename url
version="$1"
filename="$2"
# Determine platform and architecture
local platform
local arch
case "$(uname -s)" in
"Darwin")
platform="darwin"
;;
"Linux")
platform="linux"
;;
*)
fail "Unsupported platform: $(uname -s)"
;;
esac
# TODO: Adapt the release URL convention for foundry-zksync
url="$GH_REPO/archive/v${version}.tar.gz"
case "$(uname -m)" in
"x86_64")
arch="amd64"
;;
"arm64"|"aarch64")
arch="arm64"
;;
*)
fail "Unsupported architecture: $(uname -m)"
;;
esac
# Construct download URL using platform and arch
local archive_name="foundry_nightly_${platform}_${arch}.tar.gz"
url="$GH_REPO/releases/download/$version/$archive_name"
echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
@@ -61,7 +85,6 @@ install_version() {
mkdir -p "$install_path"
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"
# TODO: Assert foundry-zksync executable exists.
local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."