generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1b4b8c5
Showing
84 changed files
with
19,085 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CARGO_TERM_COLOR=always | ||
NODE_VERSION=16.x | ||
PROGRAMS=["mpl-project-name"] | ||
RUST_VERSION=1.70.0 | ||
SOLANA_VERSION=1.16.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
CACHE: true | ||
|
||
jobs: | ||
changes: | ||
name: Detect changes | ||
runs-on: ubuntu-latest | ||
outputs: | ||
any: ${{ steps.changes.outputs.any }} | ||
programs: ${{ steps.changes.outputs.programs }} | ||
program_matrix: ${{ steps.program_matrix.outputs.matrix }} | ||
js_client: ${{ steps.changes.outputs.js_client }} | ||
rust_client: ${{ steps.changes.outputs.rust_client }} | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Load environment variables | ||
run: cat .github/.env >> $GITHUB_ENV | ||
|
||
- name: Detect changes | ||
uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
filters: .github/file-filters.yml | ||
|
||
- name: Filter program matrix | ||
id: program_matrix | ||
uses: metaplex-foundation/actions/filter-matrix@v1 | ||
with: | ||
matrix: ${{ env.PROGRAMS }} | ||
changes: ${{ steps.changes.outputs.changes }} | ||
suffix: _program | ||
|
||
build_programs: | ||
name: Programs | ||
if: ${{ needs.changes.outputs.any == 'true' }} | ||
needs: changes | ||
uses: ./.github/workflows/build-programs.yml | ||
secrets: inherit | ||
|
||
test_programs: | ||
name: Programs | ||
if: ${{ needs.changes.outputs.programs == 'true' }} | ||
needs: changes | ||
uses: ./.github/workflows/test-programs.yml | ||
secrets: inherit | ||
with: | ||
program_matrix: ${{ needs.changes.outputs.program_matrix }} | ||
|
||
generate_clients: | ||
name: Generate clients | ||
if: ${{ needs.changes.outputs.any == 'true' }} | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Load environment variables | ||
run: cat .github/.env >> $GITHUB_ENV | ||
|
||
- name: Install Linux Build Deps | ||
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev | ||
|
||
- name: Install Rust | ||
uses: metaplex-foundation/actions/install-rust@v1 | ||
with: | ||
toolchain: ${{ env.RUST_VERSION }} | ||
|
||
- name: Install Solana | ||
uses: metaplex-foundation/actions/install-solana@v1 | ||
with: | ||
version: ${{ env.SOLANA_VERSION }} | ||
cache: ${{ env.CACHE }} | ||
|
||
- name: Cache program dependencies | ||
if: env.CACHE == 'true' | ||
uses: metaplex-foundation/actions/cache-programs@v1 | ||
|
||
- name: Install Node.js | ||
uses: metaplex-foundation/actions/install-node-with-pnpm@v1 | ||
with: | ||
version: ${{ env.NODE_VERSION }} | ||
cache: ${{ env.CACHE }} | ||
dependencies: true | ||
|
||
- name: Cache IDL generators | ||
if: env.CACHE == 'true' | ||
uses: metaplex-foundation/actions/cache-idl-generators@v1 | ||
|
||
- name: Generate IDLs and clients | ||
run: pnpm generate | ||
|
||
- name: Ensure working directory is clean | ||
run: test -z "$(git status --porcelain)" | ||
|
||
test_js: | ||
if: needs.changes.outputs.js_client == 'true' | ||
name: JS Client | ||
needs: generate_clients | ||
uses: ./.github/workflows/test-js-client.yml | ||
secrets: inherit | ||
|
||
build_rust_client: | ||
if: needs.changes.outputs.rust_client == 'true' | ||
name: Rust Client | ||
needs: generate_clients | ||
uses: ./.github/workflows/build-rust-client.yml | ||
secrets: inherit | ||
|
||
test_rust_client: | ||
if: needs.changes.outputs.rust_client == 'true' | ||
name: Rust Client | ||
needs: generate_clients | ||
uses: ./.github/workflows/test-rust-client.yml | ||
secrets: inherit |
Oops, something went wrong.