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

Pull Solana API private key in Github workflow #203

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

r-n-o
Copy link
Contributor

@r-n-o r-n-o commented Jan 23, 2024

Summary & Motivation

Our workflows have been throwing warnings this whole time 😮‍💨

For example: https://github.com/tkhq/sdk/actions/runs/7628473532/job/20779615804 (on main):

packages/viem test$ jest
packages/cosmjs test: No tests found, exiting with code 0
packages/cosmjs test: Done
packages/solana test:   console.warn
packages/solana test:     This test is skipped because it cannot run without SOLANA_TEST_ORG_API_PRIVATE_KEY set
packages/solana test:        9 |     if (!process.env.SOLANA_TEST_ORG_API_PRIVATE_KEY) {
packages/solana test:       10 |       // This test requires an env var to be set
packages/solana test:     > 11 |       console.warn(
packages/solana test:          |               ^
packages/solana test:       12 |         "This test is skipped because it cannot run without SOLANA_TEST_ORG_API_PRIVATE_KEY set"
packages/solana test:       13 |       );
packages/solana test:       14 |       return;
packages/solana test:       at Object.warn (src/__tests__/index-test.ts:11:15)
packages/solana test: PASS src/__tests__/index-test.ts

So what are we doing here?

  • I'm getting rid of the console.warn and replacing it with a proper error instead (link to failing build)
packages/solana test: FAIL src/__tests__/index-test.ts
packages/solana test:   TurnkeySigner
packages/solana test:     ✕ can sign a Solana transfer against production (2 ms)
packages/solana test:   ● TurnkeySigner › can sign a Solana transfer against production
packages/solana test:     This test requires SOLANA_TEST_ORG_API_PRIVATE_KEY to be set
packages/solana test:        9 |     if (!process.env.SOLANA_TEST_ORG_API_PRIVATE_KEY) {
packages/solana test:       10 |       // This test requires an env var to be set
packages/solana test:     > 11 |       throw new Error(
packages/solana test:          |             ^
packages/solana test:       12 |         "This test requires SOLANA_TEST_ORG_API_PRIVATE_KEY to be set"
packages/solana test:       13 |       );
packages/solana test:       14 |     }
packages/solana test:       at Object.<anonymous> (src/__tests__/index-test.ts:11:13)
  • Pulling in the proper env var in our CI workflow to resolve the failure

How I Tested These Changes

CI!

Copy link

codesandbox-ci bot commented Jan 23, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@r-n-o r-n-o merged commit 157db4b into main Jan 23, 2024
4 checks passed
@r-n-o r-n-o deleted the rno/pull-solana-api-private-key branch January 23, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants