Skip to content
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

A0-1520: Add uploading runtime to CI S3 bucket and attaching it to release #699

Merged
11 commits merged into from
Dec 8, 2022
Merged
58 changes: 57 additions & 1 deletion .github/workflows/build-node-and-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
required: false
type: string


jobs:
build:
name: Build binary artifacts
Expand All @@ -25,6 +24,10 @@ jobs:
with:
ref: ${{ inputs.ref }}

- name: Get branch name and commit SHA
id: get_branch
uses: ./.github/actions/get-branch

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

Expand Down Expand Up @@ -61,6 +64,37 @@ jobs:
if-no-files-found: error
retention-days: 7

- name: S3 CI | Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
env:
AWS_REGION: us-east-1
with:
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: S3 CI | Copy release binary to S3 bucket
shell: bash
env:
BINARY_DIR: target/production
BINARY_FILE: aleph-node
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-node
S3BUCKET_FILE: aleph-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz
run: |
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}

- name: S3 CI | Copy release runtime to S3 bucket
shell: bash
env:
BINARY_DIR: target/production/wbuild/aleph-runtime
BINARY_FILE: aleph_runtime.compact.wasm
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
run: |
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}

- name: Build test binary
run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals only_legacy"

Expand All @@ -80,5 +114,27 @@ jobs:
if-no-files-found: error
retention-days: 7

- name: S3 CI | Copy test binary to S3 bucket
shell: bash
env:
BINARY_DIR: target/release
BINARY_FILE: aleph-node
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-node
S3BUCKET_FILE: aleph-test-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz
run: |
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}

- name: S3 CI | Copy test runtime to S3 bucket
shell: bash
env:
BINARY_DIR: target/release/wbuild/aleph-runtime
BINARY_FILE: aleph_runtime.compact.wasm
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-runtime
S3BUCKET_FILE: aleph-test-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
run: |
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}

- name: Cleanup cache
uses: ./.github/actions/post-cache
1 change: 1 addition & 0 deletions .github/workflows/deploy-feature-envs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV')
name: Build runtime and aleph-node binary artefacts
uses: ./.github/workflows/build-node-and-runtime.yml
secrets: inherit

push_pr_image:
if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV')
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/deploy-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,30 @@ jobs:
docker push ${{ env.DOCKERHUB_MAINNET_IMAGE }}
docker push ${{ env.DOCKERHUB_MAINNET_LATEST_IMAGE }}

- name: S3 CI | Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
env:
AWS_REGION: us-east-1
with:
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: S3 CI | Download release runtime from S3 bucket
shell: bash
env:
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
run: |
aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }}

- name: RELEASE ASSET | Add runtime to the release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz

- name: GIT | Checkout aleph-apps repo
uses: actions/checkout@master
with:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/deploy-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,30 @@ jobs:
docker push ${{ env.DOCKERHUB_TESTNET_IMAGE }}
docker push ${{ env.DOCKERHUB_TESTNET_LATEST_IMAGE }}

- name: S3 CI | Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
env:
AWS_REGION: us-east-1
with:
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: S3 CI | Download release runtime from S3 bucket
shell: bash
env:
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
run: |
aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }}

- name: RELEASE ASSET | Add runtime to the release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz

- name: GIT | Checkout aleph-apps repo
uses: actions/checkout@master
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e-tests-main-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
build-new-node:
name: Build node and runtime artifacts (PR version)
uses: ./.github/workflows/build-node-and-runtime.yml
secrets: inherit

build-test-docker:
needs: [build-new-node]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
build-new-node:
name: Build node and runtime artifacts (PR version)
uses: ./.github/workflows/build-node-and-runtime.yml
secrets: inherit

build-test-docker:
needs: [build-new-node]
Expand Down