Skip to content

Commit

Permalink
Add Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Aug 12, 2023
1 parent 828096c commit 2edee9a
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 44 deletions.
117 changes: 75 additions & 42 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,56 @@ jobs:
# name: wheels
# path: dist

# windows:
# runs-on: windows-latest
# strategy:
# matrix:
# target: [x64]
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: 'true'

# - uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# architecture: ${{ matrix.target }}

# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# args: --release --out dist --find-interpreter
# sccache: 'true'
windows:
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: windows-latest
env:
# Disable output buffering in an attempt to get readable errors
PYTHONUNBUFFERED: '1'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'

# - name: Upload wheels
# uses: actions/upload-artifact@v3
# with:
# name: wheels
# path: dist
- name: Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc

- name: Build
shell: bash
run: |
pip install -r requirements.txt
python setup.py bdist_wheel --py-limited-api=cp37
pip install --force-reinstall dist/*.whl
python -c "import icicle"
- name: Test
run: |
pip install -r tests/requirements.txt
python tests/example.py
python tests/invalid.py
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

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

release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
needs:
- windows
- macos
#- linux
steps:
- uses: actions/download-artifact@v3
with:
name: wheels

# release:
# name: Release
# runs-on: ubuntu-latest
# if: "startsWith(github.ref, 'refs/tags/')"
# needs: [linux, windows, macos]
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: wheels
# - name: Publish to PyPI
# uses: PyO3/maturin-action@v1
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
# with:
# command: upload
# args: --skip-existing *
- name: Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Package
run: |
python setup.py sdist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
with:
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Release
uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d # master 2023-03-26
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = icicle-emu
version = v1.0.0
version = 0.0.1
url = https://github.com/mrexodia/icicle-python
project_urls =
Bug Tracker = https://github.com/mrexodia/icicle-python/issues
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python

import sys
from os import getenv
from shutil import which
from setuptools import find_packages, setup
from setuptools_rust import RustExtension

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

ref_name = getenv("GITHUB_REF_NAME")
Expand Down

0 comments on commit 2edee9a

Please sign in to comment.