-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (134 loc) · 4.45 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Tests
on:
pull_request:
push:
branches:
- main
- feat/**/*
concurrency:
group: ${{ github.ref }}-program-tests
cancel-in-progress: true
jobs:
unit-tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: metaplex-foundation/actions/install-rust@v1
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "unit-tests"
- run: cargo test
build-deps:
runs-on: ubuntu-20.04
steps:
- name: Setup | checkout
uses: actions/checkout@v3
- name: Setup | rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "integration-tests"
shared-key: "integration-tests"
- name: Setup | cache crates
uses: metaplex-foundation/actions/cache-crates@v1
- name: Setup | node
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "yarn"
- name: Setup | rust
uses: metaplex-foundation/actions/install-rust@v1
- name: Setup | anchor
run: npm i -g @coral-xyz/anchor-cli@0.28.0
- name: Setup | solana
uses: metaplex-foundation/actions/install-solana@v1
with:
version: 1.16.10
cache: true
- name: Setup | yarn deps
run: |
yarn config set -H enableImmutableInstalls false
yarn install
- name: Build Programs
run: anchor build
program-integration-tests:
needs: ["build-deps"]
runs-on: ubuntu-20.04
strategy:
matrix:
test:
[
{
scope: "program-tests/pre-authorized-debit-v1",
testSuffix: "**/*test.ts",
},
{
scope: "program-tests/pre-authorized-debit-v1",
testSuffix: "**/*test.2.ts",
},
{
scope: "program-tests/pre-authorized-debit-v1",
testSuffix: "**/debit/*.test.ts",
},
{
scope: "sdk/pre-authorized-debit-v1",
testSuffix: "tests/**/*.test.ts",
},
]
steps:
- name: Setup | checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.pat_github }}
- name: Setup | rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "integration-tests"
shared-key: "integration-tests"
- name: Setup | cache crates
uses: metaplex-foundation/actions/cache-crates@v1
- name: Setup | node
uses: actions/setup-node@v3
with:
node-version: 18.17.1
cache: "yarn"
- name: Setup | rust
uses: metaplex-foundation/actions/install-rust@v1
- name: Setup | anchor
run: npm i -g @coral-xyz/anchor-cli@0.28.0
- name: Setup | solana
uses: metaplex-foundation/actions/install-solana@v1
with:
version: 1.16.10
cache: true
- name: Setup | solana keypair
run: solana-keygen new --no-bip39-passphrase
- name: Setup | solaan url
run: solana config set --url http:localhost:8899
- name: Setup | yarn deps
run: |
yarn config set -H enableImmutableInstalls false
yarn install
# - name: Setup | package deps
# run: cd ${{ matrix.test.scope }} && yarn install
- name: Test
env:
DEVNET_VALIDATOR_URL: ${{ secrets.DEVNET_VALIDATOR_URL }}
MAINNET_VALIDATOR_URL: ${{ secrets.MAINNET_VALIDATOR_URL }}
run: anchor test ${{ matrix.test.scope }} ${{ matrix.test.testSuffix }}
- name: Test | delete remote badges branch
if: ${{ github.ref == 'refs/heads/main' && contains(matrix.test.scope, 'sdk') }}
run: git push origin --delete ${{ matrix.test.scope }}/ci-badges
- name: Test | create badges branch
if: ${{ github.ref == 'refs/heads/main' && contains(matrix.test.scope, 'sdk') }}
run: git checkout -b ${{ matrix.test.scope }}/ci-badges
- name: Test | code coverage
if: ${{ github.ref == 'refs/heads/main' && contains(matrix.test.scope, 'sdk') }}
uses: jpb06/jest-badges-action@latest
with:
coverage-summary-path: ./${{ matrix.test.scope }}/coverage/coverage-summary.json
branches: main
commit-user: Seabed Devtools
commit-user-email: devtools@dcaf.so
output-folder: ./${{ matrix.test.scope }}/badges
target-branch: ${{ matrix.test.scope }}/ci-badges