diff --git a/.github/workflows/anchor.yml b/.github/workflows/anchor.yml index cfaf5514..291b6e9b 100644 --- a/.github/workflows/anchor.yml +++ b/.github/workflows/anchor.yml @@ -19,17 +19,30 @@ jobs: strategy: matrix: node-version: [20.x] - solana-version: [1.18.8, beta] - anchor-version: [0.30.0] + solana-version: [1.18.8, stable] + anchor-version: [0.30.1] steps: - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + if: github.event_name == 'pull_request' + id: changes + with: + list-files: shell + filters: | + anchor: + - added|modified: '**/anchor/**' + anchor_action: + - added|modified: '**/workflows/anchor.yml' + - name: Setup Anchor + if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule' uses: heyAyushh/setup-anchor@v3.10 with: anchor-version: ${{ matrix.anchor-version }} solana-cli-version: ${{ matrix.solana-version }} node-version: ${{ matrix.node-version }} - - name: Display versions + - name: Display versions and Install pnpm + if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule' run: | solana -V solana-keygen new --no-bip39-passphrase @@ -38,16 +51,8 @@ jobs: npm i -g pnpm # Run only if it's triggered by PR to main, # Build the changed programs - - uses: dorny/paths-filter@v3 - if: github.event_name == 'pull_request' - id: changes - with: - list-files: shell - filters: | - anchor: - - added|modified: '**/anchor/**' - name: Build Changed Anchor programs - if: ${{ steps.changes.outputs.anchor == 'true' }} + if: steps.changes.outputs.anchor == 'true' && steps.changes.outputs.anchor_action != 'true' run: | changed_files=(${{ steps.changes.outputs.anchor_files }}) @@ -91,7 +96,7 @@ jobs: shell: bash # Skip Building all Programs if it's a PR to main branch - name: Build All Anchor programs - if: github.event_name != 'pull_request' + if: github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true' run: | # Find all anchor projects and remove ignored projects declare -a ProjectDirs=($(find . -type d -name 'anchor' | sed 's|^\./||'| grep -v -f <(grep . .github/.ghaignore | grep -v '^$'))) @@ -132,35 +137,38 @@ jobs: strategy: matrix: node-version: [20.x] - solana-version: [1.18.8, beta] + solana-version: [1.18.8, stable] anchor-version: [0.30.0] steps: - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + if: github.event_name == 'pull_request' + id: changes + with: + list-files: shell + filters: | + anchor: + - added|modified: '**/anchor/**' + anchor_action: + - added|modified: '**/workflows/anchor.yml' + # Skip Installing and Displaying versions if theres no change in anchor programs or anchor action workflow file or isn't a schedule event - name: Setup Anchor + if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule' uses: heyAyushh/setup-anchor@v3.10 with: anchor-version: ${{ matrix.anchor-version }} solana-cli-version: ${{ matrix.solana-version }} node-version: ${{ matrix.node-version }} - - name: Display versions + - name: Display versions and Install pnpm + if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule' run: | solana -V solana-keygen new --no-bip39-passphrase rustc -V anchor -V npm i -g pnpm - # Run only if it's triggered by PR to main, - # Test the changed programs (if any) - - uses: dorny/paths-filter@v3 - if: github.event_name == 'pull_request' - id: changes - with: - list-files: shell - filters: | - anchor: - - added|modified: '**/anchor/**' - name: Test Changed Anchor Programs - if: ${{ steps.changes.outputs.anchor == 'true' }} + if: steps.changes.outputs.anchor == 'true' && steps.changes.outputs.anchor_action != 'true' run: | changed_files=(${{ steps.changes.outputs.anchor_files }}) ProjectDirs=($(for file in "${changed_files[@]}"; do dirname "${file}" | grep anchor | sed 's#/anchor/.*#/anchor#g'; done | grep -v -f <(grep . .github/.ghaignore | grep -v '^$') | sort -u)) @@ -192,9 +200,9 @@ jobs: echo "All tests passed." fi shell: bash - # Skip Testing all Programs if it's a PR to main branch + # Skip Testing all Programs if it's a CRON job or a change in the workflow file - name: Test All Anchor Programs - if: github.event_name != 'pull_request' + if: github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true' run: | declare -a ProjectDirs=($(find . -type d -name "anchor"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$'))) echo "Projects to Test:" diff --git a/.github/workflows/solana-native.yml b/.github/workflows/solana-native.yml index 0213b020..b572293b 100644 --- a/.github/workflows/solana-native.yml +++ b/.github/workflows/solana-native.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: node-version: [20.x] - solana-version: [stable, beta] + solana-version: [stable] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} @@ -67,7 +67,7 @@ jobs: strategy: matrix: node-version: [20.x] - solana-version: [1.17.25, stable, beta] + solana-version: [1.17.25, stable] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} diff --git a/basics/hello-solana/anchor/tests/test.ts b/basics/hello-solana/anchor/tests/test.ts index e422346e..a563837e 100644 --- a/basics/hello-solana/anchor/tests/test.ts +++ b/basics/hello-solana/anchor/tests/test.ts @@ -1,5 +1,5 @@ import * as anchor from '@coral-xyz/anchor'; -import type { HelloSolana } from '../target/types/hello_solana'; +import { HelloSolana } from '../target/types/hello_solana'; describe('hello-solana', () => { // Configure the Anchor provider & load the program IDL diff --git a/biome.json b/biome.json index 2671cd2d..a7cf5f06 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.8.1/schema.json", "organizeImports": { "enabled": true }, @@ -13,7 +13,8 @@ "noExportsInTest": "warn" }, "style": { - "noParameterAssign": "warn" + "noParameterAssign": "warn", + "useImportType": "off" }, "complexity": { "noForEach": "warn", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 699b5ee1..656fd067 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,203 +1,147 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -devDependencies: - '@biomejs/biome': - specifier: 1.8.1 - version: 1.8.1 - '@types/node': - specifier: ^20.9.0 - version: 20.14.2 - husky: - specifier: ^9.0.11 - version: 9.0.11 - picocolors: - specifier: ^1.0.0 - version: 1.0.1 - ts-node: - specifier: ^10.9.1 - version: 10.9.2(@types/node@20.14.2)(typescript@5.4.5) - typescript: - specifier: ^5.2.2 - version: 5.4.5 +importers: + + .: + devDependencies: + '@biomejs/biome': + specifier: 1.8.1 + version: 1.8.1 + '@types/node': + specifier: ^20.9.0 + version: 20.14.2 + husky: + specifier: ^9.0.11 + version: 9.0.11 + picocolors: + specifier: ^1.0.0 + version: 1.0.1 + ts-node: + specifier: ^10.9.1 + version: 10.9.2(@types/node@20.14.2)(typescript@5.4.5) + typescript: + specifier: ^5.2.2 + version: 5.4.5 packages: - /@biomejs/biome@1.8.1: + '@biomejs/biome@1.8.1': resolution: {integrity: sha512-fQXGfvq6DIXem12dGQCM2tNF+vsNHH1qs3C7WeOu75Pd0trduoTmoO7G4ntLJ2qDs5wuw981H+cxQhi1uHnAtA==} engines: {node: '>=14.21.3'} hasBin: true - requiresBuild: true - optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.8.1 - '@biomejs/cli-darwin-x64': 1.8.1 - '@biomejs/cli-linux-arm64': 1.8.1 - '@biomejs/cli-linux-arm64-musl': 1.8.1 - '@biomejs/cli-linux-x64': 1.8.1 - '@biomejs/cli-linux-x64-musl': 1.8.1 - '@biomejs/cli-win32-arm64': 1.8.1 - '@biomejs/cli-win32-x64': 1.8.1 - dev: true - /@biomejs/cli-darwin-arm64@1.8.1: + '@biomejs/cli-darwin-arm64@1.8.1': resolution: {integrity: sha512-XLiB7Uu6GALIOBWzQ2aMD0ru4Ly5/qSeQF7kk3AabzJ/kwsEWSe33iVySBP/SS2qv25cgqNiLksjGcw2bHT3mw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-darwin-x64@1.8.1: + '@biomejs/cli-darwin-x64@1.8.1': resolution: {integrity: sha512-uMTSxVLMfqkBVqyc25hSn83jBbp+wtWjzM/pHFlKXt3htJuw7FErVGW0nmQ9Sxa9vJ7GcqoltLMl28VQRIMYzg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-linux-arm64-musl@1.8.1: + '@biomejs/cli-linux-arm64-musl@1.8.1': resolution: {integrity: sha512-UQ8Wc01J0wQL+5AYOc7qkJn20B4PZmQL1KrmDZh7ot0DvD6aX4+8mmfd/dG5b6Zjo/44QvCKcvkFGCMRYuhWZA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-linux-arm64@1.8.1: + '@biomejs/cli-linux-arm64@1.8.1': resolution: {integrity: sha512-3SzZRuC/9Oi2P2IBNPsEj0KXxSXUEYRR2kfRF/Ve8QAfGgrt4qnwuWd6QQKKN5R+oYH691qjm+cXBKEcrP1v/Q==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-linux-x64-musl@1.8.1: + '@biomejs/cli-linux-x64-musl@1.8.1': resolution: {integrity: sha512-fYbP/kNu/rtZ4kKzWVocIdqZOtBSUEg9qUhZaao3dy3CRzafR6u6KDtBeSCnt47O+iLnks1eOR1TUxzr5+QuqA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-linux-x64@1.8.1: + '@biomejs/cli-linux-x64@1.8.1': resolution: {integrity: sha512-AeBycVdNrTzsyYKEOtR2R0Ph0hCD0sCshcp2aOnfGP0hCZbtFg09D0SdKLbyzKntisY41HxKVrydYiaApp+2uw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-win32-arm64@1.8.1: + '@biomejs/cli-win32-arm64@1.8.1': resolution: {integrity: sha512-6tEd1H/iFKpgpE3OIB7oNgW5XkjiVMzMRPL8zYoZ036YfuJ5nMYm9eB9H/y81+8Z76vL48fiYzMPotJwukGPqQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@biomejs/cli-win32-x64@1.8.1: + '@biomejs/cli-win32-x64@1.8.1': resolution: {integrity: sha512-g2H31jJzYmS4jkvl6TiyEjEX+Nv79a5km/xn+5DARTp5MBFzC9gwceusSSB2AkJKqZzY131AiACAWjKrVt5Ijw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] - requiresBuild: true - dev: true - optional: true - /@cspotcode/source-map-support@0.8.1: + '@cspotcode/source-map-support@0.8.1': resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - dev: true - /@jridgewell/resolve-uri@3.1.2: + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} - dev: true - /@jridgewell/sourcemap-codec@1.4.15: + '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: true - /@jridgewell/trace-mapping@0.3.9: + '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 - dev: true - /@tsconfig/node10@1.0.11: + '@tsconfig/node10@1.0.11': resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - dev: true - /@tsconfig/node12@1.0.11: + '@tsconfig/node12@1.0.11': resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: true - /@tsconfig/node14@1.0.3: + '@tsconfig/node14@1.0.3': resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: true - /@tsconfig/node16@1.0.4: + '@tsconfig/node16@1.0.4': resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - dev: true - /@types/node@20.14.2: + '@types/node@20.14.2': resolution: {integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==} - dependencies: - undici-types: 5.26.5 - dev: true - /acorn-walk@8.3.2: + acorn-walk@8.3.2: resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} engines: {node: '>=0.4.0'} - dev: true - /acorn@8.11.3: + acorn@8.11.3: resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} engines: {node: '>=0.4.0'} hasBin: true - dev: true - /arg@4.1.3: + arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: true - /create-require@1.1.1: + create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - dev: true - /diff@4.0.2: + diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} - dev: true - /husky@9.0.11: + husky@9.0.11: resolution: {integrity: sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==} engines: {node: '>=18'} hasBin: true - dev: true - /make-error@1.3.6: + make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: true - /picocolors@1.0.1: + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} - dev: true - /ts-node@10.9.2(@types/node@20.14.2)(typescript@5.4.5): + ts-node@10.9.2: resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -210,6 +154,101 @@ packages: optional: true '@swc/wasm': optional: true + + typescript@5.4.5: + resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + + v8-compile-cache-lib@3.0.1: + resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + + yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + +snapshots: + + '@biomejs/biome@1.8.1': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.8.1 + '@biomejs/cli-darwin-x64': 1.8.1 + '@biomejs/cli-linux-arm64': 1.8.1 + '@biomejs/cli-linux-arm64-musl': 1.8.1 + '@biomejs/cli-linux-x64': 1.8.1 + '@biomejs/cli-linux-x64-musl': 1.8.1 + '@biomejs/cli-win32-arm64': 1.8.1 + '@biomejs/cli-win32-x64': 1.8.1 + + '@biomejs/cli-darwin-arm64@1.8.1': + optional: true + + '@biomejs/cli-darwin-x64@1.8.1': + optional: true + + '@biomejs/cli-linux-arm64-musl@1.8.1': + optional: true + + '@biomejs/cli-linux-arm64@1.8.1': + optional: true + + '@biomejs/cli-linux-x64-musl@1.8.1': + optional: true + + '@biomejs/cli-linux-x64@1.8.1': + optional: true + + '@biomejs/cli-win32-arm64@1.8.1': + optional: true + + '@biomejs/cli-win32-x64@1.8.1': + optional: true + + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/sourcemap-codec@1.4.15': {} + + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + + '@tsconfig/node10@1.0.11': {} + + '@tsconfig/node12@1.0.11': {} + + '@tsconfig/node14@1.0.3': {} + + '@tsconfig/node16@1.0.4': {} + + '@types/node@20.14.2': + dependencies: + undici-types: 5.26.5 + + acorn-walk@8.3.2: {} + + acorn@8.11.3: {} + + arg@4.1.3: {} + + create-require@1.1.1: {} + + diff@4.0.2: {} + + husky@9.0.11: {} + + make-error@1.3.6: {} + + picocolors@1.0.1: {} + + ts-node@10.9.2(@types/node@20.14.2)(typescript@5.4.5): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 @@ -226,23 +265,11 @@ packages: typescript: 5.4.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - dev: true - /typescript@5.4.5: - resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} - engines: {node: '>=14.17'} - hasBin: true - dev: true + typescript@5.4.5: {} - /undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - dev: true + undici-types@5.26.5: {} - /v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: true + v8-compile-cache-lib@3.0.1: {} - /yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - dev: true + yn@3.1.1: {}