generated from Princeprince559/aleph-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a220b0
Showing
569 changed files
with
245,880 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/target | ||
target | ||
!target/release/aleph-node | ||
!target/production/aleph-node | ||
!bin/cliain/target/release/cliain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Description | ||
|
||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. | ||
|
||
## Type of change | ||
|
||
Please delete options that are not relevant. | ||
|
||
- Bug fix (non-breaking change which fixes an issue) | ||
- New feature (non-breaking change which adds functionality) | ||
- Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
|
||
# Checklist: | ||
|
||
<!-- delete when not applicable to your PR --> | ||
|
||
- I have added tests | ||
- I have made neccessary updates to the Infrastructure | ||
- I have made corresponding changes to the existing documentation | ||
- I have created new documentation | ||
- I have bumped `spec_version` and `transaction_version` | ||
- I have bumped aleph-client version if relevant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This directory gathers useful actions for Github pipelines. | ||
|
||
--- | ||
|
||
## `run-e2e-test` | ||
This action runs a single test from the e2e test suite. It requires a test case, which is the name of the test. | ||
It optionally runs the finalization e2e testcase, which is helpful after some e2e tests to double-check nothing is broken. | ||
|
||
### Usage | ||
Sample usage: | ||
```yaml | ||
steps: | ||
- uses: ./.github/actions/run-e2e-test | ||
with: | ||
test-case: finalization | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
name: Build and push Docker Hub image | ||
description: | ||
Builds and pushes (optionally) docker image to Docker Hub, which does not have bash script as | ||
entrypoint, just aleph-node. | ||
|
||
inputs: | ||
source-image: | ||
description: Source aleph-node image | ||
required: true | ||
target-image: | ||
description: Image to build | ||
required: true | ||
additional-image: | ||
description: Additional image to tag | ||
required: false | ||
dockerhub-username: | ||
description: Docker Hub username | ||
required: true | ||
dockerhub-password: | ||
description: Docker Hub password | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build Docker Hub image | ||
shell: bash | ||
run: | | ||
echo 'FROM ${{ inputs.source-image }}' > Dockerfile.dockerhub | ||
echo 'ENTRYPOINT ["/usr/local/bin/aleph-node"]' >> Dockerfile.dockerhub | ||
docker build -t '${{ inputs.target-image }}' -f Dockerfile.dockerhub . | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ inputs.dockerhub-username }} | ||
password: ${{ inputs.dockerhub-password }} | ||
|
||
- name: Push image to Docker Hub | ||
shell: bash | ||
run: | | ||
docker push '${{ inputs.target-image }}' | ||
if [[ -n '${{ inputs.additional-image }}' ]]; then | ||
docker tag '${{ inputs.target-image }}' '${{ inputs.additional-image }}' | ||
docker push '${{ inputs.additional-image }}' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: Clean runner workspace | ||
description: Removes all the files from the runner working directory | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Remove files and directories from working directory | ||
shell: bash | ||
run: | | ||
rm -rf * | ||
rm -rf ~/.cargo | ||
rm -rf ~/.cache | ||
echo "Running 'ls -al' on $(pwd)" | ||
ls -al |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
name: Get docker image names | ||
description: | ||
Returns | ||
1) public ECR image names for release candidate image and deploy image | ||
2) public DockerHub image names for Testnet and Mainnet | ||
based on the current git HEAD. This action is intended to run only when tag was source of | ||
trigger (ie tag push) | ||
inputs: | ||
ecr-repo: | ||
required: true | ||
description: URL to public aleph-node repo in ECR | ||
dockerhub-repo: | ||
required: true | ||
description: URL to public aleph-node repo in DockerHub | ||
outputs: | ||
ecr-rc-image: | ||
description: ECR release candidate image name | ||
value: ${{ steps.get-docker-image-names.outputs.ecr-rc-image }} | ||
ecr-deploy-image: | ||
description: ECR deploy image name | ||
value: ${{ steps.get-docker-image-names.outputs.ecr-deploy-image }} | ||
dockerhub-testnet-image: | ||
description: DockerHub Testnet docker image name | ||
value: ${{ steps.get-docker-image-names.outputs.dockerhub-testnet-image }} | ||
dockerhub-mainnet-image: | ||
description: DockerHub Mainnet docker image name | ||
value: ${{ steps.get-docker-image-names.outputs.dockerhub-mainnet-image }} | ||
dockerhub-testnet-latest-image: | ||
description: DockerHub Testnet docker image name | ||
value: ${{ steps.get-docker-image-names.outputs.dockerhub-testnet-latest-image }} | ||
dockerhub-mainnet-latest-image: | ||
description: DockerHub Mainnet docker image name | ||
value: ${{ steps.get-docker-image-names.outputs.dockerhub-mainnet-latest-image }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Call action get-ref-properties | ||
id: get-ref-properties | ||
# yamllint disable-line rule:line-length | ||
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v1 | ||
|
||
- name: Check if tag push was a trigger | ||
shell: bash | ||
run: | | ||
if [[ -z "${{ steps.get-ref-properties.outputs.tag }}" ]]; then | ||
echo "Error: did you forgot to run this workflow from tag?" | ||
echo "Instead, it was run from branch ${{ steps.get-ref-properties.outputs.branch }}" | ||
exit 1 | ||
fi | ||
- name: Get node image names | ||
id: get-docker-image-names | ||
shell: bash | ||
run: | | ||
commit_sha=${{ steps.get-ref-properties.outputs.sha }} | ||
commit_tag=${{ steps.get-ref-properties.outputs.tag }} | ||
ecr=${{ inputs.ecr-repo }} | ||
dockerhub=${{ inputs.dockerhub-repo }} | ||
echo "ecr-rc-image=${ecr}:${commit_sha}" >> $GITHUB_OUTPUT | ||
echo "ecr-deploy-image=${ecr}:${commit_tag}" >> $GITHUB_OUTPUT | ||
echo "dockerhub-testnet-image=${dockerhub}:testnet-${commit_tag}" >> $GITHUB_OUTPUT | ||
echo "dockerhub-mainnet-image=${dockerhub}:mainnet-${commit_tag}" >> $GITHUB_OUTPUT | ||
echo "dockerhub-testnet-latest-image=${dockerhub}:testnet-latest" >> $GITHUB_OUTPUT | ||
echo "dockerhub-mainnet-latest-image=${dockerhub}:mainnet-latest" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
--- | ||
name: 'Run e2e test' | ||
description: 'Run single e2e test.' | ||
|
||
inputs: | ||
node-count: | ||
description: 'Number of nodes to run.' | ||
required: false | ||
default: '5' | ||
min-validator-count: | ||
description: 'Minimum number of nodes below which chain enters emergency state.' | ||
required: false | ||
default: '4' | ||
test-case: | ||
description: 'Name of test to run.' | ||
required: false | ||
randomized: | ||
description: 'Whether to use randomized test params.' | ||
required: false | ||
default: 'false' | ||
reserved-seats: | ||
description: 'Number of reserved seats available to validators.' | ||
required: false | ||
non-reserved-seats: | ||
description: 'Number of non-reserved seats available to validators.' | ||
required: false | ||
follow-up-finalization-check: | ||
description: 'Whether to run a follow-up finalization check.' | ||
required: false | ||
deploy-adder: | ||
description: 'Whether to deploy the adder sample contract to the node.' | ||
required: false | ||
default: 'false' | ||
clean-button: | ||
description: 'Whether to remove the button game contracts after running test suite.' | ||
required: false | ||
default: 'false' | ||
deploy-button: | ||
description: 'Whether to deploy the button game contracts to the node.' | ||
required: false | ||
default: 'false' | ||
image-path: | ||
description: 'Custom path to docker image for aleph-node' | ||
required: false | ||
default: aleph-test-docker | ||
node-image: | ||
description: 'Custom name of aleph-node image' | ||
required: false | ||
default: aleph-node:latest | ||
compose-file: | ||
description: 'Custom docker-compose configuration' | ||
required: false | ||
default: '' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
|
||
- name: Download artifact with docker image | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ inputs.image-path }} | ||
|
||
- name: Load node docker image | ||
shell: bash | ||
run: docker load -i aleph-node.tar | ||
|
||
- name: Run consensus party | ||
shell: bash | ||
run: | | ||
NODE_IMAGE=${{ inputs.node-image }} \ | ||
DOCKER_COMPOSE=${{ inputs.compose-file }} \ | ||
./.github/scripts/run_consensus.sh \ | ||
-m ${{ inputs.min-validator-count }} -n ${{ inputs.node-count }} | ||
- name: Sleep | ||
shell: bash | ||
run: sleep 60 | ||
|
||
- name: Display bootnode logs | ||
shell: bash | ||
run: docker logs Node0 --follow & | ||
|
||
- name: Download artifact with the test suite image | ||
if: inputs.test-case != '' | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: aleph-e2e-client | ||
|
||
- name: Load test suite docker image | ||
if: inputs.test-case != '' | ||
shell: bash | ||
run: docker load -i aleph-e2e-client.tar | ||
|
||
- name: Run single e2e test | ||
if: inputs.test-case != '' | ||
shell: bash | ||
run: | | ||
ARGS=( | ||
-t "${{ inputs.test-case }}" | ||
-r "${{ inputs.randomized }}" | ||
-m "${{ inputs.min-validator-count }}" | ||
) | ||
RESERVED_SEATS="${{ inputs.reserved-seats }}" | ||
NON_RESERVED_SEATS="${{ inputs.non-reserved-seats }}" | ||
if [[ -n "${RANDOMIZED}" ]]; then | ||
ARGS+=(-r "${RANDOMIZED}") | ||
fi | ||
if [[ -n "${RESERVED_SEATS}" && -n "${NON_RESERVED_SEATS}" ]]; then | ||
ARGS+=( | ||
-f "${RESERVED_SEATS}" | ||
-n "${NON_RESERVED_SEATS}" | ||
) | ||
fi | ||
DEPLOY_ADDER="${{ inputs.deploy-adder }}" | ||
if [[ "${DEPLOY_ADDER}" = "true" ]]; then | ||
pushd contracts/adder | ||
export ADDER=$(./deploy.sh) | ||
popd | ||
fi | ||
DEPLOY_BUTTON="${{ inputs.deploy-button }}" | ||
if [[ "${DEPLOY_BUTTON}" = "true" ]]; then | ||
source contracts/env/dev | ||
export LIFETIME=20 | ||
contracts/scripts/deploy.sh | ||
source contracts/scripts/test_env | ||
fi | ||
./.github/scripts/run_e2e_test.sh "${ARGS[@]}" | ||
CLEAN_BUTTON="${{ inputs.clean-button }}" | ||
if [[ "${CLEAN_BUTTON}" = "true" ]]; then | ||
source contracts/env/dev | ||
contracts/scripts/clean.sh | ||
fi | ||
- name: Run finalization e2e test | ||
if: inputs.follow-up-finalization-check == 'true' | ||
shell: bash | ||
run: | | ||
./.github/scripts/run_e2e_test.sh \ | ||
-t finalization::finalization -m "${{ inputs.min-validator-count }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
name: 'Send Slack notifiction' | ||
description: | | ||
Action used to send Slack notifications about workflow status in channel specified in | ||
SLACK_WEBHOOK | ||
inputs: | ||
notify-on: | ||
description: "Choose when Slack messages should be sent" | ||
type: choice | ||
options: | ||
- always | ||
- success | ||
- failure | ||
- neutral | ||
- skipped | ||
- cancelled | ||
- timed_out | ||
- action_required | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Get workflow conclusion | ||
uses: technote-space/workflow-conclusion-action@v3 | ||
|
||
- name: Export envs | ||
shell: bash | ||
run: | | ||
#!/bin/bash | ||
if [[ "$WORKFLOW_CONCLUSION" == "success" ]]; then \ | ||
echo SLACK_COLOR="#57d115" >> $GITHUB_ENV; else \ | ||
echo SLACK_COLOR="#ff0000" >> $GITHUB_ENV; fi | ||
echo WORKFLOW_NAME="$(echo "$GITHUB_WORKFLOW" | rev | cut -f1 -d"/" | rev)" >> $GITHUB_ENV | ||
echo STATUS="$(echo "$WORKFLOW_CONCLUSION")" >> $GITHUB_ENV | ||
if [[ "$NOTIFY_ON" == "always" ]]; then \ | ||
echo WORKFLOW_CONCLUSION="always" >> $GITHUB_ENV; fi | ||
echo NOTIFY_ON="$(echo "$NOTIFY_ON")" >> $GITHUB_ENV | ||
env: | ||
NOTIFY_ON: ${{ inputs.notify-on }} | ||
|
||
- name: Send Slack message | ||
uses: rtCamp/action-slack-notify@v2 | ||
if: env.WORKFLOW_CONCLUSION == env.NOTIFY_ON || env.WORKFLOW_CONCLUSION == 'always' | ||
env: | ||
SLACK_TITLE: "*Status: ${{ env.STATUS }}*" | ||
SLACK_USERNAME: GithubActions | ||
SLACK_ICON_EMOJI: ":aleph:" | ||
MSG_MINIMAL: "actions url,commit" | ||
SLACK_MESSAGE: "---------------------------------------" | ||
SLACK_FOOTER: "" |
Oops, something went wrong.