Skip to content

Commit

Permalink
modify workflow collator-selection for baedeker
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddyGlas committed Sep 6, 2023
1 parent 1d6b474 commit 08e82c7
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 15 deletions.
43 changes: 43 additions & 0 deletions .baedeker/collator-selection.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
local
m = import 'baedeker-library/mixin/spec.libsonnet',
;

local relay = {
name: 'relay',
bin: 'bin/polkadot',
validatorIdAssignment: 'staking',
spec: {Genesis:{
chain: 'rococo-local',
modify:: m.genericRelay($),
}},
nodes: {
[name]: {
bin: $.bin,
wantedKeys: 'relay',
},
for name in ['alice', 'bob', 'charlie', 'dave', 'eve']
},
};

local unique = {
name: 'unique',
bin: 'bin/unique',
paraId: 1001,
spec: {Genesis:{
modify:: m.genericPara($),
}},
nodes: {
[name]: {
bin: $.bin,
wantedKeys: 'para',
},
for name in ['alice', 'bob']
},
};

relay + {
parachains: {
[para.name]: para,
for para in [opal]
},
}
71 changes: 56 additions & 15 deletions .github/workflows/collator-selection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ jobs:
username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}

- name: pull needed images
run: |
docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}
- name: Run find-and-replace to remove slashes from branch name
uses: mad9000/actions-find-and-replace-string@4
id: branchname
Expand All @@ -98,17 +94,56 @@ jobs:
find: '/'
replace: '-'

- name: Build unique-chain
run: |
docker build --file .docker/Dockerfile-unique \
--build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }} \
--build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} \
--tag uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-${{ env.BUILD_SHA }} \
.
- name: Generate ENV related extend Dockerfile file for POLKADOT
uses: cuchi/[email protected]
with:
template: .docker/Dockerfile-polkadot.j2
output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
- name: Prepare polkadot
uses: ./.github/actions/buildContainer
id: polkadot
with:
container: uniquenetwork/builder-polkadot
tag: ${{ matrix.relay_branch }}
context: .docker
dockerfile: Dockerfile-polkadot.${{ matrix.relay_branch }}.yml
dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}

# - name: pull needed images
# run: |
# docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}

# - name: Build unique-chain
# run: |
# docker build --file .docker/Dockerfile-unique \
# --build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }} \
# --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} \
# --tag uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-${{ env.BUILD_SHA }} \
# .

- name: Push docker image version
run: docker push uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-${{ env.BUILD_SHA }}

- name: Prepare latest
uses: ./.github/actions/buildContainer
id: latest
with:
container: uniquenetwork/ci-collator-selection-local
tag: ${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}
context: .
dockerfile: .docker/Dockerfile-unique
args: |
--build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }}
--build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}


- uses: actions/[email protected]
with:
node-version: 16
Expand All @@ -125,10 +160,14 @@ jobs:
with:
jpath: |
.baedeker/vendor
tla-str: |
relay_spec=westend-local
inputs: |
.baedeker/collator-selection-${{ matrix.network }}.jsonnet
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-${{ env.BUILD_SHA }}'}})
.baedeker/collator-selection.jsonnet
# snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}'}})
# snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-${{ env.BUILD_SHA }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.name }}'}})
ephemeral:snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}}, extra_node_mixin = {legacyRpc: true})
- name: Upload network config
uses: actions/upload-artifact@v3
Expand All @@ -143,10 +182,12 @@ jobs:
yarn install
yarn add mochawesome
# Wanted by both wait_for_first_block
export RPC_URL="${RELAY_SAPPHIRE_HTTP_URL:-${RELAY_OPAL_HTTP_URL:-${RELAY_QUARTZ_HTTP_URL:-${RELAY_UNIQUE_HTTP_URL:-}}}}"
# export RPC_URL="${RELAY_SAPPHIRE_HTTP_URL:-${RELAY_OPAL_HTTP_URL:-${RELAY_QUARTZ_HTTP_URL:-${RELAY_UNIQUE_HTTP_URL:-}}}}"
./scripts/wait_for_first_block.sh
echo "Ready to start tests"
NOW=$(date +%s) && yarn testCollators --reporter mochawesome --reporter-options reportFilename=test-collators-${NOW}
env:
RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}

- name: Test Report
uses: phoenix-actions/test-reporting@v10
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/node-only-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
variables: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
- name: Prepare polkadot
uses: ./.github/actions/buildContainer
id: polkadot
Expand Down

0 comments on commit 08e82c7

Please sign in to comment.