Repository navigation
MCP: AI assistants can request crafts and set stock rules #420
Workflow file for this run
This file contains hidden or 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: | |
| pull_request: | |
| workflow_dispatch: | |
| # publish.yml runs these before it builds and deploys a release, and | |
| # testing.yml on each push to main before it deploys that. | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: Server tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| # Matches the python:3.14-slim base image in server/Dockerfile. | |
| python-version: "3.14" | |
| cache: pip | |
| cache-dependency-path: | | |
| server/requirements.txt | |
| server/tests/requirements-test.txt | |
| - run: pip install -r server/tests/requirements-test.txt | |
| # tests/test_oc_scripts.py runs the oc/ scripts against the app. | |
| - run: sudo apt-get update && sudo apt-get install -y lua5.3 | |
| - run: python -m pytest -q | |
| working-directory: server | |
| env: | |
| OC_LUA: lua5.3 | |
| frontend: | |
| name: Frontend tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: "26" | |
| # The page loads these as ES modules, so a syntax error in one would | |
| # otherwise only show up in someone's browser console. | |
| - run: for f in server/static/js/*.js; do node --check "$f" || exit 1; done | |
| - run: node --test 'server/tests/js/*.test.js' | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.14" | |
| cache: pip | |
| cache-dependency-path: .github/requirements-lint.txt | |
| - run: pip install -r .github/requirements-lint.txt | |
| # Rules in ruff.toml. | |
| - run: ruff check --output-format=github | |
| # The workflows themselves: unpinned actions, template injection, | |
| # over-broad permissions. The token lets it check that each pinned | |
| # SHA really belongs to its action's repo. | |
| - run: zizmor --format=github .github/workflows | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - run: sudo apt-get update && sudo apt-get install -y lua-check shellcheck | |
| # The OC scripts and their tests; rules in .luacheckrc. | |
| - run: luacheck oc | |
| - run: shellcheck $(git ls-files '*.sh') | |
| browser: | |
| name: Browser tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.14" | |
| cache: pip | |
| cache-dependency-path: server/requirements.txt | |
| - run: pip install -r server/requirements.txt | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: "26" | |
| # Starts the real server on seeded data and clicks through the page | |
| # in the runner's preinstalled Chrome. | |
| - run: node server/tests/e2e/run.mjs | |
| env: | |
| PYTHON: python | |
| icon-export: | |
| name: Icon export tools | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.14" | |
| - run: pip install pytest pillow | |
| - run: python -m py_compile tools/icon-export/export.py | |
| # detect.py and validate.py gate what the GTNH data workflow publishes. | |
| - run: python -m pytest -q tools/icon-export/ci | |
| lua: | |
| name: Lua syntax check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # OpenComputers' default architecture is Lua 5.3. | |
| - run: sudo apt-get update && sudo apt-get install -y lua5.3 | |
| - run: | | |
| status=0 | |
| for f in oc/*.lua; do | |
| luac5.3 -p "$f" || status=1 | |
| done | |
| exit $status | |
| # The scripts on a fake computer, ME network and GT machine. | |
| - run: lua5.3 oc/tests/run.lua | |
| # gcm.lua installs whatever manifest.lua lists, so a renamed or | |
| # deleted script would otherwise only fail on someone's computer. | |
| - name: Check gcm manifest | |
| run: | | |
| lua5.3 -e ' | |
| local m = dofile("oc/manifest.lua") | |
| local files = { m.config, m.motd } | |
| for _, f in ipairs(m.shared) do files[#files + 1] = f end | |
| for _, c in ipairs(m.components) do | |
| for _, f in ipairs(c.files) do files[#files + 1] = f end | |
| end | |
| local missing = 0 | |
| for _, f in ipairs(files) do | |
| if not io.open("oc/" .. f.src) then | |
| print("manifest.lua lists missing file oc/" .. f.src) | |
| missing = missing + 1 | |
| end | |
| end | |
| os.exit(missing == 0) | |
| ' | |
| docker: | |
| name: Docker build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 | |
| with: | |
| context: server | |
| # Both platforms, so a dependency without an arm64 wheel fails | |
| # here instead of at release. Cheap: no emulation (see Dockerfile). | |
| platforms: linux/amd64,linux/arm64 | |
| push: false | |
| # Also reads the cache the last release wrote (publish.yml). | |
| cache-from: | | |
| type=gha | |
| type=registry,ref=ghcr.io/maselkov/gtnh-craft-monitor:buildcache | |
| cache-to: type=gha,mode=max |