Skip to content

Commit

Permalink
Fix CI again. (metaplex-foundation#876)
Browse files Browse the repository at this point in the history
* Update program.yml

* update tests

* take 2

* take 3

* take 4

* take 6

* take 5

* test something

* verify rust!

* fix formatting

* hmm

* fix?

* uhh

* uhhh

* testing something

* testing something

* testing something

* testing something again urg

* testing something again urg

* testing something again urg

* testing something again urg

* testing something again urg

* testing something again urg

* testing something again urg

* testing something again urg

* testing something again urg

* more tests

* more tests

* more tests

* fix everything

* fix everything

* fix everything

* fix everything

* fix everything

* fix lints

* fix stuff

* verify package library

* program simplify

* fix more stuff

* fix nft packs

* undo thingy

* fix
  • Loading branch information
stegaBOB authored Nov 3, 2022
1 parent 5d2f2af commit 87dadfb
Show file tree
Hide file tree
Showing 33 changed files with 126 additions and 107 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/integration-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
build_token_metadata:
required: true
type: boolean
changes:
required: true
type: boolean

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -47,6 +50,7 @@ jobs:
runs-on: buildjet-8vcpu-ubuntu-2004
needs: changes
if: |
inputs.changes == false ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.package == 'true' ||
needs.changes.outputs.workflow == 'true'
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ on:
inputs:
cache:
description: 'Use Cached Dependencies'
required: false
default: true
required: true
type: boolean
changes:
description: 'Only run when files change'
required: true
type: boolean

jobs:
integration-tests:
Expand All @@ -21,15 +25,11 @@ jobs:
matrix:
node:
- name: "fixed-price-sale"
build_token_metadata: true
- name: "hydra"
build_token_metadata: true
- name: "candy-machine-core"
build_token_metadata: true
uses: ./.github/workflows/integration-reusable.yml
with:
name: ${{ matrix.node.name }}
build_token_metadata: ${{ matrix.node.build_token_metadata }}
cache: ${{ (github.event_name == 'workflow_dispatch' && github.event.workflow_dispatch.inputs.cache == 'true') ||
(github.event_name != 'workflow_dispatch' && false) }}
# CHANGE `&& false` to `&& true` to default the workflow to use caching.
build_token_metadata: ${{ !contains(matrix.node.build_token_metadata, 'false') }}
cache: ${{ contains(inputs.cache, 'true') }}
changes: ${{ !contains(inputs.changes, 'false') }}
10 changes: 3 additions & 7 deletions .github/workflows/program-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ on:
name:
required: true
type: string
verify_rust:
required: true
type: boolean
cargo_test:
cache:
required: true
type: boolean
cache:
changes:
required: true
type: boolean

Expand Down Expand Up @@ -61,6 +58,7 @@ jobs:
runs-on: buildjet-8vcpu-ubuntu-2204
needs: changes
if: |
inputs.changes == false ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.package == 'true' ||
needs.changes.outputs.workflow == 'true' ||
Expand Down Expand Up @@ -90,7 +88,6 @@ jobs:
if: ${{ env.CACHE != 'false' }}
# Run lint checks
- uses: ./.github/actions/verify-rust
if: ${{ inputs.verify_rust }}
with:
working-directory: ./${{ inputs.name }}/program

Expand All @@ -103,7 +100,6 @@ jobs:
- name: "Cargo Test: ${{ inputs.name }}"
working-directory: ./${{ inputs.name }}/program
run: cargo +${{ env.RUST_TOOLCHAIN }} test -- --nocapture --test-threads 1
if: ${{ inputs.cargo_test }}

# Run BPF Test
- name: "BPF Test: ${{ inputs.name }}"
Expand Down
37 changes: 9 additions & 28 deletions .github/workflows/program.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ on:
inputs:
cache:
description: 'Use Cached Dependencies'
required: false
default: true
required: true
type: boolean
changes:
description: 'Only run when files change'
required: true
type: boolean

jobs:
program-tests:
Expand All @@ -20,42 +24,19 @@ jobs:
fail-fast: false
matrix:
node:
- name: "auction-house"
verify_rust: true
cargo_test: true
- name: "auctioneer"
verify_rust: true
cargo_test: true
- name: "bubblegum"
verify_rust: false
cargo_test: false
- name: "candy-machine"
verify_rust: true
cargo_test: true
- name: "auction-house"
- name: "fixed-price-sale"
verify_rust: false
cargo_test: false
- name: "gumdrop"
verify_rust: false
cargo_test: true
- name: "hydra"
verify_rust: true
cargo_test: true
- name: "nft-packs"
verify_rust: false
cargo_test: false
- name: "token-entangler"
verify_rust: true
cargo_test: true
- name: "token-metadata"
verify_rust: true
cargo_test: true

uses: ./.github/workflows/program-reusable.yml
with:
name: ${{ matrix.node.name }}
verify_rust: ${{ matrix.node.verify_rust }}
cargo_test: ${{ matrix.node.cargo_test }}
cache: ${{ (github.event_name == 'workflow_dispatch' && github.event.workflow_dispatch.inputs.cache == 'true') ||
(github.event_name != 'workflow_dispatch' && false) }}
# CHANGE `&& false` to `&& true` to default the workflow to use caching.
cache: ${{ contains(inputs.cache, 'true') }}
changes: ${{ !contains(inputs.changes, 'false') }}
4 changes: 4 additions & 0 deletions .github/workflows/sdk-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
cache:
required: true
type: boolean
changes:
required: true
type: boolean

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -46,6 +49,7 @@ jobs:
name: Build Lint and Test
needs: changes
if: |
inputs.changes == false ||
needs.changes.outputs.core == 'true' ||
needs.changes.outputs.package == 'true' ||
needs.changes.outputs.workflow == 'true'
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ on:
inputs:
cache:
description: 'Use Cached Dependencies'
required: false
default: true
required: true
type: boolean
changes:
description: 'Only run when files change'
required: true
type: boolean

jobs:
sdk-tests:
Expand All @@ -21,30 +25,23 @@ jobs:
matrix:
node:
- name: "auction-house"
skip_test: false
- name: "candy-machine"
skip_test: false
- name: "candy-machine-core"
skip_test: true
- name: "core"
skip_test: false
- name: "fixed-price-sale"
skip_test: true
- name: "gumdrop"
skip_test: false
- name: "hydra"
skip_test: true
- name: "nft-packs"
skip_test: true
- name: "token-entangler"
skip_test: false
- name: "token-metadata"
skip_test: false

uses: ./.github/workflows/sdk-reusable.yml
with:
name: ${{ matrix.node.name }}
skip_test: ${{ matrix.node.skip_test }}
cache: ${{ (github.event_name == 'workflow_dispatch' && github.event.workflow_dispatch.inputs.cache == 'true') ||
(github.event_name != 'workflow_dispatch' && false) }}
# CHANGE `&& false` to `&& true` to default the workflow to use caching.
skip_test: ${{ contains(matrix.node.skip_test, 'true') }}
cache: ${{ contains(inputs.cache, 'true') }}
changes: ${{ !contains(inputs.changes, 'false') }}
1 change: 1 addition & 0 deletions bubblegum/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
test-bpf = []
default = []

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions bubblegum/program/tests/simple.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg(feature = "test-bpf")]
pub mod utils;

use anchor_lang::solana_program::instruction::InstructionError;
Expand Down
1 change: 0 additions & 1 deletion fixed-price-sale/program/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ pub struct PrimaryMetadataCreators {
pub creators: Vec<Creator>,
}


pub fn from_mpl_creators(creators: Vec<mpl_token_metadata::state::Creator>) -> Vec<Creator> {
creators
.iter()
Expand Down
2 changes: 1 addition & 1 deletion gumdrop/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,4 +1484,4 @@ pub struct CandyMachineData {
pub price: u64,
pub items_available: u64,
pub go_live_date: Option<i64>,
}
}
6 changes: 4 additions & 2 deletions gumdrop/program/src/merkle_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ pub fn verify(proof: Vec<[u8; 32]>, root: [u8; 32], leaf: [u8; 32]) -> bool {
for proof_element in proof.into_iter() {
if computed_hash <= proof_element {
// Hash(current computed hash + current element of the proof)
computed_hash = solana_program::keccak::hashv(&[&[0x01], &computed_hash, &proof_element]).0;
computed_hash =
solana_program::keccak::hashv(&[&[0x01], &computed_hash, &proof_element]).0;
} else {
// Hash(current element of the proof + current computed hash)
computed_hash = solana_program::keccak::hashv(&[&[0x01], &proof_element, &computed_hash]).0;
computed_hash =
solana_program::keccak::hashv(&[&[0x01], &proof_element, &computed_hash]).0;
}
}
// Check if the computed hash (root) is equal to the provided root
Expand Down
2 changes: 0 additions & 2 deletions nft-packs/program/src/processor/add_card_to_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ pub fn get_pack_config_data<'a>(
) -> Result<PackConfig, ProgramError> {
let unpack = PackConfig::unpack(&account_info.data.borrow_mut());



match unpack {
Ok(data) => Ok(data),
Err(_) => {
Expand Down
2 changes: 0 additions & 2 deletions nft-packs/program/src/processor/request_card_to_redeem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ pub fn get_proving_process_data<'a>(
) -> Result<ProvingProcess, ProgramError> {
let unpack = ProvingProcess::unpack(&account_info.data.borrow_mut());



match unpack {
Ok(data) => Ok(data),
Err(_) => {
Expand Down
10 changes: 9 additions & 1 deletion nft-packs/program/src/state/pack_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ use solana_program::{
/// Pack card
#[repr(C)]
#[derive(
Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, BorshSchema, Default, ShankAccount,
Debug,
Clone,
PartialEq,
Eq,
BorshSerialize,
BorshDeserialize,
BorshSchema,
Default,
ShankAccount,
)]
pub struct PackCard {
/// Account type - PackCard
Expand Down
10 changes: 9 additions & 1 deletion nft-packs/program/src/state/pack_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ impl Default for PackDistributionType {
/// Pack set
#[repr(C)]
#[derive(
Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, BorshSchema, Default, ShankAccount,
Debug,
Clone,
PartialEq,
Eq,
BorshSerialize,
BorshDeserialize,
BorshSchema,
Default,
ShankAccount,
)]
pub struct PackSet {
/// Account type - PackSet
Expand Down
10 changes: 9 additions & 1 deletion nft-packs/program/src/state/pack_voucher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ use solana_program::{
/// Pack voucher
#[repr(C)]
#[derive(
Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, BorshSchema, Default, ShankAccount,
Debug,
Clone,
PartialEq,
Eq,
BorshSerialize,
BorshDeserialize,
BorshSchema,
Default,
ShankAccount,
)]
pub struct PackVoucher {
/// Account type - PackVoucher
Expand Down
1 change: 1 addition & 0 deletions nft-packs/program/tests/activate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg(feature = "test-bpf")]
mod utils;

use mpl_nft_packs::{
Expand Down
1 change: 1 addition & 0 deletions nft-packs/program/tests/add_card_to_pack.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg(feature = "test-bpf")]
mod utils;

use mpl_nft_packs::{
Expand Down
1 change: 1 addition & 0 deletions nft-packs/program/tests/add_voucher_to_pack.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg(feature = "test-bpf")]
mod utils;

use mpl_nft_packs::{
Expand Down
Loading

0 comments on commit 87dadfb

Please sign in to comment.