Skip to content

Commit eaba9d9

Browse files
committed
make run tests reusable
1 parent ff1da65 commit eaba9d9

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Reusable Test Program
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
program:
7+
description: "Program to test"
8+
required: true
9+
type: string
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- uses: ./.github/actions/extract-versions/
18+
id: versions
19+
20+
- uses: ./.github/actions/setup/
21+
22+
- name: Install Solana
23+
uses: ./.github/actions/setup-solana
24+
25+
- name: Install Anchor
26+
uses: ./.github/actions/setup-anchor
27+
with:
28+
anchor-version: ${{ env.ANCHOR_VERSION }}
29+
30+
- name: Run Tests
31+
env:
32+
CARGO_NET_GIT_FETCH_WITH_CLI: true
33+
CARGO_NET_RETRY: 10
34+
RUST_BACKTRACE: 1
35+
run: |
36+
echo "Running tests for program: ${{ inputs.program }}"
37+
anchor test

.github/workflows/test.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ on:
1818

1919
jobs:
2020
test:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- uses: actions/checkout@v3
24-
25-
- uses: ./.github/actions/run-tests/
26-
with:
27-
program: ${{ github.event.inputs.program }}
21+
uses: ./.github/workflows/reusable_test.yaml
22+
with:
23+
program: ${{ github.event.inputs.program || 'transaction_example' }}

0 commit comments

Comments
 (0)