-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add job deploying contracts from dapp-development
branch
#119
Conversation
There are situations when team developing T Token Dashboard needs to locally test some functionalities using modified contracts, for example ones with shorter authorization decrease delay. We decided to create a `dapp-development` branch in each of the upstream modules of `threshold-network/token-dashboard` CI module, which would store the code of these modified contracts. In this PR we create a `contracts-dapp-development-deployment-testnet` job which deploys the contracts, creates an NPM package (with `dappdev<environment>` suffix an `dapp-development-<environment>` tag) and publishes it to the NPM registry. At the end, the job also starts similar deployment for a downstream module. The job gets triggered only as a result of `workflow_dispath` event from a `dapp-development` branch. Currently only `goerli` environment is supported. We don't run system and unit tests for `dapp-development` branch, as the tests are not configured to work with the modified contracts. Generally, the goal of the changes is to have the full set of dapp-development-friendly contracts deployed to the NPM registry, so that the dApp developers could quickly use them by upgrading the `token-dashboard` dependencies using `yarn upgrade <package-name>@dapp-development-goerli`. If the workflow gets dispatched from a different branch than `dapp-development`, the deploy will behave as it used to, publishing package with deployed unmodified contracts to the NPM registry under `<environment>` tag.
url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
environment: ${{ github.event.inputs.environment }} | ||
upstream_builds: ${{ github.event.inputs.upstream_builds }} | ||
upstream_ref: dapp-development |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered whether to use explicit value (dapp-development
) here, or ${{ github.event.inputs.upstream_ref }}
. Decided to use the former - it gives us less flexibility, but the general intention is that we always want to run the downstream modules on the same dapp-development
branch. And by hardcoding it, we avoid the nasty consequences of the situation when somebody triggers the workflow from dapp-development
branch, but with upstream_ref
set to a different branch (which, if not for the harcoded value, would result in triggering of a downstream workflow from that different branch, resulting in publishing of goerli
-tagged package that uses modified contracts in it's dependencies) .
I dry-runned the workflow here: https://github.com/threshold-network/solidity-contracts/runs/7561186309?check_suite_focus=true. The workflow passed, but I noticed two things that seem strange to me:
Without the step that runs the script preparing that config, the file should not exist and Tenderly should not be able to authorize. But from the logs we see that it does. Either the plugin documentation is incomplete or I'm missing something...
|
78b2e3c
to
bb47f4f
Compare
Right now we only support `goerli` network and we expect that the workflow (when triggered manually) is always dispatched with this `environment`. Previously we introduced `github.event.inputs.environment == 'goerli'` condition to not run the deploy job if workflow gets accidentally run on a different environment. But even without this condition we don't risk publishing of a package with some invalid contracts - deploy will fail either due to unsupported `environment` or due to incorrect account being used. Actually, returning error instead of cleanly exiting the workflow may be a better idea in case wrong `environment` is provided - this will alarm the scheduler that something went wrong with the deployment.
The contracts deployed in the `contracts-dapp-development-deployment-testnet` job will be used by dApp developers to build their local environments and deploy dApp previews. We want more flexibility there than on the public-facing testnet dApp and we want to use different deployer accounts for those two different types of testnet dApps.
There are newer versions of some actions available.
I tested the deployment again, this time on a branch being combination of changes from #119 and #118 (+ some small changes in workflows to allow for testing). Deployment has failed due to an issue in one of the modified deployment scripts, which I described in https://github.com/threshold-network/solidity-contracts/pull/118/files#r943208193. |
The problem with the deployment script got fixed. I verified the #118 + #119 again, works as expected. Workflow run: https://github.com/threshold-network/solidity-contracts/runs/7801852357?check_suite_focus=true. |
# branch, which are slightly modified to help with the process of testing some | ||
# features on the Threshold Token dApp. The job starts only if workflow gets | ||
# triggered by the `workflow_dispatch` event on the branch `dapp-development`. | ||
contracts-dapp-development-deployment-testnet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether common parts of contracts-deployment-testnet
and contracts-dapp-development-deployment-testnet
could be extracted to a reusable workflow or action. But this is something that could be handled in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely something we could do! There's more places in our workflows where using custom actions or reusable workflows could be useful. Let's not wait for these improvements to not postpone the merge. I will refactor the workflow in the future.
We don't want to fill the default value with value that is supported, to prevent from accidental dispatches of the workflow by people who don't fully understand how the inputs should be configured. Previously we used explicitely incorrect default value, but that may be too much and may be a bit confusing. Let's leave the input without default.
Previously `-` was not supported as a value of `environment` property in the `npm-version-bump` action. Now action supports hyphens and we can change the suffix to more readible format.
There are situations when team developing T Token Dashboard needs to
locally test some functionalities using modified contracts, for example
ones with shorter authorization decrease delay. We decided to create a
dapp-development
branch in each of the upstream modules ofthreshold-network/token-dashboard
CI module, which would store thecode of these modified contracts. In this PR we create a
contracts-dapp-development-deployment-testnet
job which deploys thecontracts, creates an NPM package (with
dappdev<environment>
suffixan
dapp-development-<environment>
tag) and publishes it to the NPMregistry. At the end, the job also starts similar deployment for a
downstream module. The job gets triggered only as a result of
workflow_dispath
event from adapp-development
branch. Currentlyonly
goerli
environment is supported. We don't run system and unittests for
dapp-development
branch, as the tests are not configured towork with the modified contracts.
Generally, the goal of the changes is to have the full set of
dapp-development-friendly contracts deployed to the NPM registry, so
that the dApp developers could quickly use them by upgrading the
token-dashboard
dependencies usingyarn upgrade <package-name>@dapp-development-goerli
.If the workflow gets dispatched from a different branch than
dapp-development
, the deploy will behave as it used to, publishingpackage with deployed unmodified contracts to the NPM registry under
<environment>
tag.TODO:
contracts-dapp-development-deployment-testnet
jobdapp-development
branch #119 and [Do not merge] dApp-friendly contract deployment #118 (dapp-development
branch)Refs:
threshold-network/token-dashboard#136
keep-network/keep-core#3121
keep-network/tbtc-v2#392