Skip to content

Update main_test.go #16

Update main_test.go

Update main_test.go #16

Workflow file for this run

name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: glauth
MYSQL_USER: glauth
MYSQL_PASSWORD: password
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Wait for MariaDB to be ready
run: |
until mysqladmin ping -h "127.0.0.1" --silent; do
echo 'waiting for mariadb to be connectable...'
sleep 3
done
- name: Download SQL script
run: curl -o init_db.sql https://pastebin.com/raw/rkLAasAg
- name: Initialize database
run: mysql -h 127.0.0.1 -u glauth -ppassword glauth < init_db.sql
- name: Test
env:
DB_USERNAME: glauth
DB_PASSWORD: password
DB_HOSTNAME: 127.0.0.1
DB_PORT: 3306
DB_NAME: glauth
run: go test -v ./...