update: go.yml #9
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 | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
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 MySQL to be ready | |
run: | | |
until mysqladmin ping -h "127.0.0.1" --silent; do | |
echo 'waiting for mysql to be connectable...' | |
sleep 3 | |
done | |
- name: Download config from Pastebin | |
run: | | |
curl -o config.cfg https://pastebin.com/raw/JYxZmQ6X | |
- name: Download MySQL plugin | |
run: | | |
curl -L -o mysql-linux-amd64.so https://github.com/glauth/glauth-mysql/releases/download/v2.3.2/mysql-linux-amd64.so | |
- name: Run GLAUTH container | |
run: | | |
docker run -it \ | |
-v $(pwd)/config.cfg:/app/config/config.cfg \ | |
-v $(pwd)/mysql-linux-amd64.so:/app/plugins/mysql-linux-amd64.so \ | |
glauth/glauth | |
- 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 ./... |