Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/deploy-dev.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Reject merge conflict markers in dep files
run: |
if grep -r '^<<<<<<<' package.json package-lock.json ci-deps.dev.json ci-deps.prod.json 2>/dev/null; then
if grep -r '^<<<<<<<' package.json package-lock.json ci-deps.dev.json ci-deps.prod.json crons/ci-deps.dev.json crons/ci-deps.prod.json crons/package.json 2>/dev/null; then
echo "Conflict markers found in dependency files"
exit 1
fi
Expand All @@ -79,8 +79,9 @@ jobs:
env:
AP_GAMESLIB_VERSION: ${{ github.event.client_payload.gameslib_version }}
AP_RENDERER_VERSION: ${{ github.event.client_payload.renderer_version }}
AP_RECRANKS_VERSION: ${{ github.event.client_payload.recranks_version }}
AP_SOURCE: ${{ github.event.client_payload.source_run_id && format('gameslib-ci-{0}', github.event.client_payload.source_run_id) || '' }}
run: npx ap-install-deps --stage dev
run: npm run sync-deps

- name: Verify lockfile matches ci-deps
run: npx ap-check-ci-deps --stage dev --strict
Expand All @@ -94,6 +95,8 @@ jobs:
ci-deps.dev.json
package-lock.json
package.json
crons/ci-deps.dev.json
crons/package.json

# --- MACHINE TRANSLATION PIPELINE START ---
- name: Prune stale managed locale keys
Expand Down Expand Up @@ -131,6 +134,12 @@ jobs:
- name: Test (Lambda init smoke)
run: npm test

- name: Test crons
run: npm run test:crons

- name: Test crons Lambda layers
run: npm run test:crons:layers

- name: Configure AWS credentials
uses: Fooji/create-aws-profile-action@v1
with:
Expand All @@ -144,9 +153,12 @@ jobs:
# aws-secret-access-key: ${{ secrets.AWS_SECRET }}
# aws-region: us-east-1

- name: Deploy
- name: Deploy API stack
run: bash bin/serverless-deploy.sh dev AbstractPlayDev

- name: Deploy crons stack
run: bash crons/bin/serverless-deploy.sh dev

- name: Trigger docs rebuild
if: github.event_name == 'push'
run: |
Expand All @@ -162,7 +174,7 @@ jobs:
git fetch --depth=1 origin "$BEFORE"
CHANGED="$(git diff --name-only "$BEFORE" "$SHA")"
fi
if echo "$CHANGED" | grep -q '^docs/'; then
if echo "$CHANGED" | grep -qE '^(docs/|crons/docs/)'; then
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/deploy-prod.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Reject merge conflict markers in dep files
run: |
if grep -r '^<<<<<<<' package.json package-lock.json ci-deps.dev.json ci-deps.prod.json 2>/dev/null; then
if grep -r '^<<<<<<<' package.json package-lock.json ci-deps.dev.json ci-deps.prod.json crons/ci-deps.dev.json crons/ci-deps.prod.json crons/package.json 2>/dev/null; then
echo "Conflict markers found in dependency files"
exit 1
fi
Expand All @@ -78,8 +78,9 @@ jobs:
env:
AP_GAMESLIB_VERSION: ${{ github.event.client_payload.gameslib_version }}
AP_RENDERER_VERSION: ${{ github.event.client_payload.renderer_version }}
AP_RECRANKS_VERSION: ${{ github.event.client_payload.recranks_version }}
AP_SOURCE: ${{ github.event.client_payload.source_run_id && format('gameslib-ci-{0}', github.event.client_payload.source_run_id) || '' }}
run: npx ap-install-deps --stage prod
run: npm run sync-deps:prod

- name: Verify lockfile matches ci-deps
run: npx ap-check-ci-deps --stage prod --strict
Expand All @@ -93,6 +94,8 @@ jobs:
ci-deps.prod.json
package-lock.json
package.json
crons/ci-deps.prod.json
crons/package.json

- name: Set CI version
run: npm version prerelease --preid=ci-$GITHUB_RUN_ID --no-git-tag-version
Expand All @@ -105,6 +108,12 @@ jobs:
- name: Test (Lambda init smoke)
run: npm test

- name: Test crons
run: npm run test:crons

- name: Test crons Lambda layers
run: npm run test:crons:layers

- name: Configure AWS credentials
uses: Fooji/create-aws-profile-action@v1
with:
Expand All @@ -118,9 +127,12 @@ jobs:
# aws-secret-access-key: ${{ secrets.AWS_SECRET }}
# aws-region: us-east-1

- name: Deploy
- name: Deploy API stack
run: bash bin/serverless-deploy.sh prod AbstractPlayProd

- name: Deploy crons stack
run: bash crons/bin/serverless-deploy.sh prod

- name: Trigger docs rebuild
if: github.event_name == 'push'
run: |
Expand All @@ -136,7 +148,7 @@ jobs:
git fetch --depth=1 origin "$BEFORE"
CHANGED="$(git diff --name-only "$BEFORE" "$SHA")"
fi
if echo "$CHANGED" | grep -q '^docs/'; then
if echo "$CHANGED" | grep -qE '^(docs/|crons/docs/)'; then
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
Expand Down
39 changes: 38 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Reject merge conflict markers in dep files
run: |
if grep -r '^<<<<<<<' package.json package-lock.json ci-deps.dev.json ci-deps.prod.json 2>/dev/null; then
if grep -r '^<<<<<<<' package.json package-lock.json ci-deps.dev.json ci-deps.prod.json crons/ci-deps.dev.json crons/ci-deps.prod.json crons/package.json 2>/dev/null; then
echo "Conflict markers found in dependency files"
exit 1
fi
Expand All @@ -44,6 +44,9 @@ jobs:
- name: Install pinned AP dependencies
run: npx ap-install-deps --stage dev

- name: Sync crons AP manifests from lockfile
run: node scripts/sync-crons-ap-deps.mjs --stage dev

- name: Verify lockfile matches ci-deps
run: npx ap-check-ci-deps --stage dev --strict

Expand All @@ -54,3 +57,37 @@ jobs:

- name: Test (Lambda init smoke)
run: npm test

test-crons:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24

- name: Pin npm
run: npm install -g npm@11.6.2

- name: Create .npmrc
run: echo "@abstractplay:registry=https://npm.pkg.github.com/" > .npmrc
- run: echo "//npm.pkg.github.com/:_authToken=${{secrets.PAT_READ_PACKAGES}}" >> .npmrc

- name: Install NPM dependencies
run: npm ci

- name: Install pinned AP dependencies
run: npx ap-install-deps --stage dev

- name: Sync crons AP manifests from lockfile
run: node scripts/sync-crons-ap-deps.mjs --stage dev

- name: Lint crons
run: npm run lint:crons

- name: Test crons
run: npm run test:crons

- name: Test crons Lambda layers
run: npm run test:crons:layers
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ jspm_packages

# Serverless directories
.serverless
crons/.serverless
crons/.esbuild
.esbuild/
.test-artifacts/
dist/
Expand Down
4 changes: 2 additions & 2 deletions ci-deps.dev.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"renderer": "1.0.0-ci-35278756813.0",
"updatedAt": "2026-09-19T16:00:34.835Z",
"source": "gameslib-ci-35453221145",
"updatedAt": "2026-09-19T16:06:26.073Z",
"source": "ci-deps.dev.json",
"gameslib": "1.0.0-ci-35453221145.0"
}
39 changes: 39 additions & 0 deletions crons/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": [
"scripts/index.html"
],
"overrides": [
{
"files": ["**/*.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-extra-semi": "off"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"project": ["./tsconfig.json"]
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-floating-promises": ["error"]
}
}
8 changes: 8 additions & 0 deletions crons/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Keep production dependency pins when merging develop into main.
ci-deps.prod.json merge=ours

# Keep develop dependency pins when merging l10n/weblate (or other branches) into develop.
ci-deps.dev.json merge=ours

# Keep target-branch lockfile on cross-branch merges; run sync-deps if strict check fails.
package-lock.json merge=ours
15 changes: 15 additions & 0 deletions crons/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# package directories
node_modules
jspm_packages

# Serverless directories
.serverless
/api/*.js
/utils/*.js
.vscode/
bin/*
dist/

# Generated from node-backend (see src/locales/README.md)
src/locales/**
!src/locales/README.md
1 change: 1 addition & 0 deletions crons/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
21 changes: 21 additions & 0 deletions crons/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Abstract Play

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions crons/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Backend Crons

This tree lives in the [node-backend](https://github.com/AbstractPlay/node-backend) monorepo (`crons/`). Deploy with `serverless` from this directory after the main API stack (see `docs/deployment.md`).

Scheduled AWS Lambda jobs for Abstract Play: DynamoDB exports, static game records on S3, site-wide analytics, and live tournament/challenge automation.

Developer documentation: [Abstract Play docs — Crons](https://docs.abstractplay.com/crons/) (dev: `docs.dev.abstractplay.com`).
7 changes: 7 additions & 0 deletions crons/ci-deps.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"updatedAt": "2026-09-19T16:07:51.415Z",
"source": "ci-deps.dev.json",
"renderer": "1.0.0-ci-35278756813.0",
"gameslib": "1.0.0-ci-35453221145.0",
"recranks": "1.0.0-ci-35280155165.0"
}
7 changes: 7 additions & 0 deletions crons/ci-deps.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"renderer": "1.0.0-ci-32782926153.0",
"updatedAt": "2026-08-24T22:13:46.262Z",
"source": "gameslib-ci-32783108998",
"gameslib": "1.0.0-ci-32783108998.0",
"recranks": "1.0.0-ci-32677322618.0"
}
14 changes: 14 additions & 0 deletions crons/docs/_docs-repo-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Docs repository integration

[AbstractPlay/docs](https://github.com/AbstractPlay/docs) aggregates crons documentation from this monorepo:

- Submodule `vendor/node-backend` → `https://github.com/AbstractPlay/node-backend.git` (`develop` / `main`).
- Prebuild: `vendor/node-backend/crons/docs` → site prefix `/crons/` (`scripts/crons-docs.js` + `syncDocsFromSrc` in `scripts/prebuild.js`).
- Site nav: **Crons** section at `/crons/` (`crons/docs/nav.json`).
- No `vendor/backend-crons` submodule (retired with monorepo merge).

Local prebuild: sibling `../node-backend` with `crons/docs/` when the vendor pin predates the merge.

Published URL prefix: `/crons/` (e.g. `/crons/pipeline/`).

Docs rebuild trigger: node-backend deploy workflow dispatches `dep_update_dev` / `dep_update_prod` when a push changes `docs/` or `crons/docs/`.
Loading
Loading