0
0
Blockchain / Solidityprogramming~10 mins

CI/CD for smart contracts in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a GitHub Actions workflow that triggers on push to the main branch.

Blockchain / Solidity
on: [1]
jobs:
  build:
    runs-on: ubuntu-latest
Drag options to blanks, or click blank then click option'
Apush
Bpull_request
Cschedule
Drelease
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pull_request' instead of 'push' triggers workflow on PRs, not code pushes.
Using 'schedule' runs on a timer, not on code changes.
2fill in blank
medium

Complete the code to install the Solidity compiler in the CI job.

Blockchain / Solidity
steps:
  - name: Install Solidity
    run: npm install -g [1]
Drag options to blanks, or click blank then click option'
Atruffle
Bsolc
Csolidity
Dganache
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'truffle' or 'ganache' which are frameworks or test environments, not the compiler.
Using 'solidity' which is not the npm package name.
3fill in blank
hard

Fix the error in the deployment script command to deploy the smart contract using Hardhat.

Blockchain / Solidity
npx hardhat [1] --network rinkeby
Drag options to blanks, or click blank then click option'
Arun
Btest
Ccompile
Ddeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'deploy' which is not a built-in Hardhat command.
Using 'compile' or 'test' which do not deploy contracts.
4fill in blank
hard

Fill both blanks to create a GitHub Actions step that runs tests and reports coverage.

Blockchain / Solidity
- name: Run tests and coverage
  run: npx hardhat [1] && npx [2]
Drag options to blanks, or click blank then click option'
Atest
Bsolidity-coverage
Ccompile
Dlint
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'compile' or 'lint' instead of 'test' for running tests.
Using 'hardhat' commands that do not generate coverage.
5fill in blank
hard

Fill all three blanks to define environment variables for deployment in GitHub Actions.

Blockchain / Solidity
env:
  PRIVATE_KEY: ${{ secrets.[1] }}
  INFURA_API_KEY: ${{ secrets.[2] }}
  ETHERSCAN_API_KEY: ${{ secrets.[3] }}
Drag options to blanks, or click blank then click option'
ADEPLOYER_PRIVATE_KEY
BINFURA_KEY
CETHERSCAN_KEY
DAPI_SECRET
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic or incorrect secret names like 'API_SECRET'.
Mixing up the keys for Infura and Etherscan.