Initial dictionary producer: builddict, word-list sources, DAWG build + CI
build / dawg (push) Failing after 2s

- builddict drives the de-internalized scrabble-solver dictdawg/wordlist builders
  (pinned v1.0.0) to produce the three DAWGs (en_sowpods, ru_scrabble, ru_erudit),
  byte-identical to the solver's committed fixtures (same dafsa/alphabet v1.1.0 -> no
  index drift with the running backend).
- Sources: english/sowpods.txt vendored from kamilmielnik/scrabble-dictionaries;
  russian/scrabble.txt + the dictprep tooling moved out of scrabble-solver.
- CI builds the DAWGs on push/PR and, on a vX.Y.Z tag, packages them flat into
  scrabble-dawg-<tag>.tar.gz and attaches it to the Gitea release.
This commit is contained in:
Ilia Denisov
2026-06-04 19:18:19 +02:00
commit d04470b741
15 changed files with 352547 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
name: build
# Builds the dictionary DAWGs on every push/PR (validation) and, on a vX.Y.Z tag,
# packages them flat into scrabble-dawg-<tag>.tar.gz and attaches it to the Gitea release.
# The build pins the published scrabble-solver builders (GOPRIVATE -> direct VCS fetch from
# this Gitea), so the on-disk format matches the running backend exactly.
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
jobs:
dawg:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
GOPRIVATE: gitea.iliadenisov.ru/*
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build DAWGs
run: |
make dawg
ls -la dawg/
for f in en_sowpods ru_scrabble ru_erudit; do
test -s "dawg/$f.dawg" || { echo "missing dawg/$f.dawg"; exit 1; }
done
- name: Package and publish release artifact
if: startsWith(github.ref, 'refs/tags/v')
env:
TOKEN: ${{ github.token }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
run: |
set -eo pipefail
tag="${GITHUB_REF_NAME}"
art="scrabble-dawg-${tag}.tar.gz"
tar czf "$art" -C dawg en_sowpods.dawg ru_scrabble.dawg ru_erudit.dawg
# Create the release (or fetch it if it already exists), then upload the asset.
code=$(curl -sS -o /tmp/rel.json -w '%{http_code}' -X POST "$API/releases" \
-H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
-d "{\"tag_name\":\"$tag\",\"name\":\"$tag\",\"body\":\"Dictionary DAWG set $tag (en_sowpods, ru_scrabble, ru_erudit).\"}")
if [ "$code" != "201" ]; then
echo "release POST returned $code; fetching existing release for tag $tag"
curl -sS -o /tmp/rel.json "$API/releases/tags/$tag" -H "Authorization: token $TOKEN"
fi
rel_id=$(python3 -c 'import json;print(json.load(open("/tmp/rel.json"))["id"])')
curl -sS -X POST "$API/releases/$rel_id/assets?name=$art" \
-H "Authorization: token $TOKEN" -F "attachment=@$art" -o /tmp/asset.json
echo "published $art to release $rel_id"