Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Improve script reuse #31

Merged
merged 19 commits into from
Dec 19, 2024
Merged
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ runs:

- name: Set Environment Variables
shell: bash
run: pnpm zx ./scripts/ci/set-env.mjs
run: pnpm tsx ./scripts/ci/set-env.mts

- name: Install Rust 'build' Toolchain
if: ${{ contains(inputs.toolchain, 'build') }}
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
uses: ./.github/actions/setup

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

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

format_and_lint_client_rust:
name: Format & Lint Client Rust
Expand All @@ -35,16 +35,16 @@ jobs:
toolchain: format, lint

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

- name: Lint / Clippy
run: pnpm zx ./scripts/client/lint-rust-clippy.mjs

- name: Lint / Features
run: pnpm zx ./scripts/client/lint-rust-features.mjs
run: pnpm rust:lint:clippy

- name: Lint / Docs
run: pnpm zx ./scripts/client/lint-rust-docs.mjs
run: pnpm rust:lint:docs

- name: Lint / Features
run: pnpm rust:lint:features

format_and_lint_interface:
name: Format & Lint Interface
Expand All @@ -62,13 +62,13 @@ jobs:
run: pnpm interface:format

- name: Lint / Clippy
run: pnpm zx ./scripts/interface/lint-clippy.mjs

- name: Lint / Features
run: pnpm zx ./scripts/interface/lint-features.mjs
run: pnpm interface:lint:clippy

- name: Lint / Docs
run: pnpm zx ./scripts/interface/lint-docs.mjs
run: pnpm interface:lint:docs

- name: Lint / Features
run: pnpm interface:lint:features

wasm_interface:
name: Build Interface in WASM
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
solana: true

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

test_client_rust:
name: Test Client Rust
Expand All @@ -158,7 +158,8 @@ jobs:
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-rust-client
toolchain: test
solana: true

- name: Test Client Rust
run: pnpm clients:rust:test
run: pnpm rust:test
14 changes: 7 additions & 7 deletions .github/workflows/publish-js-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ jobs:
with:
solana: true

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

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

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

publish_js:
name: Publish JS client
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:

- name: Publish JS Client
id: publish
run: pnpm clients:js:publish ${{ inputs.level }} ${{ inputs.tag }}
run: pnpm js:publish ${{ inputs.level }} ${{ inputs.tag }}

- name: Push Commit and Tag
run: git push origin --follow-tags
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish-rust-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ jobs:
rustfmt: true
solana: true

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

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

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

publish_rust:
name: Publish Rust Client
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
OPTIONS=""
fi

pnpm clients:rust:publish $LEVEL $OPTIONS
pnpm rust:publish $LEVEL $OPTIONS

- name: Push Commit and Tag
if: github.event.inputs.dry_run != 'true'
Expand Down
44 changes: 26 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
{
"private": true,
"scripts": {
"solana:check": "zx ./scripts/check-solana-version.mjs",
"solana:link": "zx ./scripts/link-solana-version.mjs",
"solana:check": "tsx ./scripts/helpers/check-solana-version.mts",
"solana:link": "tsx ./scripts/helpers/link-solana-version.mts",
"generate": "pnpm generate:clients",
"generate:clients": "zx ./scripts/generate-clients.mjs",
"validator:start": "zx ./scripts/start-validator.mjs",
"generate:clients": "tsx ./scripts/helpers/generate-clients.mts",
"validator:start": "tsx ./scripts/helpers/start-validator.mts",
"validator:restart": "pnpm validator:start --restart",
"validator:stop": "zx ./scripts/stop-validator.mjs",
"clients:js:format": "zx ./scripts/client/format-js.mjs",
"clients:js:lint": "zx ./scripts/client/lint-js.mjs",
"clients:js:publish": "zx ./scripts/client/publish-js.mjs",
"clients:js:test": "zx ./scripts/client/test-js.mjs",
"clients:rust:format": "zx ./scripts/client/format-rust.mjs",
"clients:rust:lint": "zx ./scripts/client/lint-rust.mjs",
"clients:rust:publish": "zx ./scripts/client/publish-rust.mjs",
"clients:rust:test": "zx ./scripts/client/test-rust.mjs",
"interface:format": "zx ./scripts/interface/format.mjs",
"interface:lint": "zx ./scripts/interface/lint.mjs",
"interface:test": "zx ./scripts/interface/test.mjs",
"interface:wasm": "zx ./scripts/interface/wasm.mjs",
"template:upgrade": "zx ./scripts/upgrade-template.mjs"
"validator:stop": "tsx ./scripts/helpers/stop-validator.mts",
"js:format": "tsx ./scripts/js/format.mts",
"js:lint": "tsx ./scripts/js/lint.mts",
"js:publish": "tsx ./scripts/js/publish.mts",
"js:test": "tsx ./scripts/js/test.mts",
"rust:format": "tsx ./scripts/rust/format.mts clients/rust",
"rust:lint": "tsx ./scripts/rust/lint.mts clients/rust",
"rust:lint:clippy": "tsx ./scripts/rust/lint-clippy.mts clients/rust",
"rust:lint:docs": "tsx ./scripts/rust/lint-docs.mts clients/rust",
"rust:lint:features": "tsx ./scripts/rust/lint-features.mts clients/rust",
"rust:publish": "tsx ./scripts/rust/publish.mts clients/rust",
"rust:test": "tsx ./scripts/rust/test.mts clients/rust",
"interface:format": "tsx ./scripts/rust/format.mts interface",
"interface:lint": "tsx ./scripts/rust/lint.mts interface",
"interface:lint:clippy": "tsx ./scripts/rust/lint-clippy.mts interface",
"interface:lint:docs": "tsx ./scripts/rust/lint-docs.mts interface",
"interface:lint:features": "tsx ./scripts/rust/lint-features.mts interface",
"interface:publish": "tsx ./scripts/rust/publish.mts interface",
"interface:test": "tsx ./scripts/rust/test.mts interface",
"interface:wasm": "tsx ./scripts/rust/wasm.mts interface",
"template:upgrade": "tsx ./scripts/helpers/upgrade-template.ts"
},
"devDependencies": {
"@codama/renderers-js": "^1.1.0",
"@codama/renderers-rust": "^1.0.4",
"@iarna/toml": "^2.2.5",
"codama": "^1.1.0",
"tsx": "^4.19.2",
"typescript": "^5.5.2",
"zx": "^7.2.3"
},
Expand Down
Loading
Loading