Skip to content

Update go.yml

Update go.yml #5

Workflow file for this run

name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- name: Start MySQL Docker container
run: |
docker run -d --name meu_app_db \
-p 3308:3306 \
-e MYSQL_ROOT_PASSWORD=meu_app_password_root \
-e MYSQL_USER=meu_app_user \
-e MYSQL_PASSWORD=meu_app_password \
mysql:latest
- name: Build
run: go build -v ./...
- name: Test
run: |
# Aguarde alguns segundos para garantir que o MySQL esteja pronto
sleep 10
# Execute os testes conectando ao banco de dados MySQL
go test -v ./...
- name: Stop MySQL Docker container
run: docker stop meu_app_db