Skip to content
Merged
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
43 changes: 41 additions & 2 deletions .github/workflows/changelog-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,49 @@ jobs:

changed_files=$(git diff --name-only "$base_ref"..."$head_ref")

if echo "$changed_files" | grep -q "^CHANGELOG.md$"; then
if ! echo "$changed_files" | grep -q "^CHANGELOG.md$"; then
echo "CHANGELOG.md was not updated."
echo "If this change intentionally does not require a changelog, add the 'skip-changelog' label to the PR."
exit 1
fi

# The offchain crates each keep their own changelog as well, which is
# what their releases read. This list comes from the changelog-reminder
# that doublezero-offchain ran before the merge, with its paths moved
# under offchain/.
projects=(
"offchain/crates/contributor-rewards"
"offchain/crates/scheduled-command"
"offchain/crates/sentinel"
"offchain/crates/slack-notifier"
"offchain/crates/solana-admin-cli/passport"
"offchain/crates/solana-admin-cli/revenue-distribution"
"offchain/crates/solana-admin-cli/sol-conversion"
"offchain/crates/solana-cli"
"offchain/crates/solana-client-tools"
"offchain/crates/solana-fork"
"offchain/crates/solana-interface/sol-conversion"
"offchain/crates/validator-debt"
"offchain/scheduler"
)

missing=()
for subdir in "${projects[@]}"; do
if echo "$changed_files" | grep -q "^${subdir}/"; then
if ! echo "$changed_files" | grep -q "^${subdir}/CHANGELOG.md$"; then
missing+=("$subdir")
fi
fi
done

if [ ${#missing[@]} -eq 0 ]; then
exit 0
fi

echo "CHANGELOG.md was not updated."
echo "These subprojects changed but their own changelog was not updated:"
for m in "${missing[@]}"; do
echo " - $m (expected $m/CHANGELOG.md)"
done
echo
echo "If this change intentionally does not require a changelog, add the 'skip-changelog' label to the PR."
exit 1
44 changes: 44 additions & 0 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# The offchain scheduler is the only Elixir component. Its checks ran on a release
# tag alone before the merge; here they run on the pull request that changes it.
name: elixir

on:
push:
branches: [main, 'hotfix/**']
paths:
- 'offchain/scheduler/**'
- '.github/workflows/elixir.yml'
pull_request:
paths:
- 'offchain/scheduler/**'
- '.github/workflows/elixir.yml'
Comment thread
bgm-malbeclabs marked this conversation as resolved.

defaults:
run:
working-directory: offchain/scheduler

jobs:
elixir-scheduler:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Elixir and Erlang
uses: erlef/setup-beam@v1
with:
elixir-version: "1.19.3"
otp-version: "28.1"
# mix compile builds the Rust NIF, which is a root workspace member.
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2
- name: Cache deps
uses: actions/cache@v4
with:
path: offchain/scheduler/deps
key: mix-deps-${{ hashFiles('offchain/scheduler/mix.lock') }}
restore-keys: |
mix-deps-
- run: mix deps.get
- run: mix format --check-formatted
- run: mix compile --warnings-as-errors
- run: mix credo --strict
- run: mix test --cover
94 changes: 94 additions & 0 deletions .github/workflows/offchain.local-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Fork tests for the offchain Solana tooling: they start a mainnet-beta fork with
# doublezero-solana-fork and drive the CLIs against it.
#
# Every step runs from the repository root, not from offchain/, because the shell
# scripts resolve their binaries as target/debug/<name> and the merged workspace
# writes to the root target/ directory. The fork and the keypairs the scripts read
# also land in the working directory, so all of it has to agree.
name: offchain-local-validator

on:
push:
branches: [main, 'hotfix/**']
paths:
- 'offchain/**'
- 'solana/**'
- 'Cargo.lock'
- 'Cargo.toml'
- '.github/workflows/offchain.local-validator.yml'
pull_request:
paths:
- 'offchain/**'
- 'solana/**'
- 'Cargo.lock'
- 'Cargo.toml'
- '.github/workflows/offchain.local-validator.yml'
Comment thread
bgm-malbeclabs marked this conversation as resolved.

env:
SOLANA_CLI: v3.0.12

# Every cargo invocation names its package. The root workspace sets
# `default-members = []`, so a bare `cargo build --bin X` selects nothing and
# fails with "the workspace has no members". These commands came from a
# repository whose workspace had no such restriction.

jobs:
test-doublezero-solana-fork:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo docker builder prune -a --force
df -h
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2
- name: Solana toolchain
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/$SOLANA_CLI/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Generate ~/.config/solana/id.json
run: solana-keygen new --silent --no-bip39-passphrase
- name: Generate manager keypair for synthetic ValidatorClientRewards
run: solana-keygen new --silent --no-bip39-passphrase -o manager_keypair.json
- name: Start Solana mainnet-beta fork in background
run: |
MANAGER_PUBKEY=$(solana address -k manager_keypair.json)
cargo run -p doublezero-solana-fork-cli --bin doublezero-solana-fork -- -um --reset --synthetic-validator-client-rewards-manager "$MANAGER_PUBKEY" > /dev/null 2>&1 &
- name: Build `doublezero-solana`
run: cargo build -p doublezero-solana-cli --bin doublezero-solana
- name: Run `doublezero-solana` tests
run: bash offchain/sh/test_doublezero_solana_fork.sh

test-doublezero-solana-validator-debt-fork-current:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo docker builder prune -a --force
df -h
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2
- name: Solana toolchain
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/$SOLANA_CLI/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Generate ~/.config/solana/id.json
run: solana-keygen new --silent --no-bip39-passphrase
- name: Start Solana mainnet-beta fork in background
run: cargo run -p doublezero-solana-fork-cli --bin doublezero-solana-fork -- -um --reset --god-mode > /dev/null 2>&1 &
- name: Build the admin and validator-debt CLIs
run: |
cargo build \
-p doublezero-revenue-distribution-admin-cli --bin doublezero-revenue-distribution-admin \
-p doublezero-solana-validator-debt --bin doublezero-solana-validator-debt \
-p doublezero-solana-cli --bin doublezero-solana
- name: Run `doublezero-solana-validator-debt` tests
run: bash offchain/sh/test_validator_debt_fork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ jobs:
cache-targets: |
target
target/x86_64-unknown-linux-musl/release
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@1.97.1
with:
toolchain: 1.92.0
targets: x86_64-unknown-linux-musl
- name: Install dependencies for rpm packaging and musl static build
run: |
sudo apt update
sudo apt install squashfs-tools rpm musl-tools cmake -y
# goreleaser runs from the repository root, not from offchain/: the merged
# workspace writes to the root target/ directory, which is where the rust
# builder looks for the binary it packages.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
args: release -f release/.goreleaser.contributor-rewards.yaml --clean
args: release -f offchain/release/.goreleaser.contributor-rewards.yaml --clean
env:
SERVICEABILITY_PROGRAM_ID: devnet
SLACK_WEBHOOK: ${{ secrets.SLACK_BOTS_WEBHOOK }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: releaser.doublezero-solana
name: releaser.doublezero-solana-cli

on:
push:
Expand All @@ -20,21 +20,22 @@ jobs:
cache-targets: |
target
target/x86_64-unknown-linux-musl/release
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@1.97.1
with:
toolchain: 1.92.0
targets: x86_64-unknown-linux-musl
- name: Install dependencies for rpm packaging and musl static build
run: |
sudo apt update
sudo apt install squashfs-tools rpm musl-tools cmake -y
# goreleaser runs from the repository root, not from offchain/: the merged
# workspace writes to the root target/ directory, which is where the rust
# builder looks for the binary it packages.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
args: release -f release/.goreleaser.doublezero-solana-cli.yaml --clean
args: release -f offchain/release/.goreleaser.doublezero-solana-cli.yaml --clean
env:
SERVICEABILITY_PROGRAM_ID: devnet
SLACK_WEBHOOK: ${{ secrets.SLACK_BOTS_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ permissions:
jobs:
goreleaser:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64]
steps:
- name: Set platform
run: echo "Running on ${{ matrix.platform }}"
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -32,50 +27,50 @@ jobs:
elixir-version: "1.19.3"
otp-version: "28.1"

# The Rust NIF the release builds is a member of the root workspace, so it
# needs this repository's toolchain rather than whatever rustup defaults to.
- uses: dtolnay/rust-toolchain@1.97.1
- uses: Swatinem/rust-cache@v2

- name: Cache deps
id: cache-deps
uses: actions/cache@v3
env:
cache-name: cache-elixir-deps
uses: actions/cache@v4
with:
path: deps
key: mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
path: offchain/scheduler/deps
key: mix-deps-${{ hashFiles('offchain/scheduler/mix.lock') }}
restore-keys: |
mix-${{ env.cache-name }}-
mix-deps-

- name: Cache compiled build
id: cache-build
uses: actions/cache@v3
env:
cache-name: cache-compiled-build
uses: actions/cache@v4
with:
path: _build
key: mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
path: offchain/scheduler/_build
key: mix-build-${{ hashFiles('offchain/scheduler/mix.lock') }}
restore-keys: |
mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
mix-build-

- name: Install deps
working-directory: scheduler
working-directory: offchain/scheduler
run: mix deps.get

- name: Compile (warnings as errors)
working-directory: scheduler
working-directory: offchain/scheduler
run: mix compile --warnings-as-errors

- name: Credo
working-directory: scheduler
working-directory: offchain/scheduler
run: mix credo --strict

- name: Tests
working-directory: scheduler
working-directory: offchain/scheduler
run: mix test --cover

# goreleaser runs from the repository root and its `mix release` hooks name
# offchain/scheduler as their directory.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
args: release -f release/.goreleaser.doublezero-offchain-scheduler.yaml --clean --verbose
args: release -f offchain/release/.goreleaser.doublezero-offchain-scheduler.yaml --clean --verbose
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_BOTS_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: releaser.sentinel
name: releaser.offchain-sentinel

on:
push:
Expand All @@ -20,19 +20,21 @@ jobs:
cache-targets: |
target
target/x86_64-unknown-linux-musl/release
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@1.97.1
with:
toolchain: 1.92.0
targets: x86_64-unknown-linux-musl
- name: Install dependencies for rpm packaging and musl static build
run: |
sudo apt update
sudo apt install squashfs-tools rpm musl-tools cmake -y
# goreleaser runs from the repository root, not from offchain/: the merged
# workspace writes to the root target/ directory, which is where the rust
# builder looks for the binary it packages.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
args: release -f release/.goreleaser.sentinel.yaml --clean
args: release -f offchain/release/.goreleaser.sentinel.yaml --clean
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_BOTS_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ jobs:
cache-targets: |
target
target/x86_64-unknown-linux-musl/release
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@1.97.1
with:
toolchain: 1.92.0
targets: x86_64-unknown-linux-musl
- name: Install dependencies for rpm packaging and musl static build
run: |
sudo apt update
sudo apt install squashfs-tools rpm musl-tools cmake -y
# goreleaser runs from the repository root, not from offchain/: the merged
# workspace writes to the root target/ directory, which is where the rust
# builder looks for the binary it packages.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
args: release -f release/.goreleaser.doublezero-solana-validator-debt.yaml --clean
args: release -f offchain/release/.goreleaser.doublezero-solana-validator-debt.yaml --clean
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_BOTS_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading
Loading