Skip to content

Merge pull request #136 from dadosjusbr/nome_sanitizado #345

Merge pull request #136 from dadosjusbr/nome_sanitizado

Merge pull request #136 from dadosjusbr/nome_sanitizado #345

Workflow file for this run

name: Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
container: golang:1.19
services:
postgres_test:
image: postgres
ports:
- "5432:5432"
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: dadosjusbr_test
POSTGRES_DB: dadosjusbr_test
options: >-
--name dadosjusbr_test
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install docker
run: |
apt-get update && apt-get install --no-install-recommends -y ca-certificates curl gnupg lsb-release sudo
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update && apt-get install --no-install-recommends -y docker-ce docker-ce-cli containerd.io
- name: Criando tabelas
run: |
docker exec -d dadosjusbr_test mkdir docker-entrypoint-initdb.d |
docker cp ./repo/database/init_db.sql dadosjusbr_test:./docker-entrypoint-initdb.d/ |
docker exec dadosjusbr_test psql postgres://root:dadosjusbr_test@postgres_test:5432/dadosjusbr_test?sslmode=disable -f ./docker-entrypoint-initdb.d/init_db.sql
- run: "go test -v -race -covermode atomic -coverprofile=covprofile ./..."
env:
POSTGRES_CONNECTION_URL: postgres://root:dadosjusbr_test@postgres_test:5432/dadosjusbr_test?sslmode=disable
- name: Send coverage
uses: shogo82148/actions-goveralls@v1.6.0
with:
path-to-profile: covprofile
github-token: ${{ secrets.GITHUB_TOKEN }}