Skip to content

Use http.ServeMux instead of chi.Mux #156

Use http.ServeMux instead of chi.Mux

Use http.ServeMux instead of chi.Mux #156

Workflow file for this run

name: WSNet2 server ci
on:
pull_request:
branches: [ main ]
paths:
- '.github/workflows/wsnet2-server.yml'
- 'server/**'
jobs:
unit-test:
runs-on: "ubuntu-latest"
services:
# docker run -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 --rm --name mysql mysql:8.0
mysql:
image: "mysql:8.0"
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: "--name=mysqld"
volumes:
- /run/mysqld:/run/mysqld
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: "server/go.mod"
cache: true
cache-dependency-path: "server/go.sum"
- uses: arduino/setup-protoc@v2
with:
version: '24.x'
- name: Build
run: make all
- name: Run go test
env:
WSNET2_FORCE_DB_TEST: 1
run: go test ./...
- uses: reviewdog/action-setup@v1
- name: Run staticcheck
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./... 2>&1 | reviewdog -f staticcheck -reporter=github-pr-check
combined-test:
runs-on: "ubuntu-latest"
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v3
- run: docker compose run --rm builder make all
- run: docker compose up -d
- name: Wait until service starts
run: |
# lobby
until curl -f "http://127.0.0.1:8080/health"; do
sleep 5
done
# game
until curl -o /dev/null "http://127.0.0.1:3000/debug/pprof/"; do
sleep 5
done
sleep 5
- run: bin/wsnet2-bot scenario
- run: docker compose logs