Skip to content

Commit

Permalink
Merge pull request #2033 from xlwings/reader-maturin
Browse files Browse the repository at this point in the history
Added file reader (PRO)
  • Loading branch information
fzumstein committed Oct 1, 2022
2 parents c0144cf + 3ffd028 commit 7e5b506
Show file tree
Hide file tree
Showing 64 changed files with 2,338 additions and 499 deletions.
13 changes: 13 additions & 0 deletions .cargo/config.toml
@@ -0,0 +1,13 @@
# Required to run cargo build on macOS
# https://pyo3.rs/main/building_and_distribution.html#macos
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
134 changes: 103 additions & 31 deletions .github/workflows/main.yml
Expand Up @@ -3,6 +3,7 @@ name: Build Pipeline
on:
# Run on all pushed commits, PRs and when a new release is created
# Prevents duplicate pipeline runs as a release also pushes a tag
workflow_dispatch:
pull_request:
push:
branches:
Expand All @@ -24,9 +25,8 @@ jobs:
with:
options: "--check --diff --color"

build:
# Prevent duplicate runs for own PRs
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
pre-build:
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
Expand All @@ -44,7 +44,7 @@ jobs:
uses: microsoft/setup-msbuild@v1.1
- name: Install Python dependencies
run: |
python -m pip install pythonnet wheel
python -m pip install pythonnet wheel setuptools-rust
- name: Install Aspose
shell: bash
run: |
Expand All @@ -58,12 +58,12 @@ jobs:
path: |
xlwings32.dll
xlwings64.dll
key: ${{ runner.os }}-${{ hashFiles('src/**') }}
key: ${{ runner.os }}-${{ hashFiles('xlwingsdll/**') }}
- name: Build dlls
if: steps.cache.outputs.cache-hit != 'true'
run: |
msbuild $Env:GITHUB_WORKSPACE\src\xlwings.sln /p:Configuration=Release -maxcpucount
msbuild $Env:GITHUB_WORKSPACE\src\xlwings.sln /p:Configuration=Release /p:Platform=x64 -maxcpucount
msbuild $Env:GITHUB_WORKSPACE\xlwingsdll\xlwings.sln /p:Configuration=Release -maxcpucount
msbuild $Env:GITHUB_WORKSPACE\xlwingsdll\xlwings.sln /p:Configuration=Release /p:Platform=x64 -maxcpucount
- name: Get Certificate
id: write_file
uses: timheuer/base64-to-file@2d34558844bc851d6a653f79b3720f44dc6bff53
Expand Down Expand Up @@ -115,43 +115,115 @@ jobs:
# Note that signtools is in ...\bin\x86
.\officesips\OffSign.bat "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\" "sign /f ${{ steps.write_file.outputs.filePath }} /p ${{ secrets.CODESIGN_PASSWORD }} /tr http://timestamp.sectigo.com /td sha256 /fd SHA256" "verify /pa" ".\xlwings\addin\xlwings.xlam"
# Code sign Excel add-in (end)
- name: Build Python Package
shell: bash
run: |
# TODO: change this to use the build package: python -m build
python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: Package
path: dist
name: pre-build
path: |
./*
!./git
!./aspose
!./xlwingsdll
!./resources
!./examples
!./docs
test:
if: github.ref == 'refs/heads/main'
name: Test installation
needs: build
runs-on: ${{ matrix.os }}
build:
needs: pre-build
name: Build wheel
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
architecture: ['x64']
# abi3 wheels aren't supported as DateTime is not part of the ABI spec (PEP 384)
python-version: ["3.7", "3.8", "3.9", "3.10"]
platform: [
{os: "windows-latest", target: "x86_64"},

{os: "macos-latest", target: "x86_64"},
{os: "macos-latest", target: "aarch64"},

{os: "ubuntu-latest", target: "x86_64"},
{os: "ubuntu-latest", target: "aarch64"},
{os: "ubuntu-latest", target: "armv7"},
{os: "ubuntu-latest", target: "x86_64", manylinux: "musllinux_1_1"},
{os: "ubuntu-latest", target: "aarch64", manylinux: "musllinux_1_1"},
]

runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: pre-build
- name: Copy files to root
shell: bash
run: |
shopt -s dotglob
mv pre-build/* ./
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
architecture: 'x64'
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Add aarch64-apple-darwin rust target
if: matrix.platform.os == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- name: Install Python dependencies
run: python -m pip install wheel setuptools-rust pytest

- name: Set up QEMU
# Required for Linux cross-compilation
if: matrix.platform.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build macOS and Linux wheels
if: matrix.platform.os != 'windows-latest'
uses: messense/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
manylinux: ${{ matrix.platform.manylinux || 'auto' }}
maturin-version: latest
command: build
args: --release --out dist --interpreter ${{ matrix.python-version }}

# TODO: Build with Maturin once the xlwings.dlls aren't data_files anymore
- name: Legacy Windows Build
if: matrix.platform.os == 'windows-latest'
shell: bash
env:
BUILD_RUST: 1
run: |
python -m pip install wheel
- name: Download artifacts
uses: actions/download-artifact@v1
rm pyproject.toml
python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Package
- name: Test installation
run: python scripts/ci_test.py
path: ./dist

- name: Tests
if: matrix.os.target == 'x86_64'
shell: bash
env:
XLWINGS_LICENSE_KEY: ${{ secrets.XLWINGS_LICENSE_KEY }}
run: |
python -m pip install xlwings --no-index --find-links dist --force-reinstall --no-deps
cd ..
python -c "import xlwings;print(xlwings.__version__)"
python -c "import xlwings;print(xlwings.__path__)"
XLWINGS_ENGINE=remote pytest xlwings/tests/test_engines/test_engines.py
XLWINGS_ENGINE=calamine pytest xlwings/tests/test_engines/test_engines.py
xlwings quickstart testproject1
publish:
if: github.event_name == 'release'
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -81,4 +81,6 @@ aspose.cells
venv


scratch*
scratch*

target/

0 comments on commit 7e5b506

Please sign in to comment.