-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Overmuse/SR/update_tags
change tag format to semver
- Loading branch information
Showing
5 changed files
with
124 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'Cargo.toml' | ||
- 'Cargo.lock' | ||
- 'Dockerfile' | ||
- 'deployment.yml' | ||
- 'src/**' | ||
pull_request: | ||
paths: | ||
- 'Cargo.toml' | ||
- 'Cargo.lock' | ||
- 'Dockerfile' | ||
- 'deployment.yml' | ||
- 'src/**' | ||
- '.github/**' | ||
|
||
name: Continuous integration | ||
|
||
|
@@ -95,7 +87,7 @@ jobs: | |
command: clippy | ||
args: -- -D warnings | ||
|
||
coverage: | ||
test_coverage: | ||
name: Test & Coverage | ||
runs-on: ubuntu-latest | ||
needs: [fmt, clippy] | ||
|
@@ -128,34 +120,3 @@ jobs: | |
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
fail_ci_if_error: true | ||
|
||
build: | ||
name: Build and push to registry | ||
runs-on: ubuntu-latest | ||
needs: [coverage, fmt, clippy] | ||
if: github.ref == 'refs/heads/main' | ||
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: alpaca-data-relay | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: alpaca-data-relay | ||
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 |
Oops, something went wrong.