Skip to content

Commit

Permalink
added workflow for docker deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi committed Jul 14, 2024
1 parent e7a5a28 commit 0015c1e
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 36 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Deploy to Docker Hub

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-push:
name: Docker Build and Push
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: |
aaronzi/go-demo-api:${{ github.sha }}
aaronzi/go-demo-api:latest
36 changes: 18 additions & 18 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Integration Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
integration-test:
name: Run Integration Tests
runs-on: ubuntu-latest
integration-test:
name: Run Integration Tests
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'

- name: Check out code
uses: actions/checkout@v3
- name: Check out code
uses: actions/checkout@v3

- name: Get dependencies
run: go mod download
- name: Get dependencies
run: go mod download

- name: Run integration tests
run: go test ./... -v -tags=integration
- name: Run integration tests
run: go test ./... -v -tags=integration
36 changes: 18 additions & 18 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Unit Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
unit-test:
name: Run Unit Tests
runs-on: ubuntu-latest
unit-test:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'

- name: Check out code
uses: actions/checkout@v3
- name: Check out code
uses: actions/checkout@v3

- name: Get dependencies
run: go mod download
- name: Get dependencies
run: go mod download

- name: Run unit tests
run: go test ./... -v -short
- name: Run unit tests
run: go test ./... -v -short

0 comments on commit 0015c1e

Please sign in to comment.