Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH CI workflows #59

Merged
merged 6 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading