Skip to content

Commit cfb9abf

Browse files
Build previews using dapp-development tagged packages
BACKGROUND: 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 expected upstream modules of the `threshold-network/token-dashboard` CI module, which would store the code of these modified contracts. (Although currently there's no `@keep-network/random-beacon`, `@keep-network/ecdsa` and `@keep-network/tbtc-v2` dependencies in the T dashboard yet, they're expected to be added soon and we are already preparing for that). Repositories with `dapp-development` branch containing modified contracts: `threshold-network/solidity-contracts` `keep-network/keep-core` `keep-network/tbtc-v2` Using the code from the `dapp-development` branch we will build packages that will be published to the NPM registry under `dapp-development-<environment>` tag and with `dappdev<environment>` suffix (`<environment>` currently being `goerli`). Generally, the goal of the changes is to have the full set of dapp-development-friendly contracts deployed to the NPM registry, so that they could be used to create dApp previews that will be easily testable. The dApp developers could also use the contracts to build dashboard on their local envirionment by upgrading the `token-dashboard` dependencies using `yarn upgrade <package-name>@dapp-development-goerli`. THIS CHANGE: In this commit/PR we modify the GH Actions job which is used for publishing of the testnet dashboard to the main and preview testnet buckets. We're splitting this job into two separate jobs: - `build-and-deploy-testnet`: Executed after merges to `main` or when dispatched manually. Uses unmodified contracts (tagged `goerli`). Publishes testnet dApp to `dashboard.test.threshold.network` bucket. - `build-and-deploy-testnet-preview`: Executed after PR creation/update. Uses modified contracts when availible (tagged `dappdevgoerli`). Publishes testnet dApp to `preview.dashboard.test.threshold.network` bucket. Provides link to the preview in PR comment.
1 parent 18c1564 commit cfb9abf

File tree

1 file changed

+58
-12
lines changed

1 file changed

+58
-12
lines changed

.github/workflows/dashboard-ci.yaml

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ jobs:
5555
- name: Configure git to don't use unauthenticated protocol
5656
run: git config --global url."https://".insteadOf git://
5757

58+
# TODO: Add upgrade of @keep-network/random-beacon, @keep-network/ecdsa,
59+
# @keep-network/tbtc-v2 once they'll be added as dashboard's dependencies.
5860
- name: Resolve latest contracts
5961
run: |
6062
yarn upgrade \
@@ -80,9 +82,10 @@ jobs:
8082
# - name: Test
8183
# run: yarn test
8284

83-
build-and-deploy-testnet:
85+
build-and-deploy-testnet-preview:
8486
name: Deploy to testnet
8587
needs: build-and-test
88+
if: github.event_name == 'pull_request'
8689
runs-on: ubuntu-latest
8790
steps:
8891
- uses: actions/checkout@v2
@@ -103,10 +106,12 @@ jobs:
103106
# We provide explicit version of the `keep-core` package, because using
104107
# `goerli` tag results in `expected manifest` error - probably caused by
105108
# bug in Yarn: https://github.com/yarnpkg/yarn/issues/4731.
109+
# TODO: Add upgrade of @keep-network/random-beacon, @keep-network/ecdsa,
110+
# @keep-network/tbtc-v2 once they'll be added as dashboard's dependencies.
106111
- name: Resolve latest goerli contracts
107112
run: |
108113
yarn upgrade \
109-
@threshold-network/solidity-contracts@goerli \
114+
@threshold-network/solidity-contracts@dapp-development-goerli \
110115
@keep-network/[email protected] \
111116
@keep-network/keep-ecdsa@goerli \
112117
@keep-network/tbtc@goerli \
@@ -124,9 +129,7 @@ jobs:
124129
ETH_HOSTNAME_HTTP: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
125130
ETH_HOSTNAME_WS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
126131

127-
# A pull_request event is a PR; deploy to preview testnet bucket.
128132
- name: Deploy PR preview to GCP
129-
if: github.event_name == 'pull_request'
130133
uses: thesis/[email protected]
131134
with:
132135
service-key: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
@@ -136,7 +139,6 @@ jobs:
136139
build-folder: build
137140

138141
- name: Post preview URL to PR
139-
if: github.event_name == 'pull_request'
140142
uses: actions/github-script@v5
141143
with:
142144
script: |
@@ -147,13 +149,57 @@ jobs:
147149
body: 'Preview uploaded to https://preview.dashboard.test.threshold.network/${{ github.head_ref }}/index.html.'
148150
})
149151
150-
# A push event is triggered on main branch merge; deploy to testnet
151-
# bucket. Also triggered by manual dispatch from `main` branch.
152+
build-and-deploy-testnet:
153+
name: Deploy to testnet
154+
needs: build-and-test
155+
if: |
156+
github.event_name == 'push'
157+
|| (github.event_name == 'workflow_dispatch'
158+
&& github.ref == 'refs/heads/main')
159+
runs-on: ubuntu-latest
160+
steps:
161+
- uses: actions/checkout@v2
162+
163+
- uses: actions/setup-node@v2
164+
with:
165+
node-version: "16"
166+
cache: "yarn"
167+
168+
# We need this step because the `@keep-network/tbtc` which we update in
169+
# next step has a dependency to `@summa-tx/[email protected]` package, which
170+
# downloads one of its sub-dependencies via unathenticated `git://`
171+
# protocol. That protocol is no longer supported. Thanks to this step
172+
# `https://` is used instead of `git://`.
173+
- name: Configure git to don't use unauthenticated protocol
174+
run: git config --global url."https://".insteadOf git://
175+
176+
# We provide explicit version of the `keep-core` package, because using
177+
# `goerli` tag results in `expected manifest` error - probably caused by
178+
# bug in Yarn: https://github.com/yarnpkg/yarn/issues/4731.
179+
# TODO: Add upgrade of @keep-network/random-beacon, @keep-network/ecdsa,
180+
# @keep-network/tbtc-v2 once they'll be added as dashboard's dependencies.
181+
- name: Resolve latest goerli contracts
182+
run: |
183+
yarn upgrade \
184+
@threshold-network/solidity-contracts@goerli \
185+
@keep-network/[email protected] \
186+
@keep-network/keep-ecdsa@goerli \
187+
@keep-network/tbtc@goerli \
188+
@keep-network/coverage-pools@goerli
189+
190+
- name: Run postinstall script
191+
# `yarn upgrade` doesn't trigger the `postinstall` script.
192+
run: yarn run postinstall
193+
194+
- name: Build
195+
run: yarn build
196+
env:
197+
PUBLIC_URL: /${{ github.head_ref }}
198+
CHAIN_ID: 5
199+
ETH_HOSTNAME_HTTP: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
200+
ETH_HOSTNAME_WS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
201+
152202
- name: Deploy to GCP bucket
153-
if: |
154-
github.event_name == 'push'
155-
|| (github.event_name == 'workflow_dispatch'
156-
&& github.ref == 'refs/heads/main')
157203
uses: thesis/[email protected]
158204
with:
159205
service-key: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
@@ -162,4 +208,4 @@ jobs:
162208
build-folder: build
163209
set-website: true
164210
home-page-path: index.html
165-
error-page-path: index.html
211+
error-page-path: index.html

0 commit comments

Comments
 (0)