Skip to content

Commit

Permalink
Merge pull request #11 from penumbra-zone/10-fix-ci
Browse files Browse the repository at this point in the history
ci: add scheduled daily release build
  • Loading branch information
conorsch committed Jun 15, 2023
2 parents bcd1570 + 7ca1b7e commit 66b6e2f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 55 deletions.
95 changes: 44 additions & 51 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,65 @@
name: Rust CI
on: [push, pull_request]

on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
# Run periodically to check for breakage, since we seldom update the osiris repo.
# This allows us to determine approximately when a breaking change was merged into
# the penumbra repo, so we can fix it ahead of a testnet release.
schedule:
- cron: "25 18 * * *"
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check
runs-on: ubuntu-latest
build:
name: Build
runs-on: buildjet-16vcpu-ubuntu-2004
steps:
- name: Checkout osiris
uses: actions/checkout@v2
with:
path: osiris
uses: actions/checkout@v3

- name: Check out penumbra repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: penumbra-zone/penumbra
path: penumbra
path: penumbra-repo
lfs: true

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Move penumbra repo to relative path
run: mv penumbra-repo ../penumbra

- uses: Swatinem/rust-cache@v2
with:
workspaces: |
osiris
penumbra
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Configure rust cache
uses: Swatinem/rust-cache@v2

# We cannot use the GH action because it doesn't working directory:
# support custom working dirs.
# - uses: actions-rs/cargo@v1
- name: cargo check
run:
cargo check
working-directory: osiris
- name: Run cargo build release
run: cargo build --release
env:
# The `-D warnings` option causes an error on warnings;
# we must duplicate the rustflags from penumbra repo's `.cargo/config.toml`.
RUSTFLAGS: "-D warnings --cfg tokio_unstable"

fmt:
name: Rustfmt
runs-on: ubuntu-latest
runs-on: buildjet-8vcpu-ubuntu-2004
steps:
- name: Checkout osiris
uses: actions/checkout@v2
with:
path: osiris
uses: actions/checkout@v3

- name: Check out penumbra repo
uses: actions/checkout@v2
with:
repository: penumbra-zone/penumbra
path: penumbra
lfs: true
# N.B. `cargo fmt` does not require relpath dependencies to be present,
# so we don't need to clone the penumbra repo here.

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
workspaces: |
osiris
penumbra
- name: Configure rust cache
uses: Swatinem/rust-cache@v2

- name: cargo fmt
run:
cargo fmt --all -- --check
working-directory: osiris
- name: Run cargo fmt
run: cargo fmt --all -- --check
6 changes: 2 additions & 4 deletions src/trader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,6 @@ where
}
self.actions = actions;
}

Ok(())
}

async fn finalize_and_submit(&mut self, plan: &mut Planner<OsRng>) -> anyhow::Result<()> {
Expand Down Expand Up @@ -318,7 +316,7 @@ where
reserves_1: Amount,
reserves_2: Amount,
quote: BookTickerEvent,
mut plan: &mut Planner<OsRng>,
plan: &mut Planner<OsRng>,
) -> anyhow::Result<()> {
// put up half the available reserves
// TODO: this isn't quite right as it's half the _remaining_ reserves
Expand Down Expand Up @@ -378,7 +376,7 @@ where
);

tracing::trace!(?pos, "opening position");
plan = plan.position_open(pos);
_ = plan.position_open(pos);

Ok(())
}
Expand Down

0 comments on commit 66b6e2f

Please sign in to comment.