Skip to content

Commit

Permalink
version 0.3.8 snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 26, 2024
1 parent 62c6e0d commit 1f2ad52
Show file tree
Hide file tree
Showing 18 changed files with 549 additions and 159 deletions.
13 changes: 4 additions & 9 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ inputs:
clippy:
description: Install Clippy if `true`. Defaults to `false`.
required: false
node:
description: The Node.js version to install. Required.
required: true
rustfmt:
description: Install Rustfmt if `true`. Defaults to `false`.
required: false
solana:
description: The Solana version to install. Skips if not provided.
description: Install Solana if `true`. Defaults to `false`.
required: false

runs:
Expand All @@ -32,7 +29,7 @@ runs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node }}
node-version: 18
cache: 'pnpm'

- name: Install Dependencies
Expand All @@ -43,7 +40,6 @@ runs:
shell: bash
run: pnpm zx ./scripts/ci/set-env.mjs


- name: Install Rustfmt
if: ${{ inputs.rustfmt == 'true' }}
uses: dtolnay/rust-toolchain@master
Expand All @@ -59,13 +55,12 @@ runs:
components: clippy

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


- name: Cache Cargo Dependencies
if: ${{ inputs.cargo-cache-key && !inputs.cargo-cache-fallback-key }}
uses: actions/cache@v4
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
pull_request:
branches: [main]

env:
NODE_VERSION: 18
SOLANA_VERSION: 1.18.18

jobs:
format_and_lint_programs:
name: Format & Lint Programs
Expand All @@ -22,7 +18,6 @@ jobs:
uses: ./.github/actions/setup
with:
clippy: true
node: ${{ env.NODE_VERSION }}
rustfmt: true

- name: Format Programs
Expand All @@ -40,8 +35,6 @@ jobs:

- name: Setup Environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}

- name: Format Client JS
run: pnpm clients:js:format
Expand All @@ -60,7 +53,6 @@ jobs:
uses: ./.github/actions/setup
with:
clippy: true
node: ${{ env.NODE_VERSION }}
rustfmt: true

- name: Format Client Rust
Expand All @@ -81,8 +73,7 @@ jobs:
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-programs
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
solana: true

- name: Build Programs
run: pnpm programs:build
Expand Down Expand Up @@ -113,8 +104,7 @@ jobs:
with:
cargo-cache-key: cargo-program-tests
cargo-cache-fallback-key: cargo-programs
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
solana: true

- name: Test Programs
run: pnpm programs:test
Expand All @@ -132,7 +122,6 @@ jobs:
with:
cargo-cache-key: cargo-programs
cargo-cache-local-key: cargo-local
node: ${{ env.NODE_VERSION }}

- name: Generate IDLs
run: pnpm generate:idls
Expand All @@ -153,7 +142,6 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
rustfmt: true

- name: Generate Clients
Expand All @@ -175,8 +163,7 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
solana: true

- name: Restore Program Builds
uses: actions/cache/restore@v4
Expand All @@ -199,8 +186,7 @@ jobs:
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-rust-client
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
solana: true

- name: Restore Program Builds
uses: actions/cache/restore@v4
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/publish-js-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Publish JS Client

on:
workflow_dispatch:
inputs:
level:
description: Version level
required: true
default: patch
type: choice
options:
- patch
- minor
- major
- prerelease
- prepatch
- preminor
- premajor
tag:
description: NPM Tag (and preid for pre-releases)
required: true
type: string
default: latest
create_release:
description: Create a GitHub release
required: true
type: boolean
default: true

jobs:
test_js:
name: Test JS client
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-programs
solana: true

- name: Format JS Client
run: pnpm clients:js:format

- name: Lint JS Client
run: pnpm clients:js:lint

- name: Build Programs
run: pnpm programs:build

- name: Test JS Client
run: pnpm clients:js:test

publish_js:
name: Publish JS client
runs-on: ubuntu-latest
needs: test_js
permissions:
contents: write
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup

- name: Ensure NPM_TOKEN variable is set
env:
token: ${{ secrets.NPM_TOKEN }}
if: ${{ env.token == '' }}
run: |
echo "The NPM_TOKEN secret variable is not set"
echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
exit 1
- name: NPM Authentication
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Set Git Author
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Publish JS Client
id: publish
run: pnpm clients:js:publish ${{ inputs.level }} ${{ inputs.tag }}

- name: Push Commit and Tag
run: git push origin --follow-tags

- name: Create GitHub release
if: github.event.inputs.create_release == 'true'
uses: ncipollo/release-action@v1
with:
tag: js@v${{ steps.publish.outputs.new_version }}
125 changes: 125 additions & 0 deletions .github/workflows/publish-rust-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Publish Rust Client

on:
workflow_dispatch:
inputs:
level:
description: Level
required: true
default: patch
type: choice
options:
- patch
- minor
- major
- rc
- beta
- alpha
- release
- version
version:
description: Version
required: false
type: string
dry_run:
description: Dry run
required: true
default: true
type: boolean
create_release:
description: Create a GitHub release
required: true
type: boolean
default: true

jobs:
test_rust:
name: Test Rust client
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-rust-client
clippy: true
rustfmt: true
solana: true

- name: Format Rust Client
run: pnpm clients:rust:format

- name: Lint Rust Client
run: pnpm clients:rust:lint

- name: Build Programs
run: pnpm programs:build

- name: Test Rust Client
run: pnpm clients:rust:test

publish_rust:
name: Publish Rust Client
runs-on: ubuntu-latest
needs: test_rust
permissions:
contents: write
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-publish-rust-client
cargo-cache-fallback-key: cargo-rust-client
clippy: true
rustfmt: true

- name: Install Cargo Release
run: which cargo-release || cargo install cargo-release

- name: Ensure CARGO_REGISTRY_TOKEN variable is set
env:
token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
if: ${{ env.token == '' }}
run: |
echo "The CARGO_REGISTRY_TOKEN secret variable is not set"
echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
exit 1
- name: Set Git Author
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Publish Rust Client
id: publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
if [ "${{ inputs.level }}" == "version" ]; then
LEVEL=${{ inputs.version }}
else
LEVEL=${{ inputs.level }}
fi
if [ "${{ inputs.dry_run }}" == "true" ]; then
OPTIONS="--dry-run"
else
OPTIONS=""
fi
pnpm clients:rust:publish $LEVEL $OPTIONS
- name: Push Commit and Tag
if: github.event.inputs.dry_run != 'true'
run: git push origin --follow-tags

- name: Create GitHub release
if: github.event.inputs.create_release == 'true' && github.event.inputs.dry_run != 'true'
uses: ncipollo/release-action@v1
with:
tag: rust@v${{ steps.publish.outputs.new_version }}
Loading

0 comments on commit 1f2ad52

Please sign in to comment.