-
Notifications
You must be signed in to change notification settings - Fork 10
157 lines (154 loc) · 4.91 KB
/
build.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: CI
on:
push:
pull_request:
jobs:
readme:
container: iquiw/alpine-emacs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: emacs --batch README.org --eval '(org-md-export-to-markdown)'
- uses: actions/upload-artifact@v4
with:
name: README
path: README.md
test:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-13, macos-14, windows-latest]
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
numpy: ["numpy<2.0.0", "numpy>=2.0.0rc2"]
gym: ['gym', 'gymnasium']
exclude:
- python: "3.8"
numpy: "numpy>=2.0.0rc2"
fail-fast: false
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
shell: bash
- name: pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip${{ matrix.python }}
restore-keys: ${{ runner.os }}-pip${{ matrix.python }}
- name: Install NumPy
run: pip install '${{ matrix.numpy }}'
- name: Install cpprb
run: pip install '.[all]'
- name: Install Gym(nasium)
run: pip install ${{ matrix.gym }}
- run: python -m unittest discover . '*.py'
working-directory: './test'
build_winmac:
needs: readme
strategy:
matrix:
runs-on: [macos-13, macos-14, windows-latest]
fail-fast: false
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.8
3.9
3.10
3.11
3.12
- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
shell: bash
- name: pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
- uses: actions/download-artifact@v4
with:
name: README
path: README
- run: mv README/README.md README.md
- run: pip3.8 wheel . -w dist --no-deps
- run: pip3.9 wheel . -w dist --no-deps
- run: pip3.10 wheel . -w dist --no-deps
- run: pip3.11 wheel . -w dist --no-deps
- run: pip3.12 wheel . -w dist --no-deps
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.runs-on }}
path: dist
- name: Upload to PyPI
run: python -m twine upload -u __token__ -p ${{ secrets.pypi_password }} --skip-existing dist/cpprb-*
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')
continue-on-error: true
build_targz:
needs: readme
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- uses: actions/download-artifact@v4
with:
name: README
path: README
- run: mv README/README.md README.md
- run: python setup.py build_ext sdist
- uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist
- run: pip install twine
- name: Upload to PyPI
run: python -m twine upload -u __token__ -p ${{ secrets.pypi_password }} --skip-existing dist/cpprb-*tar.gz
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')
build_manylinux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["x86_64", "aarch64"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3'
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.arch }} == "aarch64"
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
push: false
build-args: |
ON_CI=1
arch=${{ matrix.arch }}
file: Dockerfile
cache-to: type=gha,mode=max,scope=${{github.ref_name}}
cache-from: type=gha,scope=${{github.ref_name}}
load: true
tags: cpprb/wheel:latest
- run: |
docker create --name wheel cpprb/wheel:latest
docker cp wheel:/dist/. dist/
- uses: actions/upload-artifact@v4
with:
name: dist-manylinux-${{ matrix.arch }}
path: dist
- run: pip install twine
- name: Upload to PyPI
run: python -m twine upload -u __token__ -p ${{ secrets.pypi_password }} --skip-existing dist/cpprb-*
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')