Skip to content

Commit 7968e3f

Browse files
committed
Add features to anchor test and anchor build
1 parent 7fe9a45 commit 7968e3f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/actions/build-anchor/action.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
name: "Build Anchor"
22
description: "Build Anchor"
33
inputs:
4-
testing:
5-
description: "Whether to run tests"
6-
required: false
7-
default: "true"
84
program:
95
description: "Program to build"
106
required: true
7+
features:
8+
description: "Features that will be passed into the build"
9+
required: false
1110
runs:
1211
using: "composite"
1312
steps:
1413
- name: Build Program
1514
shell: bash
1615
run: |
1716
echo "Building Anchor program: ${{ inputs.program }} to get IDL"
18-
anchor build -p ${{ inputs.program }}
17+
FEATURES="${{ inputs.features }}"
18+
if [ ! -z "$FEATURES" ]; then
19+
FEATURES="--features $FEATURES"
20+
fi
21+
22+
anchor build -p ${{ inputs.program }} -- $FEATURES
1923
- name: Copy artifacts from container
2024
shell: bash
2125
run: |

.github/actions/run-tests/action.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
program:
55
description: "Program to test"
66
required: true
7+
features:
8+
description: "Features that will be passed into the test"
9+
required: false
710

811
runs:
912
using: "composite"
@@ -37,7 +40,12 @@ runs:
3740
RUST_BACKTRACE: 1
3841
run: |
3942
echo "Running tests for program: ${{ inputs.program }}"
40-
anchor test
43+
FEATURES="${{ inputs.features }}"
44+
if [ ! -z "$FEATURES" ]; then
45+
FEATURES="--features $FEATURES"
46+
fi
47+
48+
anchor test -- $FEATURES
4149
4250
- name: Check Test Results
4351
if: ${{ failure() }}

0 commit comments

Comments
 (0)