Skip to content

Commit

Permalink
Add CI directly to main
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-mysten committed Oct 23, 2024
1 parent 6ef2ac0 commit e62c2f4
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: mvr-cli Rust CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v4

- name: rust version
run: |
rustc --version
cargo --version
- uses: taiki-e/install-action@cargo-nextest

- name: Build mvr-cli (debug)
run: |
cd mvr-cli
cargo build
yecho "$(pwd)/target/debug" >> $GITHUB_PATH
- name: Run mvr-cli tests
run: |
cd mvr-cli
cargo nextest run
- name: Get Sui releases JSON file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-L -o releases.json \
https://api.github.com/repos/MystenLabs/sui/releases
- name: Get the latest Sui testnet binary and add it to PATH
shell: bash
run: |
os=${{runner.os}}
binary_os=""
if [ $os == "Linux" ]; then
binary_os="ubuntu"
fi
testnet_url=$(cat releases.json | jq --arg os $binary_os '.[] | .assets[] | select(.name | contains("testnet")) | select(.name | contains($os)) | select(.name | contains("x86"))'| jq -csr '.[0] | .browser_download_url')
filename="sui-$binary_os.tar.gz"
echo "Downloading testnet binary from $testnet_url"
wget -q $testnet_url -O $filename
tar -zxvf $filename ./sui
echo "$(pwd)" >> $GITHUB_PATH
- name: Run custom integration test
run: |
chmod +x ./ci/integration_test.sh
./ci/integration_test.sh
49 changes: 49 additions & 0 deletions ci/integration_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
set -e

command_exists() {
command -v "$1" >/dev/null 2>&1
}

if ! command_exists curl; then
echo "Error: curl is not installed. Please install curl and try again."
exit 1
fi

##########################################################
# Demo Package set up (depends on on-chain package data) #
##########################################################
mkdir -p demo-package/sources

cat << EOF > demo-package/sources/demo.move
module nftmaker::nftmaker {
use demo::demo;
public fun new(): u64 {
return demo::num()
}
}
EOF

cat << EOF > demo-package/Move.toml
[package]
name = "nftmaker"
edition = "2024.beta"
[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/mainnet" }
demo = { r.mvr = "@mvr-tst/first-app" }
[addresses]
nftmaker = "0x0"
[r.mvr]
network = "mainnet"
EOF

###########################################
# Invokes `mvr` when building the package #
###########################################
echo "Building package..."
cd demo-package
sui move build

0 comments on commit e62c2f4

Please sign in to comment.