Skip to content

Commit

Permalink
Bump version to v0.1.0-alpha (#6)
Browse files Browse the repository at this point in the history
* Bump version to v0.1.0-alpha

* Fix warning

* Add relaese action

* Fix publish.yml

* Fix publish.yml

* Skip test CI when tags pushed

* Fix publish.yml

* Fix publish.yml

* Fix publish.yml

* Fix publish.yml

* Fix publish.yml

* Fix publish.yml

* Fix publish.yml

* Change repository

* verbose

* Debug

* Debug

* Debug

* Skip test of numpy.ipynb

* Fix

* Remove redundant import
  • Loading branch information
Ryosuke Kamesawa authored Mar 21, 2020
1 parent c4f4899 commit 71b2d82
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 14 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Publish

on:
release:
types: [created]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python: [3.6, 3.7, 3.8]
include:
- python: 3.6
python-name: cp36
- python: 3.7
python-name: cp37
- python: 3.8
python-name: cp38

steps:
- uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v1.1.1
with:
# Version range or exact version of a Python version to use, using semvers version range syntax.
python-version: ${{ matrix.python }} # optional, default is 3.x
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64 # optional, default is x64
- name: Set up a Rust toolchain
uses: hecrj/setup-rust-action@v1.3.1
with:
# The toolchain name, such as stable, nightly, or 1.8.0
rust-version: nightly # optional, default is stable
# The toolchain components to install, comma-separated
components: clippy # optional, default is
# The toolchain targets to add, comma-separated
# targets: # optional, default is
- name: Install build dependencies
run: pip install maturin jupyter numpy twine
- name: Build wheel
id: build-wheel
run: |
maturin build --release
wheel=`ls target/wheels/*${{ matrix.python-name }}*.whl`
echo $wheel
echo "::set-output name=wheel::$wheel"
- uses: actions/upload-artifact@v1
with:
name: wheels-${{ matrix.os }}-${{ matrix.python-name}}
path: target/wheels

upload:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-name: [cp36, cp37, cp38]

needs: build
steps:
- name: Setup Python environment
uses: actions/setup-python@v1.1.1
# with:
# Version range or exact version of a Python version to use, using semvers version range syntax.
# python-version: ${{ matrix.python }} # optional, default is 3.x
# The target architecture (x86, x64) of the Python interpreter.
# architecture: x64 # optional, default is x64
- name: Install twine
run: pip install twine
- name: Download artifact
uses: actions/download-artifact@v1.0.0
with:
name: wheels-${{ matrix.os }}-${{ matrix.python-name }}
- name: Get wheel name
id: wheel-name
run: |
ls
wheel=`ls */*${{ matrix.python-name }}*.whl`
echo $wheel
echo "::set-output name=wheel-path::$wheel"
- name: Upload to Release
uses: JasonEtco/upload-to-release@v0.1.1
with:
args: ${{ steps.wheel-name.outputs.wheel-path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to PyPI
# run: twine upload --repository-url https://test.pypi.org/legacy/ -u emakryo ${{ steps.wheel-name.outputs.wheel-path }}
run: twine upload -u emakryo ${{ steps.wheel-name.outputs.wheel-path }}
env:
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
TWINE_PASSWORD: $ {{ secrets.PYPI_PASSWORD }}
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Test

on: [push]
on:
push:
branches:
- '*'
tags:

jobs:
build:
Expand Down Expand Up @@ -45,7 +49,7 @@ jobs:
run: cargo clippy
- name: Build wheel
run: |
maturin build
maturin build --release
ls target/wheels
- uses: actions/upload-artifact@v1
with:
Expand All @@ -56,7 +60,9 @@ jobs:
run: pip install target/wheels/rustdef-*${{ matrix.python-name }}*.whl
- name: Execute examples
shell: bash
run: jupyter-nbconvert --ExecutePreprocessor.timeout=-1 --execute *.ipynb
# Skip numpy.ipynb due to problem w/ pyo3 https://github.com/PyO3/rust-numpy/issues/97
# ##[error]thread '<unnamed>' panicked at 'An error occurred while initializing class SliceBox', rustdef_cell_4f1f27901aca8ef8c2b7ba8fd8a3fd78760e5ae7/src/lib.rs:1:1
run: jupyter-nbconvert --debug --stdout --ExecutePreprocessor.timeout=-1 --execute 'Get started.ipynb' types.ipynb
working-directory: examples

test:
Expand Down Expand Up @@ -104,5 +110,5 @@ jobs:
- uses: actions/checkout@v2
- name: Execute examples
shell: bash
run: jupyter-nbconvert --ExecutePreprocessor.timeout=-1 --execute *.ipynb
run: jupyter-nbconvert --debug --stdout --ExecutePreprocessor.timeout=-1 --execute 'Get started.ipynb' types.ipynb
working-directory: examples
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustdef"
version = "0.1.0"
version = "0.1.0-alpha.2"
authors = ["Ryosuke Kamesawa <emak.ryo@gmail.com>"]
edition = "2018"

Expand Down Expand Up @@ -40,4 +40,4 @@ classifier = [
]
requires-python = ">=3.6"
requires-external = ["rust"]
project-url = ["https://github.com/emakryo/rustdef"]
project-url = ["Github, https://github.com/emakryo/rustdef"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Add dependencies
```

Define rust functions
```
```rust
%%rustdef
#[pyfunction]
fn my_func(x: i64, y: &str) -> i64 {
Expand Down
8 changes: 4 additions & 4 deletions examples/Get started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 16.1 ms, sys: 1.93 ms, total: 18 ms\n",
"Wall time: 18.1 ms\n"
"CPU times: user 16.9 ms, sys: 2.22 ms, total: 19.1 ms\n",
"Wall time: 18.7 ms\n"
]
},
{
Expand Down Expand Up @@ -287,8 +287,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 859 µs, sys: 1.05 ms, total: 1.91 ms\n",
"Wall time: 1.94 ms\n"
"CPU times: user 965 µs, sys: 956 µs, total: 1.92 ms\n",
"Wall time: 6.11 ms\n"
]
},
{
Expand Down
2 changes: 0 additions & 2 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use std::fmt::Display;
use std::fs;
use std::io::{copy, Cursor};
use std::path::Path;
use syn;
use zip;

fn runtime_error<E: Display>(e: E) -> PyErr {
RuntimeError::py_err(format!("{}", e))
Expand Down

0 comments on commit 71b2d82

Please sign in to comment.