-
Notifications
You must be signed in to change notification settings - Fork 185
173 lines (156 loc) · 5.01 KB
/
prerelease.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: "Prerelease"
# Trigger the create release workflow
on:
workflow_dispatch:
jobs:
build_wheels:
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
include:
# Linux 64 bit manylinux2014
- os: ubuntu-latest
python: 39
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
- os: ubuntu-latest
python: 310
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
- os: ubuntu-latest
python: 311
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
- os: ubuntu-latest
python: 312
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
# MacOS x86_64
- os: macos-13
python: 39
platform_id: macosx_x86_64
# - os: macos-13
# python: 310
# platform_id: macosx_x86_64
# - os: macos-13
# python: 311
# platform_id: macosx_x86_64
- os: macos-13
python: 312
platform_id: macosx_x86_64
# MacOS arm64
- os: macos-14
python: 39
platform_id: macosx_arm64
# - os: macos-14
# python: 310
# platform_id: macosx_arm64
# - os: macos-14
# python: 311
# platform_id: macosx_arm64
- os: macos-14
python: 312
platform_id: macosx_arm64
steps:
- name: Checkout TextWorld
uses: actions/checkout@v4
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build and test wheels
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_BUILD_VERBOSITY: 1
# MACOSX_DEPLOYMENT_TARGET: "10.13"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: tw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }}
path: wheelhouse/*.whl
if-no-files-found: error
# Build the source distribution under Linux
build_sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build --sdist
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: tw-sdist
path: dist/*.tar.gz
if-no-files-found: error
release:
name: >-
Publish TextWorld 📦 to PyPI
needs:
- build_wheels
- build_sdist
runs-on: ubuntu-latest
environment:
name: prerelease
url: https://pypi.org/project/textworld/
permissions:
id-token: write # mandatory for trusted publishing
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: tw-*
path: dist
merge-multiple: true
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
test:
needs: release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies (Linux)
run: sudo apt update && sudo apt install -y --no-install-recommends graphviz
if: startsWith(matrix.os, 'ubuntu')
- name: Install dependencies (MacOS)
run: brew install graphviz
if: startsWith(matrix.os, 'macos')
- name: Install TextWorld
run: |
python -m pip install --upgrade pip
pip install pytest pytest-azurepipelines pytest-cov
pip install --pre textworld[full]
- name: Run tests
run: |
pytest --durations=10 --junitxml=junit/test-results.xml --cov=textworld --cov-report=xml --cov-report=html tests/ textworld/
- uses: actions/upload-artifact@v4
with:
name: test-results
path: junit/test-results.xml