fix #403
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: CI | |
on: | |
push: | |
branches-ignore: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:19.03.12 | |
options: --privileged | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Run tests | |
run: make test | |
env: | |
TARGETPLATFORM: linux/amd64 | |
data-provider-codegen-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.16 | |
- name: Run code generation script | |
run: | | |
python ./apps/scripts/update_shared_data_provider_code.py | |
- name: Check for changes | |
run: | | |
if [[ $(git status --porcelain) ]]; then | |
echo "Generated code is out of sync. Please run the script and commit the changes." | |
exit 1 | |
fi | |
test-evm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: './contracts/evm/package-lock.json' | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./contracts/evm | |
- name: Run hardhat tests | |
run: | | |
# Generate a random 32-byte (64 character) hex string prefixed with 0x | |
RANDOM_KEY=$(openssl rand -hex 32) | |
echo "Using generated private key: $RANDOM_KEY" | |
npx hardhat vars set PRIVATE_KEY $RANDOM_KEY | |
npx hardhat vars set ARBISCAN_API_KEY fake | |
npx hardhat vars set POLYGON_API_KEY fake | |
npx hardhat vars set ETHERSCAN_API_KEY fake | |
npx hardhat vars set CORE_TESTNET_API_KEY fake | |
npx hardhat vars set CORE_MAINNET_API_KEY fake | |
npx hardhat vars set ROOTSTOCK_TESTNET_API_KEY fake | |
npx hardhat vars set SCROLL_MAINNET_API_KEY fake | |
npx hardhat vars set SONEIUM_MAINNET_RPC_URL fake | |
npx hardhat vars set SONEIUM_MAINNET_BLOCKSCOUT_URL fake | |
npx hardhat --network hardhat test | |
working-directory: ./contracts/evm | |
test-solana: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: './contracts/solana/package-lock.json' | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./contracts/solana | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target/ | |
key: ${{ runner.os }}-cargo-solana-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-solana- | |
- name: Cache Solana CLI | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.local/share/solana/install | |
~/.config/solana/id.json | |
key: ${{ runner.os }}-solana | |
- name: Install Solana CLI | |
run: | | |
[ -f ~/.local/share/solana/install/active_release/bin/solana ] || sh -c "$(curl -sSfL https://release.solana.com/v1.18.18/install)" | |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
- name: Setup Solana | |
run: | | |
[ -f ~/.config/solana/id.json ] || solana-keygen new --no-bip39-passphrase -o ~/.config/solana/id.json | |
solana config set --url localhost | |
- name: Cache Anchor CLI | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/anchor | |
key: ${{ runner.os }}-anchor-0.30.1 | |
- name: Install Anchor CLI | |
run: | | |
if ! command -v anchor &> /dev/null; then | |
cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli | |
fi | |
- name: Run rust tests | |
run: | | |
cargo test | |
working-directory: ./contracts/solana/programs/stork | |
- name: Run anchor tests | |
run: | | |
anchor test | |
working-directory: ./contracts/solana/programs/stork | |
test-sui: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target/ | |
key: ${{ runner.os }}-cargo-sui-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-sui- | |
- name: Cache Sui CLI | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/sui | |
key: ${{ runner.os }}-sui-cli | |
- name: Install Sui | |
run: | | |
if ! command -v sui &> /dev/null; then | |
cargo install --locked --git https://github.com/MystenLabs/sui.git sui --features tracing | |
fi | |
sui --version | |
- name: Run Sui tests | |
run: | | |
sui move test | |
working-directory: ./contracts/sui/contracts |