@@ -19,17 +19,30 @@ jobs:
19
19
strategy :
20
20
matrix :
21
21
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 ]
24
24
steps :
25
25
- 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
+
26
37
- name : Setup Anchor
38
+ if : steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
27
39
28
40
with :
29
41
anchor-version : ${{ matrix.anchor-version }}
30
42
solana-cli-version : ${{ matrix.solana-version }}
31
43
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'
33
46
run : |
34
47
solana -V
35
48
solana-keygen new --no-bip39-passphrase
38
51
npm i -g pnpm
39
52
# Run only if it's triggered by PR to main,
40
53
# 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/**'
49
54
- 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'
51
56
run : |
52
57
changed_files=(${{ steps.changes.outputs.anchor_files }})
53
58
91
96
shell : bash
92
97
# Skip Building all Programs if it's a PR to main branch
93
98
- name : Build All Anchor programs
94
- if : github.event_name != 'pull_request '
99
+ if : github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true '
95
100
run : |
96
101
# Find all anchor projects and remove ignored projects
97
102
declare -a ProjectDirs=($(find . -type d -name 'anchor' | sed 's|^\./||'| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
@@ -132,35 +137,38 @@ jobs:
132
137
strategy :
133
138
matrix :
134
139
node-version : [20.x]
135
- solana-version : [1.18.8, beta ]
140
+ solana-version : [1.18.8, stable ]
136
141
anchor-version : [0.30.0]
137
142
steps :
138
143
- 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
139
155
- name : Setup Anchor
156
+ if : steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
140
157
141
158
with :
142
159
anchor-version : ${{ matrix.anchor-version }}
143
160
solana-cli-version : ${{ matrix.solana-version }}
144
161
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'
146
164
run : |
147
165
solana -V
148
166
solana-keygen new --no-bip39-passphrase
149
167
rustc -V
150
168
anchor -V
151
169
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/**'
162
170
- 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'
164
172
run : |
165
173
changed_files=(${{ steps.changes.outputs.anchor_files }})
166
174
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:
192
200
echo "All tests passed."
193
201
fi
194
202
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
196
204
- name : Test All Anchor Programs
197
- if : github.event_name != 'pull_request '
205
+ if : github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true '
198
206
run : |
199
207
declare -a ProjectDirs=($(find . -type d -name "anchor"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
200
208
echo "Projects to Test:"
0 commit comments