Skip to content
Open
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
47 changes: 40 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ on:

jobs:
format-build-test:
runs-on: ubicloud
runs-on: ${{ vars.RUNNER }}
timeout-minutes: 15
env:
CARGO_DRIFT_FFI_PATH: /usr/lib
CARGO_DRIFT_FFI_PATH: /usr/lib
strategy:
fail-fast: false
matrix:
features:
- "default"
- "fireblocks"
steps:
- name: Check out
uses: actions/checkout@v4
Expand All @@ -42,7 +48,7 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.features }}
- name: install latest libdrift_ffi_sys
run: |
# NB: this will break historic CI jobs (if breaking program changes happen)
Expand All @@ -51,19 +57,46 @@ jobs:
echo "downloading libdrift: $SO_URL"
curl -L -o libdrift_ffi_sys.so "$SO_URL"
sudo cp libdrift_ffi_sys.so $CARGO_DRIFT_FFI_PATH
- name: Build
- name: Build {{ matrix.features }}
if: ${{ matrix.features == 'default' }}
run: |
cargo -V
cargo check
- name: Test
- name: Build ${{ matrix.features }}
if: ${{ matrix.features == 'fireblocks' }}
run: |
cargo check --features fireblocks
- name: Test ${{ matrix.features }}
if: ${{ matrix.features == 'default' }}
env:
DRIFT_GATEWAY_KEY: ${{ secrets.DRIFT_GATEWAY_KEY }}
DRIFT_GATEWAY_KEY: ${{ secrets.TEST_PRIVATE_KEY }}
TEST_DELEGATED_SIGNER: ${{ secrets.TEST_DELEGATED_SIGNER }}
TEST_RPC_ENDPOINT: ${{ secrets.DEVNET_RPC_ENDPOINT }}
TEST_MAINNET_RPC_ENDPOINT: ${{ secrets.MAINNET_RPC_ENDPOINT }}
# --test-threads, limit parallelism to prevent hitting RPC rate-limits
run: |
cargo -V
cp libdrift_ffi_sys.so ./target/debug/deps
cargo test --all --features mainnet -- --test-threads=2

- name: Test ${{ matrix.features }}
if: ${{ matrix.features == 'fireblocks' }}
env:
DRIFT_GATEWAY_KEY: ${{ secrets.TEST_PRIVATE_KEY }}
TEST_DELEGATED_SIGNER: ${{ secrets.TEST_DELEGATED_SIGNER }}
TEST_RPC_ENDPOINT: ${{ secrets.DEVNET_RPC_ENDPOINT }}
TEST_MAINNET_RPC_ENDPOINT: ${{ secrets.MAINNET_RPC_ENDPOINT }}
RUST_LOG: info,fireblocks_solana_signer=debug
RPC_URL: ${{ secrets.DEVNET_RPC_ENDPOINT }}
FIREBLOCKS_SECRET: ${{ secrets.FIREBLOCKS_SECRET }}
FIREBLOCKS_API_KEY: ${{ secrets.FIREBLOCKS_API_KEY }}
FIREBLOCKS_ENDPOINT: ${{ vars.FIREBLOCKS_ENDPOINT }}
FIREBLOCKS_POLL_TIMEOUT: ${{ vars.FIREBLOCKS_POLL_TIMEOUT }}
FIREBLOCKS_POLL_INTERVAL: ${{ vars.FIREBLOCKS_POLL_INTERVAL }}
FIREBLOCKS_DEVNET: "true"
FIREBLOCKS_VAULT: ${{ vars.FIREBLOCKS_VAULT }}
# --test-threads, limit parallelism to prevent hitting RPC rate-limits
run: |
cargo -V
cp libdrift_ffi_sys.so ./target/debug/deps
cargo test --all -- --test-threads=2
cargo test --all --features fireblocks -- --test-threads=2
29 changes: 22 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: Release

on:
workflow_dispatch:
push:
branches:
- "fireblocks"
tags:
- 'v*.*.*'
- "v*.*.*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubicloud
runs-on: ${{ vars.RUNNER }}
permissions:
contents: read
packages: write
Expand All @@ -22,7 +24,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build image
- name: Build image (Tag Release)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
CARGO_VERSION=$(grep -Po '(?<=version = ")\d+\.\d+\.\d+' Cargo.toml)
TAG_VERSION=${GITHUB_REF#refs/tags/v}
Expand All @@ -32,16 +35,28 @@ jobs:
exit 1
fi
echo "Version $CARGO_VERSION matches tag"

docker build -f Dockerfile .\
IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
docker build -f Dockerfile .\
-t "${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA::6}"\
-t "${REGISTRY}/${IMAGE_NAME}:${TAG_VERSION}"\
-t "${REGISTRY}/${IMAGE_NAME}:latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build image (Manual Dispatch)
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
run: |
echo "Building image from manual dispatch"
IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/[^a-zA-Z0-9._-]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')
docker build -f Dockerfile .\
-t "${REGISTRY}/${IMAGE_NAME}:${BRANCH_NAME}"\
-t "${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA::6}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish image
run: |
docker login ${REGISTRY} -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
docker image push --all-tags "${REGISTRY}/${IMAGE_NAME}"
env:
DOCKER_USERNAME: ${{ github.actor }}
Expand Down
Loading
Loading