Skip to content

Commit

Permalink
Create libs for all py versions and platforms (DrInfy#24)
Browse files Browse the repository at this point in the history
* Change py-lib name and add maturin develop to workflow

* Remove interpreter arg from maturin develop

* Archive for every version

* Remove debuginfo from release build

* Try activating windows venv

* Don't rename Windows 3.7 lib
  • Loading branch information
danielvschoor authored Jun 1, 2021
1 parent 612af48 commit c2baeb1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/rust_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable]
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8, 3.9]

steps:
# https://github.com/actions-rs/toolchain
Expand All @@ -23,11 +23,13 @@ jobs:
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -59,33 +61,40 @@ jobs:
- name: Create artifact directory
run: mkdir artifacts

# TODO only one .so file needs to be built and it can be run from any python version on the linux distribution, and this probably also works on mac
- name: Create archive for Linux
# Create venv
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install Dependencies
run: |
sudo apt-get install tree
tree target/release
mv ./target/release/libsc2pathlib.so ./artifacts/sc2pathlib.so
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
python -m pip install --upgrade pip
pip install virtualenv
- name: Create archive for Windows
- name: Create virtualenv && Activate Linux/Mac
if: matrix.os != 'windows-latest'
run: |
dir target/release
dir
python ./rename_output.py ${{ matrix.python-version }}
if: matrix.os == 'windows-latest'
virtualenv venv
source venv/bin/activate
pip install maturin
maturin develop --release
- name: Create archive for Mac OS
- name: Create virtualenv && Activate Windows
if: matrix.os == 'windows-latest'
run: |
mv ./target/release/libsc2pathlib.dylib ./artifacts/sc2pathlib-macos.so
if: matrix.os == 'macos-latest'
virtualenv venv
venv\Scripts\Activate.ps1
pip install maturin
maturin develop --release
# See - https://github.com/actions/upload-artifact/issues/39
- uses: actions/upload-artifact@v1
name: Upload archive
with:
name: ${{ matrix.os }}_python${{ matrix.python-version }}
path: artifacts/
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7' || matrix.os == 'windows-latest' || matrix.os == 'macos-latest'
path: sc2pathlib/

benchmark:
name: Performance regression check
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "sc2pathlib"
version = "0.4.0"
edition = "2018"

authors = []
[lib]
bench = false
name = "sc2pathlib"
Expand All @@ -25,7 +25,7 @@ harness = false

[profile.release]
opt-level = 3
debug=true
debug=false
# panic="abort"
# lto = "fat"
# codegen-units = 1
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c2baeb1

Please sign in to comment.