Skip to content

Commit 0131e6c

Browse files
authored
fix: ci fails on prs from external forks (#1030)
1 parent cb48c85 commit 0131e6c

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ yarn run lint
7979

8080
### Test
8181

82+
Disable API tests OR define all required explorer API keys.
83+
84+
```bash
85+
export DISABLE_API_TESTS=1
86+
# OR
87+
export EXPLORER_API_KEY_MAINNET=
88+
export EXPLORER_API_KEY_RINKEBY=
89+
export EXPLORER_API_KEY_FUSE=
90+
export EXPLORER_API_KEY_MATIC=
91+
export EXPLORER_API_KEY_FANTOM=
92+
```
93+
8294
Test all the packages in the monorepo.
8395

8496
```bash

packages/payment-detection/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,21 @@ The code generation is included in the pre-build script and can be run manually:
6464
```
6565
yarn codegen
6666
```
67+
68+
# Test
69+
70+
The ETH `InfoRetriever` tests require explorer API keys. Before running the
71+
payment-detection tests, define `DISABLE_API_TESTS` or define all required
72+
explorer API keys.
73+
74+
```bash
75+
export DISABLE_API_TESTS=1
76+
# OR
77+
export EXPLORER_API_KEY_MAINNET=
78+
export EXPLORER_API_KEY_RINKEBY=
79+
export EXPLORER_API_KEY_FUSE=
80+
export EXPLORER_API_KEY_MATIC=
81+
export EXPLORER_API_KEY_FANTOM=
82+
83+
yarn run test
84+
```

packages/payment-detection/test/eth/info-retriever.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ describe('api/eth/info-retriever', () => {
4545
await expect(infoRetreiver.getTransferEvents()).rejects.toThrowError();
4646
});
4747

48-
describe('Multichain', () => {
48+
// Utility for conditionally skipping tests
49+
const describeIf = (
50+
condition: any,
51+
...args: [string | number | Function | jest.FunctionLike, jest.EmptyFunction]
52+
) => (condition ? describe(...args) : describe.skip(...args));
53+
54+
// Skip tests if build is from external fork or API tests are disabled
55+
// External forks cannot access secret API keys
56+
describeIf(!process.env.CIRCLE_PR_NUMBER && !process.env.DISABLE_API_TESTS, 'Multichain', () => {
4957
// TODO temporary disable xDAI, CELO, Sokol, and Goerli
5058
// FIXME: API-based checks should run nightly and be mocked for CI
5159
[

0 commit comments

Comments
 (0)