Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
13afb59
feat: add ci
arihantbansal Mar 16, 2025
2faa7b7
feat: add clippy, rustfmt, and caching
arihantbansal Mar 16, 2025
f2a6695
try fix
arihantbansal Mar 16, 2025
6aafec1
try fix
arihantbansal Mar 16, 2025
977f22e
i hope this works
arihantbansal Mar 16, 2025
0d08257
fix: secrets
arihantbansal Mar 17, 2025
d619220
add with clause
arihantbansal Mar 17, 2025
f34cf14
lets see
arihantbansal Mar 18, 2025
b40197a
pass inputs
arihantbansal Mar 18, 2025
dd7a064
fix fmt
arihantbansal Mar 18, 2025
2af068d
fix: add nightly rust
arihantbansal Mar 18, 2025
7ad2394
fix: add rustup update for clippy
arihantbansal Mar 18, 2025
a86c5f8
fix: passing secrets
arihantbansal Mar 19, 2025
edd31be
fix: try fixing nightly version to local
arihantbansal Mar 19, 2025
bb5118c
new changes
arihantbansal Mar 22, 2025
5f9ad9d
fix: solana -> anza
arihantbansal Mar 22, 2025
1039f39
fix: workflow run
arihantbansal Mar 22, 2025
534c3bf
debug
arihantbansal Mar 22, 2025
eb31cdf
revert debug
arihantbansal Mar 22, 2025
f73c3c3
fix: clippy toolchain
arihantbansal Mar 22, 2025
4761625
Merge branch 'main' into workflows
arihantbansal Mar 22, 2025
d3a8ad6
Merge branch 'main' into workflows
arihantbansal Mar 28, 2025
c9073b0
fix: lint warning
arihantbansal Mar 28, 2025
b7408c0
fix: remove clippy test because it needs arcium build
arihantbansal Mar 28, 2025
d376462
chore: add logs and cache
arihantbansal Mar 28, 2025
b5b1743
check docker is online
arihantbansal Mar 28, 2025
d0ef230
chore: debug
arihantbansal Mar 30, 2025
8475b6c
chore: debug manual docker compose
arihantbansal Mar 31, 2025
3ba84b1
switch struct fields order in acc
cryptopapi997 Mar 31, 2025
cae4c7c
chore
arihantbansal Apr 2, 2025
27d68c6
Merge branch 'workflows' of github.com:arcium-hq/examples into workflows
arihantbansal Apr 2, 2025
d6ab006
hotfix ci:
arihantbansal Apr 2, 2025
3840195
chore: remove callback server logging
arihantbansal Apr 2, 2025
7834125
fix callback value parsing
cryptopapi997 Apr 3, 2025
9e5281a
update to v0.1.41
arihantbansal Apr 3, 2025
3469c66
update to v0.1.41
arihantbansal Apr 3, 2025
1375b10
prettify
arihantbansal Apr 3, 2025
0401faf
fix
arihantbansal Apr 3, 2025
135cac7
fix: fmt
arihantbansal Apr 3, 2025
58fcffe
update ci to v0.1.41
arihantbansal Apr 3, 2025
bf1bf84
fix Anchor.toml
arihantbansal Apr 3, 2025
a938d32
increase timeout
arihantbansal Apr 3, 2025
4b4dc1b
increase timeout for tests
arihantbansal Apr 3, 2025
8357a27
update readme
arihantbansal Apr 3, 2025
37eba90
add more logs to ci
arihantbansal Apr 3, 2025
69f4fc7
try again
arihantbansal Apr 4, 2025
112a7b0
Merge branch 'main' into workflows
arihantbansal Apr 5, 2025
d96fbd0
fmt
cryptopapi997 Apr 7, 2025
647aa58
.
cryptopapi997 Apr 7, 2025
549aa92
Update test-examples.yaml
cryptopapi997 Apr 9, 2025
f007ced
Update test-examples.yaml
cryptopapi997 Apr 9, 2025
9ad9562
.
cryptopapi997 Apr 9, 2025
3ead7ca
.
cryptopapi997 Apr 9, 2025
710afc1
.
cryptopapi997 Apr 10, 2025
029667f
bump to 0.1.42
cryptopapi997 Apr 10, 2025
cb1b251
matrix-ify
cryptopapi997 Apr 10, 2025
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
19 changes: 19 additions & 0 deletions .github/actions/setup-anchor/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Setup Anchor"
description: "Setup Anchor"
runs:
using: "composite"
steps:
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v4
name: Cache Anchor Cli
id: cache-anchor-cli
with:
path: |
~/.cargo/bin/anchor
key: anchor-cli-${{ runner.os }}-v0003-${{ env.ANCHOR_VERSION }}-${{ env.ANCHOR_COMMIT_HASH }}
save-always: true
# if ANCHOR_VERSION is 0, then install the anchor-cli from source
- run: if [ $ANCHOR_VERSION -eq 0 ]; then cargo install --git https://github.com/coral-xyz/anchor --rev $ANCHOR_COMMIT_HASH anchor-cli --locked --force; else cargo install --git https://github.com/coral-xyz/anchor --tag "v$ANCHOR_VERSION" anchor-cli --locked; fi
shell: bash
if: steps.cache-anchor-cli.outputs.cache-hit != 'true'
56 changes: 56 additions & 0 deletions .github/actions/setup-arcium/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Setup Arcium"
description: "Setup Arcium CLI using arcup"

inputs:
ARCUP_USER:
description: "caddy username"
required: true
ARCUP_TOKEN:
description: "caddy token"
required: true

runs:
using: "composite"
steps:
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-anchor/

# Install system dependencies (for Linux)
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev
shell: bash

# Determine target architecture
- name: Set target architecture
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
if [ "$(uname -m)" == "aarch64" ]; then
echo "ARCUP_TARGET=aarch64_linux" >> $GITHUB_ENV
else
echo "ARCUP_TARGET=x86_64_linux" >> $GITHUB_ENV
fi
elif [ "$RUNNER_OS" == "macOS" ]; then
if [ "$(uname -m)" == "arm64" ]; then
echo "ARCUP_TARGET=aarch64_macos" >> $GITHUB_ENV
else
echo "ARCUP_TARGET=x86_64_macos" >> $GITHUB_ENV
fi
fi
shell: bash

# Install arcup
- name: Install arcup
run: |
curl -u "${{ inputs.ARCUP_USER }}:${{ inputs.ARCUP_TOKEN }}" "https://bin.arcium.com/download/arcup_${ARCUP_TARGET}_${{ env.ARCUP_VERSION }}" -o ~/.cargo/bin/arcup
chmod +x ~/.cargo/bin/arcup
shell: bash

# Install Arcium CLI
- name: Install Arcium CLI
run: |
arcup install
arcium --version
shell: bash
48 changes: 48 additions & 0 deletions .github/actions/setup-solana/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Setup Solana"
description: "Setup Solana"
runs:
using: "composite"
steps:
- uses: ./.github/actions/setup/
- uses: actions/cache@v4
name: Cache Solana Tool Suite
id: cache-solana
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_CLI_VERSION }}

- run: sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_CLI_VERSION }}/install)"
shell: bash
if: steps.cache-solana.outputs.cache-hit != 'true'

# Set PATH based on OS
- name: Set Solana PATH
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
echo 'export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.bashrc
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "/Users/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
echo 'export PATH="/Users/runner/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.bash_profile
fi
shell: bash

# Source the profile and verify solana is available
- name: Verify Solana installation
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
source ~/.bashrc
elif [ "$RUNNER_OS" == "macOS" ]; then
source ~/.bash_profile
fi
which solana
solana --version
shell: bash

- run: solana-keygen new -s --no-bip39-passphrase --force
shell: bash

- run: solana config set --url localhost
shell: bash
49 changes: 49 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Setup"
description: "Setup"
runs:
using: "composite"
steps:
- run: echo "RUST_VERSION=1.85.0" >> $GITHUB_ENV
shell: bash
- run: echo "ANCHOR_VERSION=0.31.0" >> $GITHUB_ENV
shell: bash
- run: echo "DEFAULT_ARCIUM_PROGRAMS_VERSION=0.1.42" >> $GITHUB_ENV
shell: bash
- run: echo "SOLANA_CLI_VERSION=2.1.6" >> $GITHUB_ENV
shell: bash
- run: echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
shell: bash
- run: echo "RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV
shell: bash
- run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV
shell: bash
- run: echo "ARCUP_VERSION=0.1.42" >> $GITHUB_ENV
shell: bash

# Setup Rust with specific version
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.85.0
override: true
components: clippy

- run: rustup update
shell: bash

# Cache cargo registry
- uses: actions/cache@v4
name: Cache Cargo Registry
with:
path: |
~/.cargo/registry/
~/.cargo/git/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Set git-fetch-with-cli for Cargo
run: |
echo '[net]' > ~/.cargo/config.toml
echo 'git-fetch-with-cli = true' >> ~/.cargo/config.toml
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/fmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Formatting Check
on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
fmt:
name: Formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup/

- uses: actions-rs/toolchain@v1
with:
override: true
components: rustfmt
toolchain: nightly
- run: rustup update

# Find all example directories and their Cargo.lock files
- name: Find example directories
id: find-examples
run: |
echo "examples=$(find . -type f -name "Anchor.toml" -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
echo "cargo_locks=$(find . -type f -name "Cargo.lock" | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT

# Check formatting on each example
- name: Check formatting
run: |
EXAMPLES=$(echo '${{ steps.find-examples.outputs.examples }}' | jq -r '.[]')
for example in $EXAMPLES; do
echo "Checking formatting in $example"
cd $example
cargo +nightly fmt --all --check
cd $GITHUB_WORKSPACE
done
111 changes: 111 additions & 0 deletions .github/workflows/test-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Test Examples
on:
push:
branches: [main]
pull_request:
branches: [main]

env:
ARCUP_USER: testnet_user_20842437
ARCUP_TOKEN: ${{ secrets.ARCUP_TOKEN }}

jobs:
find-examples:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.find-examples.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Find example directories
id: find-examples
run: |
echo "matrix=$(find . -type f -name "Anchor.toml" -exec dirname {} \; | jq -R -s -c '{example: split("\n")[:-1]}')" >> $GITHUB_OUTPUT

test-examples:
needs: find-examples
name: Test ${{ matrix.example }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix: ${{fromJson(needs.find-examples.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-solana/
- uses: ./.github/actions/setup-anchor/
- uses: ./.github/actions/setup-arcium/
with:
ARCUP_USER: testnet_user_20842437
ARCUP_TOKEN: ${{ secrets.ARCUP_TOKEN }}

- name: Load cached cargo registry
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
./*/target
./*/*/target
key: ${{ runner.os }}-cargo-${{ matrix.example }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.example }}-

- name: Test ${{ matrix.example }}
run: |
# Setup computation folders and vault
rm -rf /tmp/computation_folder_0
rm -rf /tmp/computation_folder_1
rm -rf /tmp/computation_folder_2
rm -rf /tmp/vault
mkdir /tmp/vault

if [[ "${{ matrix.example }}" = *"manticore"* ]]; then
echo "Manticore test"
cp -r ./examples/manticore/resources/computation_folder /tmp/computation_folder_0
rm -r /tmp/computation_folder_0/player-1

cp -r ./examples/manticore/resources/computation_folder /tmp/computation_folder_1
rm -r /tmp/computation_folder_1/player-0

cp -r ./examples/manticore/resources/computation_folder /tmp/computation_folder_2
rm -r /tmp/computation_folder_2/player-0
rm -r /tmp/computation_folder_2/player-1
else
echo "Cerberus test"
mkdir /tmp/computation_folder_0
mkdir /tmp/computation_folder_1
mkdir /tmp/computation_folder_2
fi

pushd ${{ matrix.example }}
yarn install
arcium build

# Run the test and capture logs
echo "Running arcium test..."
timeout 10m arcium test || EXIT_CODE=$?
echo "Most recent docker container id: $(docker ps -q -l)"
docker logs $(docker ps -q -l)
echo "=== Docker Containers ==="
docker ps -a
echo "=== Callback Server Logs ==="
cat artifacts/callback_server.log || true
echo "=== Docker Compose Logs ==="
docker compose -f artifacts/docker-compose-arx-env.yml logs || true
popd

pkill -f solana-test-validator

if [ -n "$EXIT_CODE" ]; then
exit $EXIT_CODE
fi

- name: Save cargo registry
uses: actions/cache/save@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
./*/target
./*/*/target
key: ${{ runner.os }}-cargo-${{ matrix.example }}-${{ hashFiles('**/Cargo.lock') }}
Loading
Loading