Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
taha-abbasi committed Jun 1, 2023
2 parents a9ad020 + 1dad5b2 commit e273559
Show file tree
Hide file tree
Showing 182 changed files with 37,432 additions and 6,746 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/build-and-publish.yml

This file was deleted.

126 changes: 126 additions & 0 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Rust

on:
push:
branches:
- develop
pull_request:
branches:
- develop

env:
AWS_REGION: us-east-2 # set this to your preferred AWS region, e.g. us-west-1
ECR_REPOSITORY: ferrum_node

jobs:
run_test:
name: 'Run Rust tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-01-26
target: wasm32-unknown-unknown
override: true
- name: Install protoc
uses: arduino/setup-protoc@v1
- name: Run tests
run: |
cargo install cargo-expand &&
TRYBUILD=overwrite cargo test --locked --verbose --all
build:
name: 'Build docker image and push to ECR'
needs: run_test
# if: steps.run_test.outcome == 'success'
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f docker/ferrum.Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Build and push to DockerHub
uses: docker/build-push-action@v4
with:
push: true
tags: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

deploy:
name: 'EC2 Deployment'
needs: build
# if: steps.build.outcome == 'success'
runs-on: ubuntu-latest
steps:

- name: Deploy to ec2 server
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
port: 22
script: sudo /usr/local/bin/deployment.sh > /var/log/scripts/deployments.log 2>&1

lint:
name: 'Run lints'
needs: run_test
# if: steps.run_test.outcome == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-10-10
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy
- name: Install protoc
uses: arduino/setup-protoc@v1
- name: Check Cargo.toml Format
run: |
if taplo --version &> /dev/null; then
echo "taplo-cli is already installed"
else
cargo install taplo-cli
fi
taplo fmt --check
- name: Rustfmt
run: cargo fmt --all -- --check
71 changes: 0 additions & 71 deletions .github/workflows/test.yml

This file was deleted.

21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,23 @@ rls*.log
.cargo-remote.toml
*.bin
*.iml
/chain
/chain
*.stderr
*.log
/docs/_book
# Node rules:
## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

## Dependency directory
## Commenting this out is preferred by some people, see
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
node_modules

# Book build output
_book

# eBook build output
*.epub
*.mobi
*.pdf
Loading

0 comments on commit e273559

Please sign in to comment.