-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (112 loc) · 4.78 KB
/
Copy pathci.yml
File metadata and controls
128 lines (112 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
# Run the Ren'Py testcases harness against pinned SDKs -- the code path
# pytest cannot cover (real .rpy screens + the 7.x/Py2 runtime). The SDK
# launcher (renpy.sh at the SDK root) is passed straight to
# bin/test_harness.sh, which sniffs the bundled major version from
# renpy/__init__.py and runs the matching DSL template.
testcases:
name: testcases (Ren'Py ${{ matrix.renpy }})
strategy:
fail-fast: false
matrix:
include:
- renpy: "7.4.10"
os: ubuntu-22.04
- renpy: "8.5.3"
os: ubuntu-latest
runs-on: ${{ matrix.os }}
env:
# Explicit fixture root (empty is fine -- CueDatabase.open() creates all
# subdirs at init). Never let the run inherit a machine-local pointer
# file, which would override the env var.
RENPY_CUE_DIR: ${{ github.workspace }}/tests/fixtures/data
# Headless runner: no audio device. The testcases play no audio.
SDL_AUDIODRIVER: dummy
steps:
- uses: actions/checkout@v4
# Pinned SDKs are immutable, so a version-keyed cache never goes stale.
# Restoring the extracted tree skips the 100-150MB download + tar.bz2
# decompress on every run.
- name: Cache Ren'Py SDK
uses: actions/cache@v4
id: cache-sdk
with:
path: renpy-${{ matrix.renpy }}-sdk
key: renpy-sdk-${{ matrix.renpy }}-${{ runner.os }}
- name: Download Ren'Py SDK
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
curl -fL "https://www.renpy.org/dl/${{ matrix.renpy }}/renpy-${{ matrix.renpy }}-sdk.tar.bz2" -o sdk.tar.bz2
tar xjf sdk.tar.bz2
- name: Set SDK_DIR
run: echo "SDK_DIR=$PWD/renpy-${{ matrix.renpy }}-sdk" >> "$GITHUB_ENV"
# The video-variant testcases encode with real ffmpeg/ffprobe; the ubuntu
# runner images don't ship them, so a job launch fails with OSError errno 2
# (the "fix weird layout shift" era of CI failures). Install before run.
- name: Install ffmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
# The `test` command is uses_display=True and the 7.x leg forces
# SDL_VIDEODRIVER=x11 -- both need a real X server. xvfb provides it.
- name: Run testcases
# Explicit `bash` invocation: the repo lives on a filesystem that
# doesn't persist the exec bit (core.fileMode=false), so the scripts
# aren't executable in the working tree.
run: xvfb-run -a bash bin/test_harness.sh "$SDK_DIR/renpy.sh"
# Fast gate: pyright + 120-char lint, then the pytest suite, under the
# modern toolchain. Mirrors the /lint and /test skills via bin/*.sh.
check:
name: lint + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: python
with:
python-version: "3.12"
# Cache the poetry venv in-project. The key includes the exact resolved
# Python patch because a venv's interpreter symlink is tied to that
# path -- when the hosted image bumps the patch the key changes and the
# venv is rebuilt, instead of restoring a dead one.
- name: Cache poetry venv
uses: actions/cache@v4
id: cache-venv
with:
path: .venv
key: poetry-venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install poetry + deps
run: |
python -m pip install --upgrade pip "poetry==2.4.1"
poetry config virtualenvs.in-project true
poetry install
# bin/lint.sh calls bare `pyright` (not `poetry run pyright`), so the
# project venv's bin/ must be on PATH.
#
# pyrightconfig.json's extraPaths point at the SDK (relative ./sdk plus
# machine-local absolute paths that don't exist here). Download the SDK
# and symlink it into ./sdk so pyright can resolve renpy.* on this
# clean runner. The 8.5.3 testcases leg seeds the same version-keyed
# cache, so whichever job starts first saves it and the other reads it.
- name: Cache Ren'Py SDK for pyright
uses: actions/cache@v4
id: cache-sdk
with:
path: renpy-8.5.3-sdk
key: renpy-sdk-8.5.3-${{ runner.os }}
- name: Download Ren'Py SDK for pyright
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
curl -fL "https://www.renpy.org/dl/8.5.3/renpy-8.5.3-sdk.tar.bz2" -o sdk.tar.bz2
tar xjf sdk.tar.bz2
- name: Symlink SDK
run: ln -s "$PWD/renpy-8.5.3-sdk" sdk
- name: Lint
run: |
export PATH="$(poetry env info -p)/bin:$PATH"
bash bin/lint.sh
- name: Test
run: bash bin/test.sh