Skip to content

Commit ce7a826

Browse files
authored
Gha workflows (#877)
* gha workflows * update install foundry script * remove scripts * install npm stuff * run selfhosted * remove cache on selfhosted wf, remove scripts from build binaries * trigger docker wf * prepare tags fixes * build docker on selfhosted * fix seed0 build * cacheable dockerfile * fix dockerfile * revert cacheable dockerfile * fix sha * binaries trigger * binaries trigger * extract version check * Remove duplicate trigger for build and test [skip ci] * delete fetching versions from bulid and test wf
1 parent fbcbc19 commit ce7a826

File tree

2 files changed

+59
-12
lines changed

2 files changed

+59
-12
lines changed

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Build and Test
22

33
on:
44
push:
5-
pull_request:
65
workflow_dispatch:
76

87
permissions:
@@ -16,8 +15,6 @@ jobs:
1615
build-and-test:
1716
name: Build and Test
1817
runs-on: self-hosted
19-
outputs:
20-
version: ${{ steps.get_version.outputs.version }}
2118
steps:
2219
- name: Checkout repository
2320
uses: actions/checkout@v4
@@ -26,12 +23,6 @@ jobs:
2623
id: config
2724
uses: ./.github/actions/load-config
2825

29-
- name: Get version
30-
id: get_version
31-
run: |
32-
VERSION=$(grep -E '^version = "[0-9]+\.[0-9]+\.[0-9]+"$' crates/starknet-devnet/Cargo.toml | head -n 1 | cut -d'"' -f2)
33-
echo "version=$VERSION" >> $GITHUB_OUTPUT
34-
3526
- name: Set up Rust stable
3627
uses: dtolnay/rust-toolchain@master
3728
with:

scripts/install_foundry.sh

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,71 @@ echo "Installing foundry $foundry_version"
1616
echo "Installing foundryup"
1717
curl -L https://foundry.paradigm.xyz | bash || echo "As expected, received a non-zero exit code"
1818

19+
# Source the profile to make foundryup available in current shell
20+
if [ -f "$HOME/.bashrc" ]; then
21+
source "$HOME/.bashrc"
22+
elif [ -f "$HOME/.bash_profile" ]; then
23+
source "$HOME/.bash_profile"
24+
elif [ -f "$HOME/.zshrc" ]; then
25+
source "$HOME/.zshrc"
26+
fi
27+
1928
# make command available in PATH
2029
export PATH="$PATH:$HOME/.foundry/bin"
21-
if [ -n "$CIRCLE_BRANCH" ]; then
30+
if [ -n "${CIRCLE_BRANCH:-}" ]; then
2231
# needed by further testing steps on CircleCI
2332
echo 'export PATH="$PATH:$HOME/.foundry/bin"' >>"$BASH_ENV"
33+
elif [ -n "${GITHUB_ACTIONS:-}" ]; then
34+
# needed by further testing steps on GitHub Actions
35+
echo 'PATH="$PATH:$HOME/.foundry/bin"' >> $GITHUB_ENV
2436
fi
2537

2638
echo "Installing foundry"
27-
foundryup --install "$foundry_version"
39+
# Try to use foundryup, but fall back to direct installation if not available
40+
if command -v foundryup &> /dev/null; then
41+
foundryup --install "$foundry_version"
42+
else
43+
echo "foundryup not found in PATH, attempting direct installation..."
44+
# Direct installation method
45+
FOUNDRY_DIR="$HOME/.foundry"
46+
BIN_DIR="$FOUNDRY_DIR/bin"
47+
mkdir -p "$BIN_DIR"
48+
49+
# Download and extract binaries directly from GitHub
50+
PLATFORM="linux_amd64"
51+
if [[ "$(uname)" == "Darwin" ]]; then
52+
PLATFORM="macos_amd64"
53+
fi
54+
55+
TEMP_DIR=$(mktemp -d)
56+
cd "$TEMP_DIR"
57+
58+
# Use the foundry version from above
59+
URL="https://github.com/foundry-rs/foundry/releases/download/$foundry_version/foundry_${foundry_version#nightly-}_$PLATFORM.tar.gz"
60+
echo "Downloading from $URL"
61+
curl -L "$URL" | tar -xz
62+
63+
# Move binaries to foundry bin dir
64+
mv anvil cast chisel forge "$BIN_DIR/"
65+
chmod +x "$BIN_DIR"/*
66+
67+
# Clean up
68+
cd -
69+
rm -rf "$TEMP_DIR"
70+
71+
# Update PATH to include foundry binaries
72+
export PATH="$PATH:$BIN_DIR"
73+
if [ -n "${GITHUB_ACTIONS:-}" ]; then
74+
echo "PATH=$PATH:$BIN_DIR" >> $GITHUB_ENV
75+
fi
76+
fi
2877

2978
# assert it works
30-
anvil --version
79+
echo "Verifying installation:"
80+
if command -v anvil &> /dev/null; then
81+
anvil --version
82+
else
83+
echo "ERROR: anvil not found in PATH after installation"
84+
echo "PATH=$PATH"
85+
exit 1
86+
fi

0 commit comments

Comments
 (0)