Skip to content

Commit 99c89d3

Browse files
Update build tools (#3)
* Update build tools * Try setting the binary directory for lz4
1 parent c8ba81e commit 99c89d3

27 files changed

+276
-205
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Auto detect text files and perform LF normalization
22
* text=auto
3+
src/amulet/anvil/_version.py export-subst

.github/actions/install-dependencies/action.yml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
compiler-version-password:
1111
description: 'The password for the compiler-version library'
1212
required: true
13+
utils-password:
14+
description: 'The password for the utils library'
15+
required: true
1316
zlib-password:
1417
description: 'The password for the zlib library'
1518
required: true
@@ -19,9 +22,6 @@ inputs:
1922
core-password:
2023
description: 'The password for the core library'
2124
required: true
22-
utils-password:
23-
description: 'The password for the utils library'
24-
required: true
2525
rest-token:
2626
description: 'The Github authentication token to use to access the REST API.'
2727
required: true
@@ -46,6 +46,11 @@ runs:
4646
exit 1
4747
fi
4848
49+
if [ -z "${{ inputs.utils-password }}" ]; then
50+
echo "utils-password is empty"
51+
exit 1
52+
fi
53+
4954
if [ -z "${{ inputs.zlib-password }}" ]; then
5055
echo "zlib-password is empty"
5156
exit 1
@@ -55,23 +60,18 @@ runs:
5560
echo "nbt-password is empty"
5661
exit 1
5762
fi
58-
63+
5964
if [ -z "${{ inputs.core-password }}" ]; then
6065
echo "core-password is empty"
6166
exit 1
6267
fi
63-
64-
if [ -z "${{ inputs.utils-password }}" ]; then
65-
echo "utils-password is empty"
66-
exit 1
67-
fi
6868
6969
if [ -z "${{ inputs.rest-token }}" ]; then
7070
echo "rest-token is empty"
7171
exit 1
7272
fi
7373
74-
- name: Set up Python ${{ inputs.python-version }}
74+
- name: Set up Python
7575
uses: actions/setup-python@v5
7676
with:
7777
python-version: ${{ inputs.python-version }}
@@ -101,32 +101,59 @@ runs:
101101
env:
102102
REST_TOKEN: ${{ inputs.rest-token }}
103103
run: |
104-
python -c "import sys; sys.path.append(r'${{ github.action_path }}'); import dependency_resolver; import requirements; dependency_resolver.find_and_save_compatible_libraries([('amulet-utils', 'Amulet-Team/Amulet-Utils'), ('amulet-core', 'Amulet-Team/Amulet-Core'), ('amulet-nbt', 'Amulet-Team/Amulet-NBT'), ('amulet-zlib', 'Amulet-Team/Amulet-zlib')], requirements.get_runtime_dependencies())"
104+
python -c "import sys; sys.path.append(r'${{ github.action_path }}'); import dependency_resolver; import requirements; dependency_resolver.find_and_save_compatible_libraries([('amulet-core', 'Amulet-Team/Amulet-Core'), ('amulet-nbt', 'Amulet-Team/Amulet-NBT'), ('amulet-zlib', 'Amulet-Team/Amulet-zlib'), ('amulet-utils', 'Amulet-Team/Amulet-Utils')], requirements.get_runtime_dependencies())"
105+
pybind11=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['pybind11'])")
106+
echo "pybind11=$pybind11" >> "$GITHUB_OUTPUT"
107+
pybind11_extensions=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-pybind11-extensions'])")
108+
echo "pybind11_extensions=$pybind11_extensions" >> "$GITHUB_OUTPUT"
105109
io=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-io'])")
106110
echo "io=$io" >> "$GITHUB_OUTPUT"
111+
utils=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-utils'])")
112+
echo "utils=$utils" >> "$GITHUB_OUTPUT"
107113
zlib=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-zlib'])")
108114
echo "zlib=$zlib" >> "$GITHUB_OUTPUT"
109115
nbt=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-nbt'])")
110116
echo "nbt=$nbt" >> "$GITHUB_OUTPUT"
111117
core=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-core'])")
112118
echo "core=$core" >> "$GITHUB_OUTPUT"
113-
utils=$(python -c "import os; f = open(os.path.join(r'${{ github.action_path }}', 'libraries.json'), encoding='utf-8'); import json; print(json.load(f)['amulet-utils'])")
114-
echo "utils=$utils" >> "$GITHUB_OUTPUT"
115119
116120
- name: Specialise Specifiers
117121
id: dep2
118122
shell: bash
119123
run: |
124+
pybind11=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.pybind11 }}'))")
125+
echo "pybind11=$pybind11" >> "$GITHUB_OUTPUT"
126+
pybind11_extensions=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.pybind11_extensions }}'))")
127+
echo "pybind11_extensions=$pybind11_extensions" >> "$GITHUB_OUTPUT"
120128
io=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.io }}'))")
121129
echo "io=$io" >> "$GITHUB_OUTPUT"
130+
utils=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.utils }}'))")
131+
echo "utils=$utils" >> "$GITHUB_OUTPUT"
122132
zlib=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.zlib }}'))")
123133
echo "zlib=$zlib" >> "$GITHUB_OUTPUT"
124134
nbt=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.nbt }}'))")
125135
echo "nbt=$nbt" >> "$GITHUB_OUTPUT"
126136
core=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.core }}'))")
127137
echo "core=$core" >> "$GITHUB_OUTPUT"
128-
utils=$(python -c "import requirements; print(requirements.get_specifier_set('${{ steps.dep.outputs.utils }}'))")
129-
echo "utils=$utils" >> "$GITHUB_OUTPUT"
138+
139+
140+
- name: Clone Amulet-Utils
141+
uses: Amulet-Team/checkout-pep440@v1
142+
with:
143+
repository: 'Amulet-Team/Amulet-Utils'
144+
specifier: '==${{ steps.dep.outputs.utils }}'
145+
path: 'build/pylib/Amulet-Utils'
146+
rest-token: ${{ inputs.rest-token }}
147+
148+
- name: Install Amulet-Utils
149+
uses: ./build/pylib/Amulet-Utils/.github/actions/install
150+
with:
151+
twine-username: ${{ inputs.username }}
152+
twine-password: ${{ inputs.utils-password }}
153+
compiler-specifier: '==${{ steps.compiler.outputs.version }}'
154+
pybind11-specifier: ${{ steps.dep2.outputs.pybind11 }}
155+
pybind11-extensions-specifier: ${{ steps.dep2.outputs.pybind11_extensions }}
156+
utils-specifier: ${{ steps.dep2.outputs.utils }}
130157

131158
- name: Clone Amulet-zlib
132159
uses: Amulet-Team/checkout-pep440@v1
@@ -142,6 +169,8 @@ runs:
142169
twine-username: ${{ inputs.username }}
143170
twine-password: ${{ inputs.zlib-password }}
144171
compiler-specifier: '==${{ steps.compiler.outputs.version }}'
172+
pybind11-specifier: ${{ steps.dep2.outputs.pybind11 }}
173+
pybind11-extensions-specifier: ${{ steps.dep2.outputs.pybind11_extensions }}
145174
zlib-specifier: ${{ steps.dep2.outputs.zlib }}
146175

147176
- name: Clone Amulet-NBT
@@ -158,6 +187,8 @@ runs:
158187
twine-username: ${{ inputs.username }}
159188
twine-password: ${{ inputs.nbt-password }}
160189
compiler-specifier: '==${{ steps.compiler.outputs.version }}'
190+
pybind11-specifier: ${{ steps.dep2.outputs.pybind11 }}
191+
pybind11-extensions-specifier: ${{ steps.dep2.outputs.pybind11_extensions }}
161192
io-specifier: ${{ steps.dep2.outputs.io }}
162193
zlib-specifier: ${{ steps.dep2.outputs.zlib }}
163194
nbt-specifier: ${{ steps.dep2.outputs.nbt }}
@@ -176,22 +207,10 @@ runs:
176207
twine-username: ${{ inputs.username }}
177208
twine-password: ${{ inputs.core-password }}
178209
compiler-specifier: '==${{ steps.compiler.outputs.version }}'
210+
pybind11-specifier: ${{ steps.dep2.outputs.pybind11 }}
211+
pybind11-extensions-specifier: ${{ steps.dep2.outputs.pybind11_extensions }}
179212
io-specifier: ${{ steps.dep2.outputs.io }}
213+
zlib-specifier: ${{ steps.dep2.outputs.zlib }}
180214
nbt-specifier: ${{ steps.dep2.outputs.nbt }}
181215
core-specifier: ${{ steps.dep2.outputs.core }}
182216

183-
- name: Clone Amulet-Utils
184-
uses: Amulet-Team/checkout-pep440@v1
185-
with:
186-
repository: 'Amulet-Team/Amulet-Utils'
187-
specifier: '==${{ steps.dep.outputs.utils }}'
188-
path: 'build/pylib/Amulet-Utils'
189-
rest-token: ${{ inputs.rest-token }}
190-
191-
- name: Install Amulet-Utils
192-
uses: ./build/pylib/Amulet-Utils/.github/actions/install
193-
with:
194-
twine-username: ${{ inputs.username }}
195-
twine-password: ${{ inputs.utils-password }}
196-
compiler-specifier: '==${{ steps.compiler.outputs.version }}'
197-
utils-specifier: ${{ steps.dep2.outputs.utils }}

.github/actions/install-dependencies/dependency_resolver.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,3 @@ def find_and_save_compatible_libraries(
209209
os.path.join(os.path.dirname(__file__), "libraries.json"), "w", encoding="utf-8"
210210
) as f:
211211
json.dump({name: str(specifier) for name, specifier in libraries.items()}, f)
212-
213-
214-
if __name__ == "__main__":
215-
find_and_save_compatible_libraries(
216-
[
217-
("amulet-game", "Amulet-Team/Amulet-Game"),
218-
("amulet-core", "Amulet-Team/Amulet-Core"),
219-
("amulet-nbt", "Amulet-Team/Amulet-NBT"),
220-
("amulet-zlib", "Amulet-Team/Amulet-zlib"),
221-
],
222-
[
223-
f"amulet-compiler-target==1.0",
224-
f"amulet-io~=1.0",
225-
f"amulet-compiler-version==3.0.0",
226-
f"amulet-nbt~=5.0.0.0a0",
227-
f"amulet-core~=2.0.2.0a0",
228-
f"amulet-game~=1.0.0.0a0",
229-
],
230-
)

.github/actions/install/action.yml

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@ inputs:
1010
compiler-specifier:
1111
description: 'The PEP 440 version specifier for the compiler library'
1212
required: true
13+
pybind11-specifier:
14+
description: 'The PEP 440 version specifier for the pybind11 library'
15+
required: true
16+
pybind11-extensions-specifier:
17+
description: 'The PEP 440 version specifier for the Amulet-pybind11-extensions library'
18+
required: true
1319
io-specifier:
14-
description: 'The PEP 440 version specifier for the io library'
20+
description: 'The PEP 440 version specifier for the Amulet-IO library'
21+
required: true
22+
utils-specifier:
23+
description: 'The PEP 440 version specifier for the Amulet-Utils library'
1524
required: true
1625
zlib-specifier:
17-
description: 'The PEP 440 version specifier for the zlib library'
26+
description: 'The PEP 440 version specifier for the Amulet-zlib library'
1827
required: true
1928
nbt-specifier:
20-
description: 'The PEP 440 version specifier for the NBT library'
29+
description: 'The PEP 440 version specifier for the Amulet-NBT library'
2130
required: true
2231
core-specifier:
23-
description: 'The PEP 440 version specifier for the Core library'
24-
required: true
25-
utils-specifier:
26-
description: 'The PEP 440 version specifier for the Utils library'
32+
description: 'The PEP 440 version specifier for the Amulet-Core library'
2733
required: true
2834
anvil-specifier:
29-
description: 'The PEP 440 version specifier for the Anvil library'
35+
description: 'The PEP 440 version specifier for the Amulet-Anvil library'
3036
required: true
3137
outputs:
3238
version:
@@ -52,32 +58,42 @@ runs:
5258
echo "compiler-specifier is empty"
5359
exit 1
5460
fi
55-
61+
62+
if [ -z "${{ inputs.pybind11-specifier }}" ]; then
63+
echo "pybind11-specifier is empty"
64+
exit 1
65+
fi
66+
67+
if [ -z "${{ inputs.pybind11-extensions-specifier }}" ]; then
68+
echo "pybind11-extensions-specifier is empty"
69+
exit 1
70+
fi
71+
5672
if [ -z "${{ inputs.io-specifier }}" ]; then
5773
echo "io-specifier is empty"
5874
exit 1
5975
fi
60-
76+
77+
if [ -z "${{ inputs.utils-specifier }}" ]; then
78+
echo "utils-specifier is empty"
79+
exit 1
80+
fi
81+
6182
if [ -z "${{ inputs.zlib-specifier }}" ]; then
6283
echo "zlib-specifier is empty"
6384
exit 1
6485
fi
65-
86+
6687
if [ -z "${{ inputs.nbt-specifier }}" ]; then
6788
echo "nbt-specifier is empty"
6889
exit 1
6990
fi
70-
91+
7192
if [ -z "${{ inputs.core-specifier }}" ]; then
7293
echo "core-specifier is empty"
7394
exit 1
7495
fi
75-
76-
if [ -z "${{ inputs.utils-specifier }}" ]; then
77-
echo "utils-specifier is empty"
78-
exit 1
79-
fi
80-
96+
8197
if [ -z "${{ inputs.anvil-specifier }}" ]; then
8298
echo "anvil-specifier is empty"
8399
exit 1
@@ -88,18 +104,20 @@ runs:
88104
shell: bash
89105
continue-on-error: true
90106
run: |
91-
python -m pip install --only-binary amulet-anvil amulet-compiler-version${{ inputs.compiler-specifier }} amulet-io${{ inputs.io-specifier }} amulet-zlib${{ inputs.zlib-specifier }} amulet-nbt${{ inputs.nbt-specifier }} amulet-core${{ inputs.core-specifier }} amulet-utils${{ inputs.utils-specifier }} amulet-anvil${{ inputs.anvil-specifier }}
107+
python -m pip install --only-binary amulet-anvil amulet-compiler-version${{ inputs.compiler-specifier }} pybind11${{ inputs.pybind11-specifier }} amulet-pybind11-extensions${{ inputs.pybind11-extensions-specifier }} amulet-io${{ inputs.io-specifier }} amulet-utils${{ inputs.utils-specifier }} amulet-zlib${{ inputs.zlib-specifier }} amulet-nbt${{ inputs.nbt-specifier }} amulet-core${{ inputs.core-specifier }} amulet-anvil${{ inputs.anvil-specifier }}
92108
93109
- name: Build
94110
if: steps.install.outcome == 'failure'
95111
shell: bash
96112
env:
97113
AMULET_FREEZE_COMPILER: 1
114+
PYBIND11_REQUIREMENT: ${{ inputs.pybind11-specifier }}
115+
AMULET_PYBIND11_EXTENSIONS_REQUIREMENT: ${{ inputs.pybind11-extensions-specifier }}
98116
AMULET_IO_REQUIREMENT: ${{ inputs.io-specifier }}
117+
AMULET_UTILS_REQUIREMENT: ${{ inputs.utils-specifier }}
99118
AMULET_ZLIB_REQUIREMENT: ${{ inputs.zlib-specifier }}
100119
AMULET_NBT_REQUIREMENT: ${{ inputs.nbt-specifier }}
101120
AMULET_CORE_REQUIREMENT: ${{ inputs.core-specifier }}
102-
AMULET_UTILS_REQUIREMENT: ${{ inputs.utils-specifier }}
103121
run: |
104122
python -m build --wheel "${{ github.action_path }}"/../../..
105123

.github/actions/unittests-src/action.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@ runs:
1515
exit 1
1616
fi
1717
18-
- name: Set up Python ${{ inputs.python-version }}
18+
- name: Set up Python
1919
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ inputs.python-version }}
2222

23-
- name: Install dependencies
24-
shell: bash
25-
run: |
26-
pip cache purge
27-
python -m pip install --upgrade pip
28-
2923
- name: Build
3024
shell: bash
3125
run: |

.github/workflows/python-build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ jobs:
2323
steps:
2424
- name: Clone
2525
uses: actions/checkout@v4
26-
with:
27-
submodules: 'true'
2826

2927
- name: Install dependencies
3028
uses: ./.github/actions/install-dependencies
3129
with:
3230
python-version: ${{ matrix.python-version }}
3331
username: ${{ secrets.PYPI_USERNAME }}
3432
compiler-version-password: ${{ secrets.AMULET_COMPILER_VERSION_PYPI_PASSWORD }}
33+
utils-password: ${{ secrets.AMULET_UTILS_PYPI_PASSWORD }}
3534
zlib-password: ${{ secrets.AMULET_ZLIB_PYPI_PASSWORD }}
3635
nbt-password: ${{ secrets.AMULET_NBT_PYPI_PASSWORD }}
3736
core-password: ${{ secrets.AMULET_CORE_PYPI_PASSWORD }}
38-
utils-password: ${{ secrets.AMULET_UTILS_PYPI_PASSWORD }}
3937
rest-token: ${{ secrets.GITHUB_TOKEN }}
4038

4139
- name: Build SDist

.github/workflows/python-stylecheck.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,15 @@ on:
1515
jobs:
1616
stylecheck:
1717
runs-on: ubuntu-latest
18-
strategy:
19-
matrix:
20-
python-version: ['3.12']
2118

2219
steps:
2320
- name: Clone
2421
uses: actions/checkout@v4
2522

26-
- name: Set up Python ${{ matrix.python-version }}
23+
- name: Set up Python
2724
uses: actions/setup-python@v5
2825
with:
29-
python-version: ${{ matrix.python-version }}
26+
python-version: 3.12
3027

3128
- name: Install dependencies
3229
run: |

0 commit comments

Comments
 (0)