Skip to content

Commit 6cff29c

Browse files
authored
feat: bump anchor action to 0.30.1 (#95)
* fix: changes in action should build all projects on the PR itself * fix: remove import type in hello-solana anchor till it's fixed in solpg * fix: biome schema and config * removed beta version, added anchor action changes
1 parent 82e5f16 commit 6cff29c

File tree

5 files changed

+191
-155
lines changed

5 files changed

+191
-155
lines changed

.github/workflows/anchor.yml

+36-28
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,30 @@ jobs:
1919
strategy:
2020
matrix:
2121
node-version: [20.x]
22-
solana-version: [1.18.8, beta]
23-
anchor-version: [0.30.0]
22+
solana-version: [1.18.8, stable]
23+
anchor-version: [0.30.1]
2424
steps:
2525
- uses: actions/checkout@v4
26+
- uses: dorny/paths-filter@v3
27+
if: github.event_name == 'pull_request'
28+
id: changes
29+
with:
30+
list-files: shell
31+
filters: |
32+
anchor:
33+
- added|modified: '**/anchor/**'
34+
anchor_action:
35+
- added|modified: '**/workflows/anchor.yml'
36+
2637
- name: Setup Anchor
38+
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
2739
uses: heyAyushh/[email protected]
2840
with:
2941
anchor-version: ${{ matrix.anchor-version }}
3042
solana-cli-version: ${{ matrix.solana-version }}
3143
node-version: ${{ matrix.node-version }}
32-
- name: Display versions
44+
- name: Display versions and Install pnpm
45+
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
3346
run: |
3447
solana -V
3548
solana-keygen new --no-bip39-passphrase
@@ -38,16 +51,8 @@ jobs:
3851
npm i -g pnpm
3952
# Run only if it's triggered by PR to main,
4053
# Build the changed programs
41-
- uses: dorny/paths-filter@v3
42-
if: github.event_name == 'pull_request'
43-
id: changes
44-
with:
45-
list-files: shell
46-
filters: |
47-
anchor:
48-
- added|modified: '**/anchor/**'
4954
- name: Build Changed Anchor programs
50-
if: ${{ steps.changes.outputs.anchor == 'true' }}
55+
if: steps.changes.outputs.anchor == 'true' && steps.changes.outputs.anchor_action != 'true'
5156
run: |
5257
changed_files=(${{ steps.changes.outputs.anchor_files }})
5358
@@ -91,7 +96,7 @@ jobs:
9196
shell: bash
9297
# Skip Building all Programs if it's a PR to main branch
9398
- name: Build All Anchor programs
94-
if: github.event_name != 'pull_request'
99+
if: github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true'
95100
run: |
96101
# Find all anchor projects and remove ignored projects
97102
declare -a ProjectDirs=($(find . -type d -name 'anchor' | sed 's|^\./||'| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
@@ -132,35 +137,38 @@ jobs:
132137
strategy:
133138
matrix:
134139
node-version: [20.x]
135-
solana-version: [1.18.8, beta]
140+
solana-version: [1.18.8, stable]
136141
anchor-version: [0.30.0]
137142
steps:
138143
- uses: actions/checkout@v4
144+
- uses: dorny/paths-filter@v3
145+
if: github.event_name == 'pull_request'
146+
id: changes
147+
with:
148+
list-files: shell
149+
filters: |
150+
anchor:
151+
- added|modified: '**/anchor/**'
152+
anchor_action:
153+
- added|modified: '**/workflows/anchor.yml'
154+
# Skip Installing and Displaying versions if theres no change in anchor programs or anchor action workflow file or isn't a schedule event
139155
- name: Setup Anchor
156+
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
140157
uses: heyAyushh/[email protected]
141158
with:
142159
anchor-version: ${{ matrix.anchor-version }}
143160
solana-cli-version: ${{ matrix.solana-version }}
144161
node-version: ${{ matrix.node-version }}
145-
- name: Display versions
162+
- name: Display versions and Install pnpm
163+
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
146164
run: |
147165
solana -V
148166
solana-keygen new --no-bip39-passphrase
149167
rustc -V
150168
anchor -V
151169
npm i -g pnpm
152-
# Run only if it's triggered by PR to main,
153-
# Test the changed programs (if any)
154-
- uses: dorny/paths-filter@v3
155-
if: github.event_name == 'pull_request'
156-
id: changes
157-
with:
158-
list-files: shell
159-
filters: |
160-
anchor:
161-
- added|modified: '**/anchor/**'
162170
- name: Test Changed Anchor Programs
163-
if: ${{ steps.changes.outputs.anchor == 'true' }}
171+
if: steps.changes.outputs.anchor == 'true' && steps.changes.outputs.anchor_action != 'true'
164172
run: |
165173
changed_files=(${{ steps.changes.outputs.anchor_files }})
166174
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:
192200
echo "All tests passed."
193201
fi
194202
shell: bash
195-
# Skip Testing all Programs if it's a PR to main branch
203+
# Skip Testing all Programs if it's a CRON job or a change in the workflow file
196204
- name: Test All Anchor Programs
197-
if: github.event_name != 'pull_request'
205+
if: github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true'
198206
run: |
199207
declare -a ProjectDirs=($(find . -type d -name "anchor"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
200208
echo "Projects to Test:"

.github/workflows/solana-native.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
node-version: [20.x]
20-
solana-version: [stable, beta]
20+
solana-version: [stable]
2121
steps:
2222
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
@@ -67,7 +67,7 @@ jobs:
6767
strategy:
6868
matrix:
6969
node-version: [20.x]
70-
solana-version: [1.17.25, stable, beta]
70+
solana-version: [1.17.25, stable]
7171
steps:
7272
- uses: actions/checkout@v4
7373
- name: Use Node.js ${{ matrix.node-version }}

basics/hello-solana/anchor/tests/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as anchor from '@coral-xyz/anchor';
2-
import type { HelloSolana } from '../target/types/hello_solana';
2+
import { HelloSolana } from '../target/types/hello_solana';
33

44
describe('hello-solana', () => {
55
// Configure the Anchor provider & load the program IDL

biome.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
33
"organizeImports": {
44
"enabled": true
55
},
@@ -13,7 +13,8 @@
1313
"noExportsInTest": "warn"
1414
},
1515
"style": {
16-
"noParameterAssign": "warn"
16+
"noParameterAssign": "warn",
17+
"useImportType": "off"
1718
},
1819
"complexity": {
1920
"noForEach": "warn",

0 commit comments

Comments
 (0)