Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: wip program upgrade CI #141

Merged
merged 71 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
903526d
feat: wip program upgrade CI
losman0s Nov 30, 2023
d40625e
feat: upgrade anchor, solana, geyser
losman0s Dec 1, 2023
1ebc7e5
chore: fmt
losman0s Dec 1, 2023
05971fa
ci: bump CI anchor version
losman0s Dec 1, 2023
ae92066
ci: bump CI cargo version
losman0s Dec 1, 2023
c2f1103
fix: account for dedicated CLI multisig config field
losman0s Dec 1, 2023
3d51c56
lint: clippy
losman0s Dec 1, 2023
804d018
lint: clippy
losman0s Dec 1, 2023
168f2c5
ci: wip actions
losman0s Dec 1, 2023
b5f4555
ci: wip actions
losman0s Dec 1, 2023
905c371
ci: wip actions
losman0s Dec 1, 2023
4ea4f59
ci: wip actions
losman0s Dec 1, 2023
3f2f119
ci: wip actions
losman0s Dec 1, 2023
71df9f4
ci: wip actions
losman0s Dec 1, 2023
24ba197
ci: wip actions
losman0s Dec 1, 2023
bcc10c9
ci: wip actions
losman0s Dec 1, 2023
f0256a1
ci: wip actions
losman0s Dec 1, 2023
9f364ad
ci: wip actions
losman0s Dec 1, 2023
a128d40
ci: wip actions
losman0s Dec 1, 2023
080937a
ci: wip actions
losman0s Dec 1, 2023
c5c3866
ci: wip actions
losman0s Dec 1, 2023
1602b37
ci: wip actions
losman0s Dec 1, 2023
65b60a9
ci: wip actions
losman0s Dec 1, 2023
3a317cc
ci: wip actions
losman0s Dec 1, 2023
93acfb3
ci: wip actions
losman0s Dec 1, 2023
d18dbd8
ci: wip actions
losman0s Dec 1, 2023
babdd07
ci: wip actions
losman0s Dec 1, 2023
aa0bdc9
ci: wip actions
losman0s Dec 1, 2023
d30f235
ci: wip actions
losman0s Dec 1, 2023
48daed9
ci: wip actions
losman0s Dec 1, 2023
b77fcb9
ci: wip actions
losman0s Dec 1, 2023
3b5573c
ci: wip actions
losman0s Dec 4, 2023
92b29ab
ci: wip actions
losman0s Dec 4, 2023
915a75e
ci: wip actions
losman0s Dec 4, 2023
80ea906
ci: wip actions
losman0s Dec 4, 2023
a6cef41
ci: wip actions
losman0s Dec 4, 2023
e94cbea
ci: wip actions
losman0s Dec 4, 2023
6387c1c
ci: wip actions
losman0s Dec 4, 2023
38882ad
ci: wip actions
losman0s Dec 4, 2023
d87fa67
ci: wip actions
losman0s Dec 4, 2023
41a0101
ci: wip actions
losman0s Dec 4, 2023
aac3810
ci: wip actions
losman0s Dec 4, 2023
f066d3c
cli: add idl patch command
losman0s Dec 4, 2023
56ed81c
ci: wip actions
losman0s Dec 4, 2023
aac3788
chore: fmt
losman0s Dec 4, 2023
e877a23
chore: fmt
losman0s Dec 4, 2023
45813bd
ci: wip actions
losman0s Dec 5, 2023
fad8f92
ci: wip actions
losman0s Dec 11, 2023
98740ee
ci: wip actions
losman0s Dec 11, 2023
c151c97
fix: IDL patching
losman0s Dec 19, 2023
3671c6c
fix: rebase shenanigans
losman0s Dec 19, 2023
89632d0
ci: switch to nightly
losman0s Dec 19, 2023
b85c3d5
ci: switch to nightly
losman0s Dec 19, 2023
75bb106
ci: switch to nightly
losman0s Dec 19, 2023
c19286b
ci: switch to nightly
losman0s Dec 19, 2023
e5cc500
ci: ignore brick in workspace
losman0s Dec 19, 2023
5e7b278
ci: fuzzing
losman0s Dec 19, 2023
d5ba204
ci: fuzzing
losman0s Dec 19, 2023
e191026
ci: fuzzing
losman0s Dec 19, 2023
d54b3dd
chore: format
losman0s Dec 19, 2023
abb34c7
ci: fuzzing
losman0s Dec 19, 2023
9457933
ci: fuzzing args
losman0s Dec 20, 2023
647f641
ci: wip actions
losman0s Dec 20, 2023
b19f06f
ci: wip actions
losman0s Dec 20, 2023
2c812e4
chore: lint
losman0s Dec 20, 2023
6b9c670
ci: wip actions
losman0s Dec 20, 2023
b2549ba
ci: wip actions
losman0s Dec 20, 2023
bcf579c
ci: wip actions
losman0s Dec 23, 2023
e3a6ecb
fix: ping madness
losman0s Jan 4, 2024
ad2d00e
fix: lint
losman0s Jan 4, 2024
bef1162
fix: lint
losman0s Jan 4, 2024
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
31 changes: 31 additions & 0 deletions .github/actions/build-program/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Anchor Build"
description: "Anchor Build"
inputs:
program_lib_name:
description: "The program to build"
required: true
runs:
using: "composite"
steps:
- uses: actions/cache@v2
name: Cache Cargo registry + index
id: cache-cargo-registry
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Anchor Build
uses: actions/cache@v2
id: cache-anchor-build
with:
path: |
./target/
key: build-${{ runner.os }}-${{env.ANCHOR_CLI_VERSION}}-${{env.ANCHOR_SHA}}-v0002-${{ hashFiles('./programs/**/**', '**/Cargo.lock') }}-${{ inputs.program_lib_name }}

- run: ./scripts/build-program.sh ${{ inputs.program_lib_name }} mainnet
if: steps.cache-anchor-build.outputs.cache-hit != 'true'
shell: bash
42 changes: 42 additions & 0 deletions .github/actions/build-verifiable-program/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Build Verified"
description: "Builds an Anchor Program using solana-verify"

inputs:
program_lib_name:
description: "The program to build"
required: true
devnet:
description: "Whether to target devnet (fallback is mainnet)"
required: false
default: "false"

runs:
using: "composite"
steps:
- uses: actions/cache@v2
name: Cache Cargo registry + index
id: cache-cargo-registry
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ runner.os }}-v0001-${{ hashFiles('**/Cargo.lock') }}

- uses: actions/cache@v2
name: Cache Solana Verify
id: cache-solana-verify
with:
path: |
~/.cargo/bin/solana-verify
key: cargo-${{ runner.os }}-solana-verify

- run: cargo install solana-verify --git https://github.com/Ellipsis-Labs/solana-verifiable-build --rev 8f6f56908a0b0f35cb84d06f167c25c286ccf0ac
if: steps.cache-solana-verify.outputs.cache-hit != 'true'
shell: bash

- run: ./scripts/build-program-verifiable.sh ${{ inputs.program_lib_name }} ${{ inputs.devnet == 'true' && 'devnet' || 'mainnet' }}
shell: bash
env:
PROGRAM: ${{ inputs.program_lib_name }}

27 changes: 27 additions & 0 deletions .github/actions/build-workspace/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Build Anchor Workspace"
description: "Build Anchor Workspace"
runs:
using: "composite"
steps:
- uses: actions/cache@v2
name: Cache Cargo registry + index
id: cache-cargo-registry
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Anchor Build
uses: actions/cache@v2
id: cache-anchor-build
with:
path: |
./target/
key: build-${{ runner.os }}-${{env.ANCHOR_CLI_VERSION}}-${{env.ANCHOR_SHA}}-v0002-${{ hashFiles('./programs/**/**', '**/Cargo.lock') }}-workspace

- run: ./scripts/build-workspace.sh
if: steps.cache-anchor-build.outputs.cache-hit != 'true'
shell: bash
140 changes: 140 additions & 0 deletions .github/actions/deploy-buffers/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: "Uploads Program and IDL buffers"
description: "Uploads program binary and IDL to buffer accounts"

inputs:
program-lib-name:
description: "The program to build and upload"
required: true
program-id:
description: "The program ID to build and upload"
required: true
deployer-keypair:
description: "The keypair to use for deploys"
required: true
buffer-authority:
description: "The buffer authority to set"
required: true
rpc-endpoint:
description: "The RPC endpoint used for buffer uploads"
required: true

outputs:
program-buffer-pubkey:
description: "The program buffer address"
value: ${{ steps.deploy-buffers-store.outputs.PROGRAM_BUFFER_PUBKEY }}
idl-buffer-pubkey:
description: "The idl buffer address."
value: ${{ steps.deploy-buffers-store.outputs.IDL_BUFFER_PUBKEY }}

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

- name: Dump deployer keypair to file for CLI use
run: echo "$DEPLOYER_KEYPAIR" > ./deployer-keypair.json && chmod 600 ./deployer-keypair.json
shell: bash
env:
DEPLOYER_KEYPAIR: ${{ inputs.deployer-keypair }}

- name: Generate keypair for program buffer
run: solana-keygen new --silent --outfile program-buffer-keypair --no-bip39-passphrase
shell: bash

- run: ls -l ./target/deploy/
shell: bash

- name: Deploy program buffer
if: steps.cache-buffer.outputs.cache-hit != 'true'
id: program-buffer-deploy
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4
with:
timeout_minutes: 30
max_attempts: 10
shell: bash
command: |
solana program write-buffer \
--buffer ./program-buffer-keypair \
--keypair ./deployer-keypair.json \
--url $RPC_ENDPOINT \
./target/deploy/$PROGRAM_LIB_NAME.so \
> ./program-buffer.out
env:
RPC_ENDPOINT: ${{ inputs.rpc-endpoint }}
PROGRAM_LIB_NAME: ${{ inputs.program-lib-name }}

- name: IDL Buffer Deploy
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4
id: idl-buffer-deploy
if: steps.cache-buffer.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
max_attempts: 50
shell: bash
command: |
~/.cargo/bin/anchor idl write-buffer $PROGRAM_ID \
--filepath ./target/idl/$PROGRAM_LIB_NAME.json \
--provider.cluster $RPC_ENDPOINT \
--provider.wallet ./deployer-keypair.json \
> idl-buffer.out
env:
PROGRAM_ID: ${{ inputs.program-id }}
PROGRAM_LIB_NAME: ${{ inputs.program-lib-name }}
RPC_ENDPOINT: ${{ inputs.rpc-endpoint }}

- name: Buffer Deploy Store
shell: bash
id: deploy-buffers-store
run: |
echo "PROGRAM_BUFFER_PUBKEY=$(cat program-buffer.out | sed 's/Buffer: //g' | xargs echo -n)" >> $GITHUB_OUTPUT
echo "IDL_BUFFER_PUBKEY=$(cat idl-buffer.out | sed 's/Idl buffer created: //g' | xargs echo -n)" >> $GITHUB_OUTPUT

- run: echo "The program buffer is ${{ steps.deploy-buffers-store.outputs.PROGRAM_BUFFER_PUBKEY }}"
shell: bash
- run: echo "the IDL buffer is ${{ steps.deploy-buffers-store.outputs.IDL_BUFFER_PUBKEY }}"
shell: bash
- run: echo "the IDL is $(cat ./target/idl/$PROGRAM_LIB_NAME.json)"
shell: bash
env:
PROGRAM_LIB_NAME: ${{ inputs.program-lib-name }}

- name: Transfer IDL buffer to specified authority
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4
if: steps.cache-buffer.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
max_attempts: 50
shell: bash
command: |
anchor idl set-authority $IDL_BUFFER_PUBKEY \
--provider.cluster $RPC_ENDPOINT \
--program-id $PROGRAM_ID \
--new-authority $AUTHORITY \
--provider.wallet ./deployer-keypair.json
env:
IDL_BUFFER_PUBKEY: ${{ steps.deploy-buffers-store.outputs.IDL_BUFFER_PUBKEY }}
AUTHORITY: ${{ inputs.buffer-authority }}
RPC_ENDPOINT: ${{ inputs.rpc-endpoint }}
PROGRAM_ID: ${{ inputs.program-id }}

- name: Transfer program buffer to specified authority
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4
if: steps.cache-buffer.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
max_attempts: 50
shell: bash
command: |
solana program set-buffer-authority $PROGRAM_BUFFER_PUBKEY \
--keypair ./deployer-keypair.json \
--new-buffer-authority $AUTHORITY \
--url $RPC_ENDPOINT
env:
PROGRAM_BUFFER_PUBKEY: ${{ steps.deploy-buffers-store.outputs.PROGRAM_BUFFER_PUBKEY }}
AUTHORITY: ${{ inputs.buffer-authority }}
RPC_ENDPOINT: ${{ inputs.rpc-endpoint }}

- run: rm ./deployer-keypair.json
shell: bash
if: always()
28 changes: 28 additions & 0 deletions .github/actions/setup-anchor-cli/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Setup Anchor CLI"
description: "Setup Anchor CLI"

runs:
using: "composite"
steps:
- uses: ./.github/actions/setup-common/
- uses: ./.github/actions/setup-solana-cli/
- uses: actions/cache@v2
name: Cache Anchor Cli
id: cache-anchor-cli
with:
path: |
~/.cargo/bin/anchor
key: anchor-cli-${{ runner.os }}-v0003-${{ env.ANCHOR_CLI_VERSION }}-${{ env.ANCHOR_SHA }}
- run: cargo install --git https://github.com/coral-xyz/anchor --tag "v$ANCHOR_CLI_VERSION" anchor-cli --locked
shell: bash
if: steps.cache-anchor-cli.outputs.cache-hit != 'true'
- uses: actions/cache@v2
name: Cache Toml Cli
id: cache-toml-cli
with:
path: |
~/.cargo/bin/toml
key: toml-cli-${{ runner.os }}-v0002
- run: (cargo install toml-cli || true)
if: steps.cache-toml-cli.outputs.cache-hit != 'true'
shell: bash
17 changes: 17 additions & 0 deletions .github/actions/setup-common/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Setup common"
description: "Setup common"
runs:
using: "composite"
steps:
- run: sudo apt-get update
shell: bash
- run: sudo apt-get install -y pkg-config build-essential libudev-dev
shell: bash
- uses: actions-rs/toolchain@v1
name: Install minimal rust toolchain with clippy and rustfmt
with:
profile: minimal
toolchain: nightly
target: x86_64-unknown-linux-gnu
components: rustfmt, clippy
default: true
22 changes: 22 additions & 0 deletions .github/actions/setup-solana-cli/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Setup Solana CLI"
description: "Setup Solana CLI"
runs:
using: "composite"
steps:
- uses: actions/cache@v2
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.solana.com/v${{ env.SOLANA_CLI_VERSION }}/install)"
shell: bash
if: steps.cache-solana.outputs.cache-hit != 'true'
- run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash
- run: solana-keygen new -s --no-bip39-passphrase --force
shell: bash
- run: solana config set --url localhost
shell: bash
Loading
Loading