Skip to content

Commit

Permalink
Merge pull request #59 from radixdlt/update/switch_to_bottlenose
Browse files Browse the repository at this point in the history
  • Loading branch information
azizi-a committed Jun 14, 2024
2 parents 395b06e + 6dff035 commit 8497bcc
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Setup environment'
description: 'Common GH action to setup job environment'

runs:
using: "composite"
steps:
- name: Install Rust toolchain
uses: RDXWorks-actions/toolchain@master
with:
toolchain: 1.77.2
default: true
target: wasm32-unknown-unknown
components: rustfmt

- name: Install nextest
uses: RDXWorks-actions/install-action@nextest

- name: Set LIBCLANG_PATH # See https://github.com/rust-lang/rust-bindgen/issues/1797
if: runner.os == 'Windows'
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
shell: bash
- name: Install dependencies
if: runner.os == 'Windows'
run: choco install llvm -y
shell: bash
- name: Setup cmake
if: runner.os == 'Linux'
uses: RDXWorks-actions/actions-setup-cmake@master
with:
cmake-version: '3.27.9'
- name: Install libclang-dev
if: runner.os == 'Linux'
run: sudo apt-get -y update && sudo apt-get install clang libclang-dev -y -f
shell: bash
- name: Setup LLVM
if: runner.os == 'macOS'
# Switch to more recent LLVM/Clang 15.0.7
# see: https://github.com/actions/runner-images/blob/macOS-12/20240105.3/images/macos/macos-12-Readme.md
run: echo "$(brew --prefix llvm@15)/bin" >> $GITHUB_PATH
shell: bash
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build-examples:
name: Build examples
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: RDXWorks-actions/checkout@main
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Run tests
run: bash ./build_examples.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
radixdlt-scrypto
46 changes: 46 additions & 0 deletions build_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

set -e

tag=bottlenose-9396c507

fetch_scrypto() {
if [ ! -d radixdlt-scrypto ] ; then
mkdir radixdlt-scrypto
pushd radixdlt-scrypto
git init
git remote add origin https://github.com/radixdlt/radixdlt-scrypto.git
git fetch --depth 1 origin $tag
git checkout FETCH_HEAD
popd
fi
}

build_scrypto() {
cargo build --manifest-path radixdlt-scrypto/radix-clis/Cargo.toml
}

build_examples() {
scrypto="cargo run --manifest-path radixdlt-scrypto/radix-clis/Cargo.toml --bin scrypto $@ --"

# Get Cargo.toml for each example (those with [package] marker).
# Exclude:
# - radixdlt-scrypto
# - examples, which won't buiild by design
find . \( \
-path './radixdlt-scrypto' -o \
-path './step-by-step/18-candy-store-external-component/2-candy-store' \
\) -prune \
-o -name Cargo.toml -print | xargs grep -l '\[package]' | while read path ; do

echo "Building $(dirname $path)"
$scrypto build --path $path
cargo clean --manifest-path $path
done
}

fetch_scrypto

build_scrypto

build_examples

0 comments on commit 8497bcc

Please sign in to comment.