Skip to content

Commit 53ecd53

Browse files
committed
Merge branch 'develop'
2 parents 920ee78 + 9a928a2 commit 53ecd53

14 files changed

+477
-67
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
.github
3+
task-definition*

.github/workflows/aws-dev.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Deploy to Amazon ECS
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v1
16+
17+
- name: Configure AWS credentials
18+
uses: aws-actions/configure-aws-credentials@v1
19+
with:
20+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
21+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
22+
aws-region: eu-central-1
23+
24+
- name: Login to Amazon ECR
25+
id: login-ecr
26+
uses: aws-actions/amazon-ecr-login@v1
27+
28+
- name: Build, tag, and push image to Amazon ECR
29+
id: build-image
30+
env:
31+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
32+
ECR_REPOSITORY: kilt/prototype-chain
33+
CACHE_IMAGE_TAG: latest-develop
34+
CACHE_IMAGE_BUILDER_TAG: latest-develop-builder
35+
run: |
36+
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG || true
37+
docker build \
38+
--target builder \
39+
--cache-from $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG \
40+
-t $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG \
41+
.
42+
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG || true
43+
docker build \
44+
--cache-from $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG \
45+
--cache-from $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG \
46+
-t $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG \
47+
.
48+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG
49+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG
50+
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG"
51+
52+
- name: (Alice) Fill in the new image ID in the Amazon ECS task definition
53+
id: task-def-alice
54+
uses: aws-actions/amazon-ecs-render-task-definition@v1
55+
with:
56+
task-definition: task-definition-alice.json
57+
container-name: devnet-node
58+
image: ${{ steps.build-image.outputs.image }}
59+
60+
- name: (Alice) Deploy Amazon ECS task definition
61+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
62+
with:
63+
task-definition: ${{ steps.task-def-alice.outputs.task-definition }}
64+
service: bootnode-alice
65+
cluster: kilt-devnet
66+
wait-for-service-stability: true
67+
68+
- name: (Bob) Fill in the new image ID in the Amazon ECS task definition
69+
id: task-def-bob
70+
uses: aws-actions/amazon-ecs-render-task-definition@v1
71+
with:
72+
task-definition: task-definition-bob.json
73+
container-name: devnet-node
74+
image: ${{ steps.build-image.outputs.image }}
75+
76+
- name: (Bob) Deploy Amazon ECS task definition
77+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
78+
with:
79+
task-definition: ${{ steps.task-def-bob.outputs.task-definition }}
80+
service: bootnode-bob
81+
cluster: kilt-devnet
82+
wait-for-service-stability: true
83+
84+
- name: (Charlie) Fill in the new image ID in the Amazon ECS task definition
85+
id: task-def-charlie
86+
uses: aws-actions/amazon-ecs-render-task-definition@v1
87+
with:
88+
task-definition: task-definition-charlie.json
89+
container-name: devnet-charlie
90+
image: ${{ steps.build-image.outputs.image }}
91+
92+
- name: (Charlie) Deploy Amazon ECS task definition
93+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
94+
with:
95+
task-definition: ${{ steps.task-def-charlie.outputs.task-definition }}
96+
service: bootnode-charlie
97+
cluster: kilt-devnet
98+
wait-for-service-stability: true
99+
100+
- name: (Full) Fill in the new image ID in the Amazon ECS task definition
101+
id: task-def-full
102+
uses: aws-actions/amazon-ecs-render-task-definition@v1
103+
with:
104+
task-definition: task-definition-full.json
105+
container-name: devnet-node
106+
image: ${{ steps.build-image.outputs.image }}
107+
108+
- name: (Full) Deploy Amazon ECS task definition
109+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
110+
with:
111+
task-definition: ${{ steps.task-def-full.outputs.task-definition }}
112+
service: full-nodes
113+
cluster: kilt-devnet
114+
wait-for-service-stability: true
115+
116+
- name: Purge data in demo services
117+
env:
118+
SERVICES_SECRET: ${{ secrets.SERVICES_SECRET }}
119+
run: |
120+
curl -X DELETE -H "Authorization: ${SERVICES_SECRET}" https://services.devnet.kilt.io/ctype
121+
curl -X DELETE -H "Authorization: ${SERVICES_SECRET}" https://services.devnet.kilt.io/messaging
122+
curl -X DELETE -H "Authorization: ${SERVICES_SECRET}" https://services.devnet.kilt.io/contacts

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
name: Release
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Use Node.js v10
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 10.x
19+
20+
- name: yarn install, lint and test
21+
run: |
22+
yarn install --frozen-lockfile
23+
yarn lint
24+
buildECR:
25+
needs: test
26+
27+
name: Build image and push to Amazon ECR
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
34+
- name: Build image
35+
run: |
36+
docker build -t kilt/mashnet-node .
37+
38+
- name: Configure AWS credentials
39+
uses: aws-actions/configure-aws-credentials@v1
40+
with:
41+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
42+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43+
aws-region: eu-central-1
44+
45+
- name: Login to Amazon ECR
46+
id: login-ecr
47+
uses: aws-actions/amazon-ecr-login@v1
48+
49+
- name: Tag, and push image to Amazon ECR
50+
env:
51+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
52+
ECR_REPOSITORY: kilt/prototype-chain
53+
run: |
54+
IMAGE_TAG=${GITHUB_REF#refs/tags/}
55+
docker tag kilt/mashnet-node $ECR_REGISTRY/$ECR_REPOSITORY:latest
56+
docker tag kilt/mashnet-node $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
57+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
58+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
59+
60+
buildDocker:
61+
needs: test
62+
63+
name: Build image and push to Docker Hub
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v2
69+
70+
- name: Build image
71+
run: |
72+
docker build -t kilt/mashnet-node .
73+
74+
- name: Login to Docker Hub
75+
env:
76+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
77+
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
78+
run: |
79+
echo $DOCKER_PASS | docker login --username=$DOCKER_USER --password-stdin
80+
81+
- name: Tag, and push image to Docker Hub
82+
env:
83+
DOCKER_REPOSITORY: kiltprotocol/mashnet-node
84+
run: |
85+
IMAGE_TAG=${GITHUB_REF#refs/tags/}
86+
docker tag kilt/mashnet-node $DOCKER_REPOSITORY:latest
87+
docker tag kilt/mashnet-node $DOCKER_REPOSITORY:$IMAGE_TAG
88+
docker push $DOCKER_REPOSITORY:$IMAGE_TAG
89+
docker push $DOCKER_REPOSITORY:latest

.github/workflows/tests.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
tags:
9+
- '*'
10+
pull_request:
11+
branches:
12+
- develop
13+
- master
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v1
23+
24+
- name: Configure AWS credentials
25+
uses: aws-actions/configure-aws-credentials@v1
26+
with:
27+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
28+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29+
aws-region: eu-central-1
30+
31+
- name: Login to Amazon ECR
32+
id: login-ecr
33+
uses: aws-actions/amazon-ecr-login@v1
34+
35+
- name: Build and Test
36+
env:
37+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
38+
ECR_REPOSITORY: kilt/prototype-chain
39+
CACHE_IMAGE_TAG: latest-develop
40+
CACHE_IMAGE_BUILDER_TAG: latest-develop-builder
41+
run: |
42+
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG || true
43+
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG || true
44+
docker build \
45+
--cache-from $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_BUILDER_TAG \
46+
--cache-from $ECR_REGISTRY/$ECR_REPOSITORY:$CACHE_IMAGE_TAG \
47+
.

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ COPY . /build
4646

4747
RUN /bin/bash scripts/build.sh
4848

49-
RUN cargo build --release && cargo test
49+
RUN cargo build --release
50+
RUN cargo test --release -p mashnet-node-runtime
5051

5152

5253
FROM ubuntu:xenial

buildspec-ci.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

buildspec.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

runtime/wasm/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)