-
Notifications
You must be signed in to change notification settings - Fork 0
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 88bed93
Showing
96 changed files
with
25,080 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,112 @@ | ||
name: Setup environment | ||
|
||
inputs: | ||
cargo-cache-key: | ||
description: The key to cache cargo dependencies. Skips cargo caching if not provided. | ||
required: false | ||
cargo-cache-fallback-key: | ||
description: The fallback key to use when caching cargo dependencies. Default to not using a fallback key. | ||
required: false | ||
cargo-cache-local-key: | ||
description: The key to cache local cargo dependencies. Skips local cargo caching if not provided. | ||
required: false | ||
clippy: | ||
description: Install Clippy if `true`. Defaults to `false`. | ||
required: false | ||
rustfmt: | ||
description: Install Rustfmt if `true`. Defaults to `false`. | ||
required: false | ||
solana: | ||
description: Install Solana if `true`. Defaults to `false`. | ||
required: false | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: 'pnpm' | ||
|
||
- name: Install Dependencies | ||
run: pnpm install --frozen-lockfile | ||
shell: bash | ||
|
||
- name: Set Environment Variables | ||
shell: bash | ||
run: pnpm zx ./scripts/ci/set-env.mjs | ||
|
||
- name: Install Protobuf Compiler (Temporary Workaround for Solana 2.0) | ||
if: ${{ inputs.solana == 'true' || inputs.rustfmt == 'true' || inputs.clippy == 'true' }} | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y protobuf-compiler | ||
- name: Install Rustfmt | ||
if: ${{ inputs.rustfmt == 'true' }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_FORMAT }} | ||
components: rustfmt | ||
|
||
- name: Install Clippy | ||
if: ${{ inputs.clippy == 'true' }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.TOOLCHAIN_LINT }} | ||
components: clippy | ||
|
||
- name: Install Solana | ||
if: ${{ inputs.solana == 'true' }} | ||
shell: bash | ||
run: | | ||
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_VERSION }}/install)" | ||
rm -f "$HOME/.local/share/solana/install/active_release" | ||
ln -s "$HOME/.local/share/solana/install/releases/${{ env.SOLANA_VERSION }}/solana-release" "$HOME/.local/share/solana/install/active_release" | ||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | ||
- name: Cache Cargo Dependencies | ||
if: ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-${{ inputs.cargo-cache-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-key }} | ||
|
||
- name: Cache Cargo Dependencies With Fallback | ||
if: ${{ inputs.cargo-cache-key && inputs.cargo-cache-fallback-key }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-${{ inputs.cargo-cache-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ inputs.cargo-cache-key }} | ||
${{ runner.os }}-${{ inputs.cargo-cache-fallback-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
${{ runner.os }}-${{ inputs.cargo-cache-fallback-key }} | ||
- name: Cache Local Cargo Dependencies | ||
if: ${{ inputs.cargo-cache-local-key }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
.cargo/bin/ | ||
.cargo/registry/index/ | ||
.cargo/registry/cache/ | ||
.cargo/git/db/ | ||
key: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-${{ inputs.cargo-cache-local-key }} |
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,198 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
format_and_lint_programs: | ||
name: Format & Lint Programs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
clippy: true | ||
rustfmt: true | ||
|
||
- name: Format Programs | ||
run: pnpm programs:format | ||
|
||
- name: Lint Programs | ||
run: pnpm programs:lint | ||
|
||
format_and_lint_client_js: | ||
name: Format & Lint Client JS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Format Client JS | ||
run: pnpm clients:js:format | ||
|
||
- name: Lint Client JS | ||
run: pnpm clients:js:lint | ||
|
||
format_and_lint_client_rust: | ||
name: Format & Lint Client Rust | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
clippy: true | ||
rustfmt: true | ||
|
||
- name: Format Client Rust | ||
run: pnpm clients:rust:format | ||
|
||
- name: Lint Client Rust | ||
run: pnpm clients:rust:lint | ||
|
||
build_programs: | ||
name: Build programs | ||
runs-on: ubuntu-latest | ||
needs: format_and_lint_programs | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
cargo-cache-key: cargo-programs | ||
solana: true | ||
|
||
- 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 Program Builds For Client Jobs | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ./**/*.so | ||
key: ${{ runner.os }}-builds-${{ github.sha }} | ||
|
||
test_programs: | ||
name: Test Programs | ||
runs-on: ubuntu-latest | ||
needs: format_and_lint_programs | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
cargo-cache-key: cargo-program-tests | ||
cargo-cache-fallback-key: cargo-programs | ||
solana: true | ||
|
||
- name: Test Programs | ||
run: pnpm programs:test | ||
|
||
generate_idls: | ||
name: Check IDL Generation | ||
runs-on: ubuntu-latest | ||
needs: format_and_lint_programs | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
cargo-cache-key: cargo-programs | ||
cargo-cache-local-key: cargo-local | ||
|
||
- name: Generate IDLs | ||
run: pnpm generate:idls | ||
|
||
- name: Check Working Directory | ||
run: | | ||
git status --porcelain | ||
test -z "$(git status --porcelain)" | ||
generate_clients: | ||
name: Check Client Generation | ||
runs-on: ubuntu-latest | ||
needs: format_and_lint_programs | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
rustfmt: true | ||
|
||
- name: Generate Clients | ||
run: pnpm generate:clients | ||
|
||
- name: Check Working Directory | ||
run: | | ||
git status --porcelain | ||
test -z "$(git status --porcelain)" | ||
test_client_js: | ||
name: Test Client JS | ||
runs-on: ubuntu-latest | ||
needs: build_programs | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
solana: true | ||
|
||
- name: Restore Program Builds | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./**/*.so | ||
key: ${{ runner.os }}-builds-${{ github.sha }} | ||
|
||
- name: Test Client JS | ||
run: pnpm clients:js:test | ||
|
||
test_client_rust: | ||
name: Test Client Rust | ||
runs-on: ubuntu-latest | ||
needs: build_programs | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
cargo-cache-key: cargo-rust-client | ||
solana: true | ||
|
||
- name: Restore Program Builds | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./**/*.so | ||
key: ${{ runner.os }}-builds-${{ github.sha }} | ||
|
||
- name: Test Client Rust | ||
run: pnpm clients:rust:test |
Oops, something went wrong.