-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (137 loc) · 5.07 KB
/
check.yml
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Run submod checks
on:
workflow_call:
inputs:
paths:
description: List of paths (one per line) to add to MAS install to test.
type: string
required: true
mas-version:
description: >-
Git tag of MAS release to be used during the check. Value of 'latest' can
be passed, in this case workflow will try to retrieve the latest MAS
release. By default, uses 'latest'.
type: string
default: latest
delete-scripts-rpa:
description: >-
Whether or not to delete game/scripts.rpa file (which may be necessary
or not during the check process.) Set to false if check fails with
'missing DDLC archives' error. By default, uses false.
type: boolean
default: false
renpy-version:
description: >-
Version of Ren'Py SDK to be used during the check. Value of 'nightly' can
be passed, in this case workflow will try to retrieve the latest
nightly Ren'Py build. By default, uses 6.99.12.4.
type: string
default: 6.99.12.4
jobs:
check:
name: Run checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch latest MAS version
id: mas-version-latest
if: inputs.mas-version == 'latest'
shell: bash
run: |
tag="$(curl -sL https://api.github.com/repos/monika-after-story/monikamoddev/releases/latest | jq -r .tag_name)"
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Fetch and construct Ren'Py URL for nightly releases
id: renpy-url-nightly
if: inputs.renpy-version == 'nightly'
shell: bash
run: |
filename="$(wget -qO - https://nightly.renpy.org/current-8/index.html | grep -P -m 1 -o '(?<=href=").*\.tar\.bz2(?=".*)')"
echo "url=https://nightly.renpy.org/current-8/$filename" >> $GITHUB_OUTPUT
- name: Construct Ren'Py URL for stable releases
id: renpy-url-stable
if: inputs.renpy-version != 'nightly'
shell: bash
run: |
echo "url=https://www.renpy.org/dl/${{ inputs.renpy-version }}/renpy-${{ inputs.renpy-version }}-sdk.tar.bz2" >> $GITHUB_OUTPUT
- name: Construct cache key
id: cache-key
shell: bash
run: |
renpy_url="${{ steps.renpy-url-nightly.outputs.url }}"
if [ -z "$renpy_url" ]; then
renpy_url="${{ steps.renpy-url-stable.outputs.url }}"
fi
mas_tag="${{ inputs.mas-version }}"
if [ "$mas_tag" == latest ]; then
mas_tag="${{ steps.mas-version-latest.outputs.tag }}"
fi
key="$(echo "$mas_tag-renpy-$renpy_url" | md5sum - | cut -f1 -d" ")"
echo "key=$key" >> $GITHUB_OUTPUT
- name: Pull cache
id: cache
uses: actions/cache@v3
with:
path: |-
renpy
mas
key: ${{ steps.cache-key.outputs.key }}
- name: Install BSDtar
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt update -yq
sudo apt install -yq libarchive-tools
- name: Install Ren'Py SDK
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
renpy_url="${{ steps.renpy-url-nightly.outputs.url }}"
if [ -z "$renpy_url" ]; then
renpy_url="${{ steps.renpy-url-stable.outputs.url }}"
fi
curl -L -o "renpy.dat" "$renpy_url"
mkdir renpy
bsdtar -xf renpy.dat -C renpy
mv "$(find renpy -mindepth 1 -maxdepth 1)" renpy-subdir
mv renpy-subdir/* renpy
rm -rf renpy-subdir
- name: Install MAS
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L -o mas.zip https://s3-us-west-2.amazonaws.com/monika-after-story/ddlc/mas.zip
mkdir mas
bsdtar -xf mas.zip -C mas
git clone --quiet --depth=1 https://github.com/monika-after-story/monikamoddev
cd monikamoddev
if [ "${{ inputs.mas-version }}" == latest ]; then
ref="${{ steps.mas-version-latest.outputs.tag }}"
else
ref="${{ inputs.mas-version }}"
fi
git fetch origin "$ref"
git -c advice.detachedHead=false checkout FETCH_HEAD
cp -Rf Monika\ After\ Story/* ../mas/
- name: Install submods
shell: bash
run: |
cp -r mas mas1
if [ "${{ inputs.delete-scripts-rpa }}" = "true" ]; then
rm mas1/game/scripts.rpa
fi
mkdir mas1/game/Submods
while IFS= read -r path; do
cp -r "$path" mas1/game/Submods
done <<< "${{ inputs.paths }}"
- name: Run checks
shell: bash
env:
SDL_AUDIODRIVER: dummy
run: |
{ renpy/renpy.sh mas1 lint | grep -E -v "^$|Could not find image \(monika [0-9][^[:space:]]+ corresponding to attributes on say statement\.|'monika [0-9][^[:space:]]+' is not an image\.|The image named 'monika [0-9][^[:space:]]+ was not declared\."; } || true
if [ -f mas1/traceback.txt ] || [ -f mas1/errors.txt ]; then
exit 1
fi