@@ -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/setup-anchor@v3.10
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
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
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/setup-anchor@v3.10
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:"
0 commit comments