Skip to content

Commit d7f9d7d

Browse files
authored
A0-1520: Add uploading runtime to CI S3 bucket and attaching it to release (#699)
* Add uploading binary and runtime to CI S3 bucket * Add runtime to prerelease and release assets
1 parent a4064fa commit d7f9d7d

File tree

6 files changed

+108
-1
lines changed

6 files changed

+108
-1
lines changed

.github/workflows/build-node-and-runtime.yml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
required: false
1313
type: string
1414

15-
1615
jobs:
1716
build:
1817
name: Build binary artifacts
@@ -25,6 +24,10 @@ jobs:
2524
with:
2625
ref: ${{ inputs.ref }}
2726

27+
- name: Get branch name and commit SHA
28+
id: get_branch
29+
uses: ./.github/actions/get-branch
30+
2831
- name: Install Rust toolchain
2932
uses: actions-rs/toolchain@v1
3033

@@ -61,6 +64,37 @@ jobs:
6164
if-no-files-found: error
6265
retention-days: 7
6366

67+
- name: S3 CI | Configure AWS credentials
68+
uses: aws-actions/configure-aws-credentials@v1
69+
env:
70+
AWS_REGION: us-east-1
71+
with:
72+
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
73+
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
74+
aws-region: ${{ env.AWS_REGION }}
75+
76+
- name: S3 CI | Copy release binary to S3 bucket
77+
shell: bash
78+
env:
79+
BINARY_DIR: target/production
80+
BINARY_FILE: aleph-node
81+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-node
82+
S3BUCKET_FILE: aleph-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz
83+
run: |
84+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
85+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
86+
87+
- name: S3 CI | Copy release runtime to S3 bucket
88+
shell: bash
89+
env:
90+
BINARY_DIR: target/production/wbuild/aleph-runtime
91+
BINARY_FILE: aleph_runtime.compact.wasm
92+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
93+
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
94+
run: |
95+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
96+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
97+
6498
- name: Build test binary
6599
run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals only_legacy"
66100

@@ -80,5 +114,27 @@ jobs:
80114
if-no-files-found: error
81115
retention-days: 7
82116

117+
- name: S3 CI | Copy test binary to S3 bucket
118+
shell: bash
119+
env:
120+
BINARY_DIR: target/release
121+
BINARY_FILE: aleph-node
122+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-node
123+
S3BUCKET_FILE: aleph-test-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz
124+
run: |
125+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
126+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
127+
128+
- name: S3 CI | Copy test runtime to S3 bucket
129+
shell: bash
130+
env:
131+
BINARY_DIR: target/release/wbuild/aleph-runtime
132+
BINARY_FILE: aleph_runtime.compact.wasm
133+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-runtime
134+
S3BUCKET_FILE: aleph-test-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
135+
run: |
136+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
137+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
138+
83139
- name: Cleanup cache
84140
uses: ./.github/actions/post-cache

.github/workflows/deploy-feature-envs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV')
3232
name: Build runtime and aleph-node binary artefacts
3333
uses: ./.github/workflows/build-node-and-runtime.yml
34+
secrets: inherit
3435

3536
push_pr_image:
3637
if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV')

.github/workflows/deploy-mainnet.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,30 @@ jobs:
7272
docker push ${{ env.DOCKERHUB_MAINNET_IMAGE }}
7373
docker push ${{ env.DOCKERHUB_MAINNET_LATEST_IMAGE }}
7474
75+
- name: S3 CI | Configure AWS credentials
76+
uses: aws-actions/configure-aws-credentials@v1
77+
env:
78+
AWS_REGION: us-east-1
79+
with:
80+
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
81+
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
82+
aws-region: ${{ env.AWS_REGION }}
83+
84+
- name: S3 CI | Download release runtime from S3 bucket
85+
shell: bash
86+
env:
87+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
88+
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
89+
run: |
90+
aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }}
91+
92+
- name: RELEASE ASSET | Add runtime to the release
93+
uses: softprops/action-gh-release@v1
94+
if: startsWith(github.ref, 'refs/tags/')
95+
with:
96+
files: |
97+
aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
98+
7599
- name: GIT | Checkout aleph-apps repo
76100
uses: actions/checkout@master
77101
with:

.github/workflows/deploy-testnet.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,30 @@ jobs:
7979
docker push ${{ env.DOCKERHUB_TESTNET_IMAGE }}
8080
docker push ${{ env.DOCKERHUB_TESTNET_LATEST_IMAGE }}
8181
82+
- name: S3 CI | Configure AWS credentials
83+
uses: aws-actions/configure-aws-credentials@v1
84+
env:
85+
AWS_REGION: us-east-1
86+
with:
87+
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
88+
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
89+
aws-region: ${{ env.AWS_REGION }}
90+
91+
- name: S3 CI | Download release runtime from S3 bucket
92+
shell: bash
93+
env:
94+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
95+
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
96+
run: |
97+
aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }}
98+
99+
- name: RELEASE ASSET | Add runtime to the release
100+
uses: softprops/action-gh-release@v1
101+
if: startsWith(github.ref, 'refs/tags/')
102+
with:
103+
files: |
104+
aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
105+
82106
- name: GIT | Checkout aleph-apps repo
83107
uses: actions/checkout@master
84108
with:

.github/workflows/e2e-tests-main-devnet.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
build-new-node:
2424
name: Build node and runtime artifacts (PR version)
2525
uses: ./.github/workflows/build-node-and-runtime.yml
26+
secrets: inherit
2627

2728
build-test-docker:
2829
needs: [build-new-node]

.github/workflows/nightly-pipeline.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
build-new-node:
1313
name: Build node and runtime artifacts (PR version)
1414
uses: ./.github/workflows/build-node-and-runtime.yml
15+
secrets: inherit
1516

1617
build-test-docker:
1718
needs: [build-new-node]

0 commit comments

Comments
 (0)