-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wait for finalization * Blend contracts e2e tests and deployment workflows into one workflow * addressing comments Co-authored-by: Mikolaj Gasior <[email protected]>
- Loading branch information
Showing
6 changed files
with
136 additions
and
152 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
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
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 |
---|---|---|
@@ -1,40 +1,142 @@ | ||
name: Deploy The Button game | ||
name: contracts-e2e-tests-and-deploy | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
paths: | ||
- 'contracts/**' | ||
- '.github/**' | ||
push: | ||
paths: | ||
- 'contracts/**' | ||
- '.github/**' | ||
branches: | ||
- benjamin | ||
paths: | ||
- contracts/** | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CHECKOUT_REF: benjamin | ||
CHECKOUT_BRANCH: benjamin | ||
CACHE_KEY: fe-benjamin-button | ||
CONTRACTS_ENVFILE: fe-benjamin | ||
CARGOCONTRACT_REV: 2b1758756de59bd81e7bed5f8429d364f281cb9a | ||
NODE_VERSION: 16 | ||
S3BUCKET_PATH: contracts/fe-benjamin-button | ||
LABEL_DEPLOY_CONTRACTS: '[AZERO] DEPLOY-CONTRACTS' | ||
LABEL_DESTROYED: 'DESTROYED' | ||
LABEL_DEPLOYED: 'DEPLOYED' | ||
LABEL_DEPLOYED_CONTRACTS: 'DEPLOYED-CONTRACTS' | ||
|
||
jobs: | ||
checkout_benjamin: | ||
if: (github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == '[AZERO] DEPLOY-CONTRACTS') | ||
run-tests: | ||
name: Run smart contracts test suite | ||
runs-on: ubuntu-20.04 | ||
env: | ||
RUST_BACKTRACE: full | ||
steps: | ||
- name: Install binaryen | ||
run: | | ||
wget https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz | ||
tar xvzf binaryen-version_101-x86_64-linux.tar.gz | ||
cd binaryen-version_101 | ||
sudo cp -r bin/* /bin | ||
sudo cp -r include/* /usr/include | ||
sudo cp -r lib64/* /lib64 | ||
- name: Display binaryen version | ||
shell: bash | ||
run: wasm-opt --version | ||
|
||
- name: Checkout Source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust Toolchain | ||
uses: actions-rs/toolchain@v1 | ||
|
||
- name: Install WASM target | ||
run: rustup target add wasm32-unknown-unknown | ||
|
||
- name: Install rust-src | ||
run: rustup component add rust-src | ||
|
||
- name: Restore cache | ||
uses: ./.github/actions/restore-cache | ||
with: | ||
target-key: e2e-contracts | ||
cargo-key: e2e-contracts | ||
cache-version: v3 | ||
cargo-targets: e2e-tests-contracts/target/ | ||
|
||
- name: Install cargo-contract | ||
run: | | ||
cargo install cargo-dylint dylint-link --force | ||
# revision merging Hans's PR changes [fix for node URL parsing ] | ||
cargo install --git https://github.com/paritytech/cargo-contract.git --rev 2b1758756de59bd81e7bed5f8429d364f281cb9a --force | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} | ||
aws-region: eu-central-1 | ||
|
||
- name: Login to Public Amazon ECR | ||
id: login-public-ecr | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: public.ecr.aws | ||
username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} | ||
password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} | ||
env: | ||
AWS_REGION: us-east-1 | ||
|
||
- name: Run one-node smartnet | ||
shell: bash | ||
run: | | ||
.github/scripts/run_smartnet.sh & | ||
- name: Display node logs | ||
shell: bash | ||
run: | | ||
docker logs smartnode --follow & | ||
# wait some while docker pulls the image and starts the node | ||
- name: Wait for finalization | ||
shell: bash | ||
run: | | ||
.github/scripts/check_finalization.sh | ||
timeout-minutes: 1 | ||
|
||
- name: Run e2e tests | ||
shell: bash | ||
run: | | ||
source ./contracts/env/dev && ./contracts/scripts/deploy.sh && ./contracts/scripts/test.sh | ||
- name: Cleanup cache | ||
uses: ./.github/actions/post-cache | ||
|
||
slack: | ||
name: Slack notification | ||
runs-on: ubuntu-latest | ||
needs: [run-tests] | ||
if: always() | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Send Slack message | ||
uses: ./.github/actions/slack-notification | ||
with: | ||
notify-on: "failure" | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
build_and_deploy_contracts: | ||
name: Deploy contracts on feature environment | ||
needs: [run-tests] | ||
runs-on: ubuntu-20.04 | ||
#runs-on: self-hosted | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/[email protected] | ||
with: | ||
ref: ${{ env.CHECKOUT_REF }} | ||
ref: ${{ env.CHECKOUT_BRANCH }} | ||
|
||
- name: Check if environment is reachable | ||
shell: bash | ||
|
@@ -103,15 +205,13 @@ jobs: | |
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Get contracts' target directories cache from S3 bucket | ||
if: (github.event_name == 'push') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, env.LABEL_DEPLOYED_CONTRACTS)) | ||
shell: bash | ||
continue-on-error: true | ||
run: | | ||
aws s3 cp s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/targets.tgz targets.tgz | ||
tar -xzf targets.tgz | ||
- name: Copy metadata.json and addresses.json files from S3 bucket | ||
if: (github.event_name == 'push') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, env.LABEL_DEPLOYED_CONTRACTS)) | ||
shell: bash | ||
run: | | ||
aws s3 cp s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/addresses.json contracts/addresses.json | ||
|
@@ -179,28 +279,17 @@ jobs: | |
contracts/access_control/target | ||
aws s3 cp targets.tgz s3://${{ secrets.CI_S3BUCKET_NAME }}/${{ env.S3BUCKET_PATH }}/targets.tgz | ||
- name: Trigger Indexer deployment workflow | ||
run: | | ||
curl -X POST 'https://api.github.com/repos/Cardinal-Cryptography/indexer/actions/workflows/build-and-deploy-to-devnet.yml/dispatches' \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H 'Authorization: Bearer ${{ secrets.CI_GH_TOKEN }}' \ | ||
-d '{ "ref":"master" }' | ||
- name: Trigger The Button deployment workflow | ||
run: | | ||
curl -X POST 'https://api.github.com/repos/Cardinal-Cryptography/the-button/actions/workflows/main.yaml/dispatches' \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H 'Authorization: Bearer ${{ secrets.CI_GH_TOKEN }}' \ | ||
-d '{ "ref":"main", "inputs": { "buildImage": "false", "deployImage": "true" }}' | ||
- name: Add label to mark that contracts have been deployed | ||
uses: actions-ecosystem/[email protected] | ||
with: | ||
labels: ${{ env.LABEL_DEPLOYED_CONTRACTS }} | ||
github_token: ${{ secrets.CI_GH_TOKEN }} | ||
|
||
- name: Remove request label if exists | ||
if: contains(github.event.pull_request.labels.*.name, env.LABEL_DEPLOY_CONTRACTS) | ||
uses: actions-ecosystem/[email protected] | ||
with: | ||
labels: ${{ env.LABEL_DEPLOY_CONTRACTS }} | ||
github_token: ${{ secrets.CI_GH_TOKEN }} | ||
|
||
- name: Create empty target directory so that restore-cache does not fail | ||
run: | | ||
mkdir -p target | ||
touch target/emptyfile | ||
This file was deleted.
Oops, something went wrong.
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
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