-
Notifications
You must be signed in to change notification settings - Fork 55
inital codama client generation and tests #250
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,91 @@ | |||||||||||||||||||||||
| name: Test JS Kit client | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| on: | |||||||||||||||||||||||
| workflow_call: | |||||||||||||||||||||||
| inputs: | |||||||||||||||||||||||
| git_ref: | |||||||||||||||||||||||
| type: string | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| env: | |||||||||||||||||||||||
| CACHE: true | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||
| test: | |||||||||||||||||||||||
| name: Test | |||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||
| node: ["20.x", "22.x"] | |||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Git checkout | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| ref: ${{ inputs.git_ref }} | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Load environment variables | |||||||||||||||||||||||
| run: cat .github/.env >> $GITHUB_ENV | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Sanitize Ref | |||||||||||||||||||||||
| id: sanitize | |||||||||||||||||||||||
| shell: bash | |||||||||||||||||||||||
| run: | | |||||||||||||||||||||||
| REF="${{ inputs.git_ref }}" | |||||||||||||||||||||||
| if [ -z "$REF" ]; then | |||||||||||||||||||||||
| REF="default" | |||||||||||||||||||||||
| fi | |||||||||||||||||||||||
| SANITIZED=${REF//\//-} | |||||||||||||||||||||||
| echo "sanitized=$SANITIZED" >> "$GITHUB_OUTPUT" | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Start validator | |||||||||||||||||||||||
| uses: metaplex-foundation/actions/start-validator@v1 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| node: ${{ matrix.node }} | |||||||||||||||||||||||
| solana: ${{ env.SOLANA_VERSION }} | |||||||||||||||||||||||
| cache: ${{ env.CACHE }} | |||||||||||||||||||||||
| artifacts: program-builds-${{ steps.sanitize.outputs.sanitized }} | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||
| uses: metaplex-foundation/actions/install-node-dependencies@v1 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| folder: ./clients/js-kit | |||||||||||||||||||||||
| cache: ${{ env.CACHE }} | |||||||||||||||||||||||
| key: clients-js-kit | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Build | |||||||||||||||||||||||
| working-directory: ./clients/js-kit | |||||||||||||||||||||||
| run: pnpm build | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Test | |||||||||||||||||||||||
| working-directory: ./clients/js-kit | |||||||||||||||||||||||
| run: pnpm test | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| lint: | |||||||||||||||||||||||
| name: Lint | |||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Git checkout | |||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Load environment variables | |||||||||||||||||||||||
| run: cat .github/.env >> $GITHUB_ENV | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Install Node.js | |||||||||||||||||||||||
| uses: metaplex-foundation/actions/install-node-with-pnpm@v1 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| version: ${{ env.NODE_VERSION }} | |||||||||||||||||||||||
| cache: ${{ env.CACHE }} | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||
| uses: metaplex-foundation/actions/install-node-dependencies@v1 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| folder: ./clients/js-kit | |||||||||||||||||||||||
| cache: ${{ env.CACHE }} | |||||||||||||||||||||||
| key: clients-js-kit | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Format | |||||||||||||||||||||||
| working-directory: ./clients/js-kit | |||||||||||||||||||||||
| run: pnpm format | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| - name: Lint | |||||||||||||||||||||||
| working-directory: ./clients/js-kit | |||||||||||||||||||||||
| run: pnpm lint | |||||||||||||||||||||||
|
Comment on lines
+63
to
+91
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium test
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI about 2 months ago To fix the issue, add a
Suggested changeset
1
.github/workflows/test-js-kit-client.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dmissing due to other test workflow not having this. |
|||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| module.exports = { | ||
| extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'], | ||
| plugins: ['prettier'], | ||
| overrides: [], | ||
| parserOptions: { | ||
| ecmaVersion: 'latest', | ||
| sourceType: 'module', | ||
| project: 'tsconfig.json', | ||
| tsconfigRootDir: __dirname, | ||
| }, | ||
| rules: { | ||
| '@typescript-eslint/no-use-before-define': 'off', | ||
| '@typescript-eslint/no-unused-vars': 'off', | ||
| 'class-methods-use-this': 'off', | ||
| 'import/prefer-default-export': 'off', | ||
| 'import/no-cycle': 'off', | ||
| 'no-underscore-dangle': 'off', | ||
| 'max-classes-per-file': 'off', | ||
| 'no-param-reassign': 'off', | ||
| 'func-names': 'off', | ||
| }, | ||
| ignorePatterns: ['dist/**', '.eslintrc.js'], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .vercel | ||
| docs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "semi": true, | ||
| "singleQuote": true, | ||
| "trailingComma": "es5", | ||
| "useTabs": false, | ||
| "tabWidth": 2, | ||
| "arrowParens": "always", | ||
| "printWidth": 80, | ||
| "parser": "typescript" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "name": "@metaplex-foundation/mpl-core-kit", | ||
| "version": "0.0.1", | ||
| "description": "JavaScript client for MPL Core using @solana/kit", | ||
| "private": true, | ||
| "main": "dist/src/index.js", | ||
| "types": "dist/src/index.d.ts", | ||
| "scripts": { | ||
| "build": "rimraf dist && tsc -p tsconfig.json", | ||
| "test": "NODE_OPTIONS='--experimental-global-webcrypto' ava", | ||
| "lint": "eslint --ext js,ts,tsx src", | ||
| "lint:fix": "eslint --fix --ext js,ts,tsx src", | ||
| "format": "prettier --check src test", | ||
| "format:fix": "prettier --write src test" | ||
| }, | ||
| "files": [ | ||
| "/dist/src" | ||
| ], | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "registry": "https://registry.npmjs.org" | ||
| }, | ||
| "homepage": "https://metaplex.com", | ||
| "repository": "https://github.com/metaplex-foundation/mpl-core.git", | ||
| "author": "Metaplex Maintainers <contact@metaplex.com>", | ||
| "license": "Apache-2.0", | ||
| "devDependencies": { | ||
| "@ava/typescript": "^5.0.0", | ||
| "@types/node": "^24.0.3", | ||
| "@typescript-eslint/eslint-plugin": "^5.0.0", | ||
| "@typescript-eslint/parser": "^5.46.1", | ||
| "ava": "^6.1.3", | ||
| "eslint": "^8.0.1", | ||
| "eslint-config-airbnb-typescript": "^17.0.0", | ||
| "eslint-config-prettier": "^8.5.0", | ||
| "eslint-plugin-import": "^2.26.0", | ||
| "eslint-plugin-prettier": "^4.2.1", | ||
| "prettier": "^3.2.5", | ||
| "rimraf": "^3.0.2", | ||
| "typescript": "^5.3.3" | ||
| }, | ||
| "ava": { | ||
| "concurrency": 2, | ||
| "files": [ | ||
| "test/**/*.test.ts", | ||
| "!test/externalPlugins/**", | ||
| "!test/collect.test.ts", | ||
| "!test/compress.test.ts", | ||
| "!test/execute.test.ts", | ||
| "!test/helps/**", | ||
| "!test/instructions/**", | ||
| "!test/updateV2.test.ts" | ||
| ], | ||
| "typescript": { | ||
| "compile": false, | ||
| "rewritePaths": { | ||
| "src/": "dist/src/", | ||
| "test/": "dist/test/" | ||
| } | ||
| }, | ||
| "require": [ | ||
| "./test/_ava-setup.js" | ||
| ], | ||
| "timeout": "2m", | ||
| "serial": true | ||
| }, | ||
| "packageManager": "pnpm@8.9.0", | ||
| "dependencies": { | ||
| "@noble/hashes": "^1.3.1", | ||
| "@solana/accounts": "^2.0.0", | ||
| "@solana/addresses": "^2.0.0", | ||
| "@solana/codecs": "^2.0.0", | ||
| "@solana/functional": "^2.0.0", | ||
| "@solana/instructions": "^2.0.0", | ||
| "@solana/keys": "^2.0.0", | ||
| "@solana/kit": "^2.0.0", | ||
| "@solana/rpc": "^2.0.0", | ||
| "@solana/rpc-subscriptions": "^2.0.0", | ||
| "@solana/rpc-types": "^2.0.0", | ||
| "@solana/signers": "^2.0.0", | ||
| "@solana/transaction-messages": "^2.0.0", | ||
| "@solana/transactions": "^2.0.0" | ||
| } | ||
| } |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium test
Copilot Autofix
AI about 2 months ago
To fix the issue, explicitly set the
permissionsblock at the root of the workflow file. The minimum required privilege for this particular workflow—based on its contents (running tests, linting, formatting, checking out code with actions/checkout)—iscontents: read. None of the jobs perform write operations (e.g., pushing code, creating issues, managing pull requests), so restricting theGITHUB_TOKENto only read the repository contents adheres to the principle of least privilege and meets both the security recommendations and the requirements of the workflow.To implement this, insert the following block after the
nameand before or after theon:block:This will apply to all jobs in the workflow, unless overridden in individual jobs (which is not necessary here).
What is needed:
permissions:at the root level of.github/workflows/test-js-kit-client.yml, specifyingcontents: readas the value.