Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus authored Jul 22, 2024
0 parents commit 029b5eb
Show file tree
Hide file tree
Showing 87 changed files with 19,455 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CARGO_TERM_COLOR=always
NODE_VERSION=16.x
PROGRAMS=["mpl-project-name"]
RUST_VERSION=1.70.0
SOLANA_VERSION=1.16.18
COMMIT_USER_NAME=github-actions
COMMIT_USER_EMAIL=[email protected]
50 changes: 50 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This file is used by the dorny/paths-filter action to figure out if a program or
# client has changed and thus if it should be built or tested. Any changes in the
# files listed below will trigger the appropriate workflow for that program or client.

# Programs.

program_common: &program_common
- ".github/workflows/build-programs.yml"
- ".github/workflows/test-programs.yml"
- ".github/workflows/main.yml"
- ".github/file-filters.yml"
- ".github/.env"

mpl_project_name_program: &mpl_project_name_program
- *program_common
- "programs/mpl-project-name/**"

programs: &programs
- *mpl_project_name_program

# Clients.

client_common: &client_common
- *programs
- ".github/workflows/test-js.yml"
- ".github/workflows/test-rust-client.yml"
- ".github/workflows/build-rust-client.yml"
- ".github/workflows/main.yml"
- ".github/file-filters.yml"
- ".github/.env"
- "configs/shank.cjs"
- "configs/kinobi.cjs"

js_client: &js_client
- *client_common
- "clients/js/**"

rust_client: &rust_client
- *client_common
- "clients/rust/**"

clients: &clients
- *js_client
- *rust_client

# Any.

any: &any
- *programs
- *clients
69 changes: 69 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Benchmark
on:
workflow_call:

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

env:
CACHE: true

jobs:
benchmark:
name: Performance regression check
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV

- name: Start validator
uses: metaplex-foundation/actions/start-validator@v1
with:
node: 18.x
solana: ${{ env.SOLANA_VERSION }}
cache: ${{ env.CACHE }}

- name: Install dependencies
uses: metaplex-foundation/actions/install-node-dependencies@v1
with:
folder: ./clients/js
cache: ${{ env.CACHE }}
key: clients-js

- name: Build
working-directory: ./clients/js
run: pnpm build

- name: Test
working-directory: ./clients/js
run: pnpm bench

# Download previous benchmark result from cache (if exists)
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark

# Run `github-action-benchmark` action
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the output.json came from
tool: "customSmallerIsBetter"
# Where the output from the benchmark tool is stored
output-file-path: ./clients/js/output.json
# Where the previous data file is stored
# external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true
# Access token to deploy GitHub Pages branch
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: true
65 changes: 65 additions & 0 deletions .github/workflows/build-programs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Programs

on:
workflow_call:
inputs:
rust:
type: string
solana:
type: string
workflow_dispatch:
inputs:
rust:
description: Rust version
default: 1.70.0
required: true
type: string
solana:
description: Solana version
default: 1.16.17
required: true
type: string

env:
CACHE: true

jobs:
build_programs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV

- name: Install Rust
uses: metaplex-foundation/actions/install-rust@v1
with:
toolchain: ${{ inputs.rust || env.RUST_VERSION }}

- name: Install Solana
uses: metaplex-foundation/actions/install-solana@v1
with:
version: ${{ inputs.solana || env.SOLANA_VERSION }}
cache: ${{ env.CACHE }}

- name: Cache program dependencies
if: env.CACHE == 'true'
uses: metaplex-foundation/actions/cache-programs@v1

- name: Build programs
shell: bash
working-directory: configs/scripts/program
run: ./build.sh
env:
PROGRAMS: ${{ env.PROGRAMS }}

- name: Upload program builds
uses: actions/upload-artifact@v3
with:
name: program-builds
# First wildcard ensures exported paths are consistently under the programs folder.
path: ./program*/.bin/*.so
if-no-files-found: error
71 changes: 71 additions & 0 deletions .github/workflows/build-rust-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build Rust Client

on:
workflow_call:
inputs:
rust:
type: string
solana:
type: string
workflow_dispatch:
inputs:
rust:
description: Rust version
default: 1.70.0
required: true
type: string
solana:
description: Solana version
default: 1.16.17
required: true
type: string

env:
CACHE: true

jobs:
build_sdk:
name: Build
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Load environment variables
run: cat .github/.env >> $GITHUB_ENV

- name: Install Rust
uses: metaplex-foundation/actions/install-rust@v1
with:
toolchain: ${{ inputs.rust || env.RUST_VERSION }}

- name: Install Solana
uses: metaplex-foundation/actions/install-solana@v1
with:
version: ${{ inputs.solana || env.SOLANA_VERSION }}
cache: ${{ env.CACHE }}

- name: Cache Rust client test dependencies
uses: metaplex-foundation/actions/cache-crate@v1
with:
folder: ./clients/rust
key: rust-client-test

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features --no-deps --manifest-path ./clients/rust/Cargo.toml

- name: Build Rust client
shell: bash
working-directory: clients/rust
run: cargo build --all-features --release

- name: Upload Rust client builds
uses: actions/upload-artifact@v3
with:
name: rust-client-builds
# First wildcard ensures exported paths are consistently under the clients folder.
path: ./targe*/release/*mpl_project_name*
if-no-files-found: error
Loading

0 comments on commit 029b5eb

Please sign in to comment.