Go Tests #466
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: Go Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 12 * * *" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
DB_CONN_STR: ${{ vars.DB_CONN_STR }} | |
DB_USERNAME: ${{ vars.DB_USERNAME }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21.4' | |
- name: Setup golang app | |
run: | | |
go build main.go | |
./main & | |
sleep 15 | |
curl -v http://127.0.0.1:8080 || echo "Failed to connect" | |
- name: Run Go Tests | |
run: | | |
cd test | |
go test ./... | |
- name: Report Status | |
if: always() | |
uses: ravsamhq/notify-slack-action@v1 | |
with: | |
status: ${{ job.status }} | |
notify_when: "failure,warnings" | |
notification_title: "Repo: *{repo}*" | |
message_format: "{emoji} *{status_message}* in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>" | |
footer: "<{run_url}|View Full Run on GitHub>" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }} | |