Skip to content

Commit 6533a7d

Browse files
feat: Add support for nightly versions (#4)
* feat: Add support for nightly versions * Update .github/workflows/build.yml Co-authored-by: Franciszek Job <[email protected]> * Remove TODO comments * Update README --------- Co-authored-by: Franciszek Job <[email protected]>
1 parent 85b2642 commit 6533a7d

File tree

4 files changed

+54
-14
lines changed

4 files changed

+54
-14
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,27 @@ on:
88

99
jobs:
1010
plugin_test:
11-
name: asdf plugin test
11+
name: Test ${{ matrix.os }}
1212
strategy:
1313
matrix:
1414
os:
1515
- ubuntu-latest
1616
- macos-latest
1717
runs-on: ${{ matrix.os }}
1818
steps:
19-
- name: asdf_plugin_test
20-
uses: asdf-vm/actions/plugin-test@v2
19+
- name: Test latest
20+
uses: asdf-vm/actions/plugin-test@v3
2121
with:
2222
command: snforge --version && sncast --version
23+
24+
- name: Test latest nightly
25+
uses: asdf-vm/actions/plugin-test@v3
26+
with:
27+
version: latest:nightly
28+
command: snforge --version | grep "nightly" && sncast --version | grep "nightly"
29+
30+
- name: Test nightly-2025-06-18
31+
uses: asdf-vm/actions/plugin-test@v3
32+
with:
33+
version: nightly-2025-06-18
34+
command: snforge --version | grep "snforge 0.45.0+nightly-2025-06-18" && sncast --version | grep "sncast 0.45.0+nightly-2025-06-18"

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ Install specific version:
4141
asdf install starknet-foundry 0.8.2
4242
```
4343

44+
Install latest nightly version:
45+
46+
```shell
47+
asdf install starknet-foundry latest:nightly
48+
```
49+
50+
Install specific nightly version:
51+
52+
```shell
53+
asdf install starknet-foundry nightly-2025-06-18
54+
```
55+
4456
Set a version globally (in your `~/.tool-versions` file):
4557

4658
```shell

bin/latest-stable

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ if [ -n "${GITHUB_API_TOKEN:-}" ]; then
1414
curl_opts=("${curl_opts[@]}" -H "Authorization: token $GITHUB_API_TOKEN")
1515
fi
1616

17-
# curl of REPO/releases/latest is expected to be a 302 to another URL
18-
# when no releases redirect_url="REPO/releases"
19-
# when there are releases redirect_url="REPO/releases/tag/v<VERSION>"
20-
redirect_url=$(curl "${curl_opts[@]}" "$GH_REPO/releases/latest" | sed -n -e "s|^location: *||p" | sed -n -e "s|\r||p")
21-
version=
22-
printf "redirect url: %s\n" "$redirect_url" >&2
23-
if [[ "$redirect_url" == "$GH_REPO/releases" ]]; then
24-
version="$(list_all_versions | sort_versions | tail -n1 | xargs echo)"
17+
if grep -q "nightly" <<<"$1"; then
18+
version="$(get_latest_nightly)"
2519
else
26-
version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||')"
20+
# curl of REPO/releases/latest is expected to be a 302 to another URL
21+
# when no releases redirect_url="REPO/releases"
22+
# when there are releases redirect_url="REPO/releases/tag/v<VERSION>"
23+
redirect_url=$(curl "${curl_opts[@]}" "$GH_REPO/releases/latest" | sed -n -e "s|^location: *||p" | sed -n -e "s|\r||p")
24+
version=
25+
printf "redirect url: %s\n" "$redirect_url" >&2
26+
if [[ "$redirect_url" == "$GH_REPO/releases" ]]; then
27+
version="$(list_all_versions | sort_versions | tail -n1 | xargs echo)"
28+
else
29+
version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||')"
30+
fi
2731
fi
2832

2933
printf "%s\n" "$version"

lib/utils.bash

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -euo pipefail
44

55
GH_REPO="https://github.com/foundry-rs/starknet-foundry"
6+
GH_NIGHTLIES_REPO="https://github.com/software-mansion-labs/starknet-foundry-nightlies"
67
TOOL_NAME="starknet-foundry"
78
TOOL_TEST="snforge --version && sncast --version"
89

@@ -37,6 +38,12 @@ download_universal_sierra_compiler() {
3738
curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh
3839
}
3940

41+
get_latest_nightly() {
42+
git ls-remote --tags --refs "$GH_NIGHTLIES_REPO" |
43+
grep -o 'refs/tags/.*' | cut -d/ -f3- |
44+
sort_versions | tail -n1 | xargs echo
45+
}
46+
4047
download_release() {
4148
local version filename url
4249
version="$1"
@@ -47,8 +54,13 @@ download_release() {
4754

4855
local repository tag
4956

50-
repository=$GH_REPO
51-
tag="v$version"
57+
if grep -q -E "nightly" <<<"$version"; then
58+
repository=$GH_NIGHTLIES_REPO
59+
tag=$version
60+
else
61+
repository=$GH_REPO
62+
tag="v$version"
63+
fi
5264

5365
local _tarball="starknet-foundry-${tag}-${_arch}.tar.gz"
5466
url="${repository}/releases/download/${tag}/${_tarball}"

0 commit comments

Comments
 (0)