chore: update domain tests #24
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
name: Build | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
Test: | |
name: Unit Test | |
strategy: | |
matrix: | |
go-version: [1.18.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Run Test | |
run: | | |
go test -v -covermode=count -coverprofile=coverage.out ./... | |
go tool cover -func=coverage.out -o=coverage.out | |
- name: Go Coverage Badge | |
uses: tj-actions/[email protected] | |
with: | |
filename: coverage.out | |
- name: Verify Changed files | |
uses: tj-actions/[email protected] | |
id: verify-changed-files | |
with: | |
files: README.md | |
- name: Commit changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m "chore: Updated coverage badge." | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ github.token }} | |
branch: ${{ github.head_ref }} | |
Deploy: | |
name: Deploy application | |
needs: [Test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: akhileshns/[email protected] | |
with: | |
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | |
heroku_app_name: "wellingtonlope-ticket-api" | |
heroku_email: "[email protected]" | |
usedocker: true | |
docker_build_args: | | |
APP_ENV | |
APP_SECRET | |
TOKEN_DURATION_HOUR | |
MONGO_URI | |
MONGO_DATABASE | |
env: | |
APP_ENV: production | |
APP_SECRET: ${{secrets.API_SECRET}} | |
TOKEN_DURATION_HOUR: ${{secrets.TOKEN_DURATION_HOUR}} | |
MONGO_URI: ${{secrets.MONGO_URI}} | |
MONGO_DATABASE: ticket-api |