Skip to content

Commit a63bf5a

Browse files
committed
Add Windows CI
1 parent 828096c commit a63bf5a

File tree

3 files changed

+80
-46
lines changed

3 files changed

+80
-46
lines changed

.github/workflows/CI.yml

Lines changed: 75 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,56 @@ jobs:
3232
# name: wheels
3333
# path: dist
3434

35-
# windows:
36-
# runs-on: windows-latest
37-
# strategy:
38-
# matrix:
39-
# target: [x64]
40-
# steps:
41-
# - uses: actions/checkout@v3
42-
# with:
43-
# submodules: 'true'
44-
45-
# - uses: actions/setup-python@v4
46-
# with:
47-
# python-version: '3.10'
48-
# architecture: ${{ matrix.target }}
49-
50-
# - name: Build wheels
51-
# uses: PyO3/maturin-action@v1
52-
# with:
53-
# target: ${{ matrix.target }}
54-
# args: --release --out dist --find-interpreter
55-
# sccache: 'true'
35+
windows:
36+
# Skip building pull requests from the same repository
37+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
38+
runs-on: windows-latest
39+
env:
40+
# Disable output buffering in an attempt to get readable errors
41+
PYTHONUNBUFFERED: '1'
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v3
45+
with:
46+
submodules: 'true'
5647

57-
# - name: Upload wheels
58-
# uses: actions/upload-artifact@v3
59-
# with:
60-
# name: wheels
61-
# path: dist
48+
- name: Python environment
49+
uses: actions/setup-python@v4
50+
with:
51+
python-version: '3.10'
52+
53+
- name: Install Rust toolchain
54+
uses: dtolnay/rust-toolchain@stable
55+
with:
56+
targets: x86_64-pc-windows-msvc
57+
58+
- name: Build
59+
shell: bash
60+
run: |
61+
pip install -r requirements.txt
62+
python setup.py bdist_wheel --py-limited-api=cp37
63+
pip install --force-reinstall dist/*.whl
64+
python -c "import icicle"
65+
66+
- name: Test
67+
run: |
68+
pip install -r tests/requirements.txt
69+
python tests/example.py
70+
python tests/invalid.py
71+
72+
- name: Upload wheels
73+
uses: actions/upload-artifact@v3
74+
with:
75+
name: wheels
76+
path: dist
6277

6378
macos:
6479
# Skip building pull requests from the same repository
6580
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
6681
runs-on: macos-latest
82+
env:
83+
# Disable output buffering in an attempt to get readable errors
84+
PYTHONUNBUFFERED: '1'
6785
steps:
6886
- name: Checkout
6987
uses: actions/checkout@v3
@@ -105,20 +123,35 @@ jobs:
105123
name: wheels
106124
path: dist
107125

126+
release:
127+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
128+
runs-on: ubuntu-latest
129+
needs:
130+
- windows
131+
- macos
132+
#- linux
133+
steps:
134+
- uses: actions/download-artifact@v3
135+
with:
136+
name: wheels
108137

109-
# release:
110-
# name: Release
111-
# runs-on: ubuntu-latest
112-
# if: "startsWith(github.ref, 'refs/tags/')"
113-
# needs: [linux, windows, macos]
114-
# steps:
115-
# - uses: actions/download-artifact@v3
116-
# with:
117-
# name: wheels
118-
# - name: Publish to PyPI
119-
# uses: PyO3/maturin-action@v1
120-
# env:
121-
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
122-
# with:
123-
# command: upload
124-
# args: --skip-existing *
138+
- name: Python environment
139+
uses: actions/setup-python@v4
140+
with:
141+
python-version: '3.10'
142+
143+
- name: Package
144+
run: |
145+
python setup.py sdist
146+
147+
- name: Publish to PyPI
148+
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
149+
with:
150+
password: ${{ secrets.PYPI_API_TOKEN }}
151+
152+
- name: Release
153+
uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d # master 2023-03-26
154+
with:
155+
generate_release_notes: true
156+
env:
157+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

setup.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = icicle-emu
3-
version = v1.0.0
3+
version = 0.0.1
44
url = https://github.com/mrexodia/icicle-python
55
project_urls =
66
Bug Tracker = https://github.com/mrexodia/icicle-python/issues
@@ -22,6 +22,8 @@ classifiers =
2222

2323
[options]
2424
packages = icicle
25+
package_dir =
26+
= python
2527
zip_safe = False
2628
setup_requires = setuptools-rust >= 0.12.1;
2729
python_requires = >=3.7

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env python
22

3+
import sys
34
from os import getenv
45
from shutil import which
56
from setuptools import find_packages, setup
67
from setuptools_rust import RustExtension
78

89
if __name__ == "__main__":
9-
if which("cargo") is None:
10+
if "sdist" not in sys.argv and which("cargo") is None:
1011
raise FileNotFoundError(f"Rust not found, visit https://rustup.rs for installation instructions")
1112

1213
ref_name = getenv("GITHUB_REF_NAME")
@@ -26,7 +27,5 @@
2627
pass
2728

2829
setup(
29-
packages=find_packages(where="python", exclude=["icicle/__pycache__"]),
30-
package_dir={"": "python"},
3130
rust_extensions=[RustExtension("icicle.icicle")],
3231
)

0 commit comments

Comments
 (0)