Skip to content

Commit

Permalink
Merge pull request #10 from Overmuse/SR/update_tags
Browse files Browse the repository at this point in the history
update to semver
  • Loading branch information
SebRollen authored Apr 14, 2021
2 parents 1de323c + 9a4fa9b commit 41642ab
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 35 deletions.
59 changes: 28 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
on:
push:
branches:
- main
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
- 'src/**'
pull_request:
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
- 'deployment.yml'
- 'src/**'
- '.github/**'

name: Continuous integration

Expand Down Expand Up @@ -93,33 +87,36 @@ jobs:
command: clippy
args: -- -D warnings

build:
name: Build and push to registry
test_coverage:
name: Test & Coverage
runs-on: ubuntu-latest
needs: [fmt, clippy]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup ssh key
uses: webfactory/[email protected]
- name: Cache
uses: actions/cache@v2
id: cache
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup git credentials
uses: fusion-engineering/setup-git-credentials@v2
with:
ssh-private-key: ${{secrets.GH_ACTIONS_SSH_PRIVATE_KEY}}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
credentials: ${{secrets.GIT_USER_CREDENTIALS}}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Generate coverage
run: cargo tarpaulin --out Xml
- name: Upload to codecov
uses: codecov/codecov-action@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: volatility-harvesting
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.sha }}
run: |
docker build --ssh default -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true
70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Deploy
on:
release:
types: [published]

jobs:
cancel-previous:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- name: Cancel actions
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
id: cache
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup git credentials
uses: fusion-engineering/setup-git-credentials@v2
with:
credentials: ${{secrets.GIT_USER_CREDENTIALS}}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Run tests
run: cargo test

build:
name: Build and push to registry
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup ssh key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{secrets.GH_ACTIONS_SSH_PRIVATE_KEY}}
- 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: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: volatility-harvesting
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.event.release.name }}
run: |
docker build --ssh default -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "volatility-harvesting"
version = "0.3.1"
version = "1.0.0"
authors = ["RollenRegistratorBot <[email protected]>"]
edition = "2018"

Expand Down

0 comments on commit 41642ab

Please sign in to comment.