add an all-in-one script for running tests; format and fix some code; add ci.yml
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, main]
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
main-server:
|
||||
name: main-server (RSpec + audits)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
# Runs `bundle install` + caches gems; resolves the Gemfile
|
||||
# and .ruby-version inside main-server/.
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
working-directory: main-server
|
||||
bundler-cache: true
|
||||
|
||||
# The spec suite talks to a real Redis: test runs are forced onto
|
||||
# logical database 15 (config/initializers/redis.rb) and FLUSHDB it.
|
||||
- name: Start Redis
|
||||
run: |
|
||||
if ! command -v redis-server >/dev/null 2>&1; then
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq redis-server
|
||||
fi
|
||||
redis-server --daemonize yes
|
||||
redis-cli -n 15 ping
|
||||
|
||||
- name: db:prepare, rubocop, bundler-audit, brakeman, rspec
|
||||
run: scripts/test.sh main
|
||||
|
||||
game-server:
|
||||
name: game-server (go vet + go test -race)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: game-server/go.mod
|
||||
cache-dependency-path: game-server/go.sum
|
||||
|
||||
- run: scripts/test.sh game
|
||||
|
||||
frontend:
|
||||
name: frontend (build + tests)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- run: scripts/test.sh frontend --install
|
||||
Reference in New Issue
Block a user