test: api server integration tests #156
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run lint | |
run: bun run lint | |
- name: Run tests | |
run: bun run test | |
integration: | |
runs-on: ubuntu-latest | |
services: | |
anki: | |
image: ghcr.io/yukaii/gakuon-headless-anki:latest | |
ports: | |
- 8765:8765 | |
options: >- | |
--health-cmd "curl http://localhost:8765" | |
--health-interval 30s | |
--health-timeout 15s | |
--health-retries 3 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run integration tests | |
run: | | |
mkdir -p ~/.gakuon | |
cat <<'EOF' > ~/.gakuon/config.toml | |
# Gakuon Configuration File | |
# Generated on 2025-02-01T00:00:00.000Z | |
# Do not edit while Anki is running | |
[global] | |
ankiHost = "http://localhost:8765" | |
openaiApiKey = "${OPENAI_API_KEY}" | |
ttsVoice = "alloy" | |
[global.openai] | |
baseUrl = "https://api.openai.com/v1" | |
chatModel = "gpt-4o" | |
initModel = "gpt-4o" | |
ttsModel = "tts-1" | |
[global.cardOrder] | |
queueOrder = "learning_review_new" | |
reviewOrder = "due_date_random" | |
newCardOrder = "deck" | |
decks = [] | |
EOF | |
bun run test:integration | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Build CLI | |
run: bun run build | |
- name: Build client | |
run: bun run build:client |