From f199dda897b32dc77d54c6b5a99ee3019d0c8d83 Mon Sep 17 00:00:00 2001 From: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> Date: Wed, 8 May 2024 12:48:27 +0200 Subject: [PATCH 1/6] Add build_examples.sh script --- build_examples.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 build_examples.sh diff --git a/build_examples.sh b/build_examples.sh new file mode 100755 index 0000000..1066fb6 --- /dev/null +++ b/build_examples.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +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 + done +} + +fetch_scrypto + +build_scrypto + +build_examples From 9c4d4f8d58e86f55c74c21357d39735a40ccfae7 Mon Sep 17 00:00:00 2001 From: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> Date: Wed, 8 May 2024 12:51:15 +0200 Subject: [PATCH 2/6] Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3721d5f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +radixdlt-scrypto From 64b91c8adfcb2084c2965c91ba113243ccf5aa78 Mon Sep 17 00:00:00 2001 From: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> Date: Wed, 8 May 2024 12:57:50 +0200 Subject: [PATCH 3/6] Add GH CI workflow --- .github/actions/setup-env/action.yml | 40 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 25 +++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/actions/setup-env/action.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml new file mode 100644 index 0000000..91534d7 --- /dev/null +++ b/.github/actions/setup-env/action.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..290d5ca --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +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: ubuntu-latest + steps: + - uses: RDXWorks-actions/checkout@main + - name: Setup environment + uses: ./.github/actions/setup-env + - name: Run tests + run: bash ./build_examples.sh From a5a3f405b14a018632c6e952e6bb9f34c4de0a0e Mon Sep 17 00:00:00 2001 From: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> Date: Wed, 8 May 2024 15:34:54 +0200 Subject: [PATCH 4/6] Interrupt on error --- build_examples.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_examples.sh b/build_examples.sh index 1066fb6..8a8d402 100755 --- a/build_examples.sh +++ b/build_examples.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + tag=bottlenose-9396c507 fetch_scrypto() { From 9b25fd727302d757fe73995f26dedef6232c3fc2 Mon Sep 17 00:00:00 2001 From: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> Date: Wed, 8 May 2024 15:36:19 +0200 Subject: [PATCH 5/6] Run GH workflow on Ubuntu, Mac and Window$ --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 290d5ca..be8c733 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,10 @@ concurrency: jobs: build-examples: name: Build examples - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: RDXWorks-actions/checkout@main - name: Setup environment From 6dff0352e6cf6257f77db4bf7258d7dcf1293f69 Mon Sep 17 00:00:00 2001 From: Azizi <64193693+azizi-a@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:29:17 +0100 Subject: [PATCH 6/6] Clean workspaces after CI build --- build_examples.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_examples.sh b/build_examples.sh index 8a8d402..abb783b 100755 --- a/build_examples.sh +++ b/build_examples.sh @@ -35,6 +35,7 @@ build_examples() { echo "Building $(dirname $path)" $scrypto build --path $path + cargo clean --manifest-path $path done }