-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
0432d41
commit 6bde7bc
Showing
6 changed files
with
272 additions
and
15 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,39 @@ | ||
name: Setup environment | ||
|
||
inputs: | ||
anchor: | ||
description: The Anchor version to install | ||
cache: | ||
description: Enable caching | ||
default: "true" | ||
node: | ||
description: The Node.js version to install | ||
required: true | ||
solana: | ||
description: The Solana version to install | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node }} | ||
cache: "pnpm" | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
shell: bash | ||
- name: Install Solana | ||
if: ${{ inputs.solana != '' }} | ||
uses: metaplex-foundation/actions/install-solana@v1 | ||
with: | ||
version: ${{ inputs.solana }} | ||
cache: ${{ inputs.cache }} | ||
- name: Install Anchor | ||
if: ${{ inputs.anchor != '' }} | ||
uses: metaplex-foundation/actions/install-anchor-cli@v1 | ||
with: | ||
version: ${{ inputs.anchor }} | ||
cache: ${{ inputs.cache }} |
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,200 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
NODE_VERSION: 18 | ||
SOLANA_VERSION: 1.18.12 | ||
ANCHOR_VERSION: 0.30.0 | ||
CARGO_CACHE: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
jobs: | ||
build_programs: | ||
name: Build programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
solana: ${{ env.SOLANA_VERSION }} | ||
anchor: ${{ env.ANCHOR_VERSION }} | ||
- name: Cache cargo dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CARGO_CACHE }} | ||
key: ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo-programs | ||
- name: Build programs | ||
run: pnpm programs:build | ||
- name: Upload program builds | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: program-builds | ||
path: ./target/deploy/*.so | ||
if-no-files-found: error | ||
- name: Save all builds for clients | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ./**/*.so | ||
key: ${{ runner.os }}-builds-${{ github.sha }} | ||
|
||
test_programs: | ||
name: Test programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
solana: ${{ env.SOLANA_VERSION }} | ||
anchor: ${{ env.ANCHOR_VERSION }} | ||
- name: Cache test cargo dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CARGO_CACHE }} | ||
key: ${{ runner.os }}-cargo-program-tests-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-program-tests | ||
${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }} | ||
${{ runner.os }}-cargo-programs | ||
- name: Test programs | ||
run: pnpm programs:test | ||
|
||
generate_idls: | ||
name: Check IDL generation | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
solana: ${{ env.SOLANA_VERSION }} | ||
anchor: ${{ env.ANCHOR_VERSION }} | ||
- name: Cache cargo dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CARGO_CACHE }} | ||
key: ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo-programs | ||
- name: Cache local cargo dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
.cargo/bin/ | ||
.cargo/registry/index/ | ||
.cargo/registry/cache/ | ||
.cargo/git/db/ | ||
key: ${{ runner.os }}-cargo-local-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo-local | ||
- name: Generate IDLs | ||
run: pnpm generate:idls | ||
- name: Ensure working directory is clean | ||
run: test -z "$(git status --porcelain)" | ||
|
||
generate_clients: | ||
name: Check client generation | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
solana: ${{ env.SOLANA_VERSION }} | ||
- name: Generate clients | ||
run: pnpm generate:clients | ||
- name: Ensure working directory is clean | ||
run: test -z "$(git status --porcelain)" | ||
|
||
test_js: | ||
name: Test JS client | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
solana: ${{ env.SOLANA_VERSION }} | ||
- name: Restore all builds | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./**/*.so | ||
key: ${{ runner.os }}-builds-${{ github.sha }} | ||
- name: Test JS client | ||
run: pnpm clients:js:test | ||
|
||
lint_js: | ||
name: Lint JS client | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
- name: Lint JS client | ||
run: pnpm clients:js:lint | ||
|
||
test_rust: | ||
name: Test Rust client | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
solana: ${{ env.SOLANA_VERSION }} | ||
- name: Cache Rust client dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CARGO_CACHE }} | ||
key: ${{ runner.os }}-cargo-rust-client-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo-rust-client | ||
- name: Restore all builds | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./**/*.so | ||
key: ${{ runner.os }}-builds-${{ github.sha }} | ||
- name: Test Rust client | ||
run: pnpm clients:rust:test | ||
|
||
lint_rust: | ||
name: Lint Rust client | ||
needs: build_programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
node: ${{ env.NODE_VERSION }} | ||
- name: Lint Rust client | ||
run: pnpm clients:rust:lint |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,9 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { workingDirectory } from '../utils.mjs'; | ||
|
||
// Check the client using ESLint and Prettier. | ||
cd(path.join(workingDirectory, 'clients', 'js')); | ||
await $`pnpm install`; | ||
await $`pnpm lint`; | ||
await $`pnpm format`; |
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,7 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { workingDirectory } from '../utils.mjs'; | ||
|
||
// Check the client using Clippy. | ||
cd(path.join(workingDirectory, 'clients', 'rust')); | ||
await $`cargo clippy ${argv._}`; |