ci: expose env vars in GitHub workflow

test: add explanatory code comments in fork test
This commit is contained in:
Paul Razvan Berg 2023-01-17 19:58:43 +02:00
parent 0efda5eabb
commit 49b82cbcd4
No known key found for this signature in database
GPG Key ID: BCC366159BD63828
2 changed files with 7 additions and 0 deletions

View File

@ -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:

View File

@ -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;