From 49b82cbcd4b92c9fe5dfa5b8363b6fe8fca32256 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Tue, 17 Jan 2023 19:58:43 +0200 Subject: [PATCH] ci: expose env vars in GitHub workflow test: add explanatory code comments in fork test --- .github/workflows/ci.yml | 4 ++++ test/Foo.t.sol | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45a9a2f..478c72f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,11 @@ name: "CI" env: + ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} + ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} FOUNDRY_PROFILE: "ci" + INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} + MNEMONIC: ${{ secrets.MNEMONIC }} on: pull_request: diff --git a/test/Foo.t.sol b/test/Foo.t.sol index 75acaf2..ec81ca2 100644 --- a/test/Foo.t.sol +++ b/test/Foo.t.sol @@ -33,9 +33,12 @@ contract FooTest is PRBTest, StdCheats { /// for this test to run - you can get an API key for free at https://alchemy.com. function testFork_Example() external { string memory alchemyApiKey = vm.envOr("ALCHEMY_API_KEY", string("")); + // Silently pass this test if the user didn't define the API key. if (bytes(alchemyApiKey).length == 0) { return; } + + // Run the test normally, otherwise. vm.createSelectFork({urlOrAlias: "ethereum", blockNumber: 16_428_000}); address usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address holder = 0x7713974908Be4BEd47172370115e8b1219F4A5f0;