fixing delegatecall example #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Checker Script CI | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
run-checker: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code from the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Cache cargo dependencies to avoid reinstalling every time | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
# Step 3: Cache rust toolchain and binaries (including cargo-stylus) | |
- name: Cache rust toolchain | |
uses: actions/cache@v3 | |
with: | |
path: ~/.rustup | |
key: ${{ runner.os }}-rustup-${{ hashFiles('**/rust-toolchain.toml') }} | |
restore-keys: | | |
${{ runner.os }}-rustup- | |
# Step 4: Ensure only rustup manages Rust | |
- name: Ensure only rustup manages Rust | |
run: | | |
sudo apt-get remove --purge cargo rustc || true | |
brew uninstall --force rust || true | |
sudo rm -rf /usr/local/bin/rustc /usr/local/bin/cargo || true | |
# Step 5: Install rustup if not present | |
- name: Install rustup | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
source $HOME/.cargo/env | |
# Step 6: Install Rust toolchain and wasm32 target per directory | |
- name: Install Rust toolchain and wasm32 target per directory | |
run: | | |
for dir in example_code/applications/* example_code/basic_examples/*; do | |
if [[ -d "$dir" && -f "$dir/rust-toolchain.toml" ]]; then | |
echo "Installing Rust toolchain for directory: $dir" | |
toolchain_version=$(grep '^channel' "$dir/rust-toolchain.toml" | cut -d '"' -f 2) | |
# Install the toolchain specified in rust-toolchain.toml | |
rustup toolchain install "$toolchain_version" | |
# Set toolchain for the directory | |
rustup override set "$toolchain_version" --path "$dir" | |
# Add wasm32 target for the specified toolchain | |
rustup target add wasm32-unknown-unknown --toolchain "$toolchain_version" | |
echo "Toolchain and wasm target set for $dir" | |
else | |
echo "No rust-toolchain.toml found for $dir, skipping." | |
fi | |
done | |
# Step 7: Cache cargo-stylus binary | |
- name: Cache cargo-stylus binary | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/cargo-stylus | |
key: ${{ runner.os }}-cargo-stylus-${{ hashFiles('**/Cargo.toml') }} | |
# Step 8: Install cargo-stylus if not cached | |
- name: Install cargo-stylus | |
run: | | |
if [ ! -f ~/.cargo/bin/cargo-stylus ]; then | |
cargo install cargo-stylus | |
else | |
echo "cargo-stylus is cached." | |
fi | |
# Step 9: Make checker.sh executable | |
- name: Make checker.sh executable | |
run: chmod +x ./checker.sh | |
# Step 10: Run the checker.sh script | |
- name: Run checker script | |
run: ./checker.sh | |
# Step 11: Check for the existence of /tmp/check_results.log and fail if missing | |
- name: Ensure /tmp/check_results.log exists | |
run: | | |
if [ ! -f /tmp/check_results.log ]; then | |
echo "/tmp/check_results.log not found! Failing the check." | |
exit 1 | |
fi | |
# Step 12: Check for issues in the log file located in /tmp/check_results.log | |
- name: Check for issues in the log | |
run: | | |
if grep -q "FAILED" /tmp/check_results.log; then | |
echo "Checker script failed! Fix the issues before merging." | |
exit 1 | |
else | |
echo "Checker script passed! Ready to merge." | |
fi |