Skip to content

Commit

Permalink
Merge pull request #67 from jubako/python_ci_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr authored Oct 9, 2024
2 parents 60f28bc + 820170b commit e9a62d8
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 127 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/check_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,70 @@ jobs:
${{ env.ASSET }}
compression-level: 0

python:
name: Python wrapping
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y libfuse-dev
- name: Install dependencies
if: ${{ matrix.os == 'macos-latest'}}
run: |
brew install macfuse
- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Checkout code
uses: actions/checkout@v4

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
sccache: 'true'
container: off
working-directory: python

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: python/dist
compression-level: 0

python-sdist:
name: Python sdist
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: python
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: python/dist

check-publication:
name: Check cargo publication
runs-on: ubuntu-latest
Expand All @@ -175,3 +239,19 @@ jobs:
#cargo publish --dry-run -p arx
#cargo publish --dry-run -p tar2arx
#cargo publish --dry-run -p zip2arx
python-check-publication:
name: Check pypi publication
runs-on: ubuntu-latest
needs: [python, python-sdist]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --repository=testpypi --skip-existing wheels-*/*
68 changes: 67 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:

jobs:
build_and_test:
name: Rust project - latest
name: Rust
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -64,6 +64,72 @@ jobs:
target/debug/auto_mount
compression-level: 0


python:
name: Python wrapping
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y libfuse-dev
- name: Install dependencies
if: ${{ matrix.os == 'macos-latest'}}
run: |
brew install macfuse
- name: Checkout code
uses: actions/checkout@v4

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --out dist --find-interpreter
sccache: 'true'
container: off
working-directory: python

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.toolchain }}
path: python/dist
compression-level: 0

python-sdist:
name: Python sdist
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: python
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: python/dist

compilation_32bits:
name: Test 32 bits compilation
runs-on: ubuntu-latest
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,69 @@ jobs:
run: |
version="${{ needs.create-release.outputs.version }}"
gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }}
python:
name: Python wrapping
needs: ['create-release']
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y libfuse-dev
- name: Install dependencies
if: ${{ matrix.os == 'macos-latest'}}
run: |
brew install macfuse
- name: Checkout code
uses: actions/checkout@v4

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
sccache: 'true'
container: off
working-directory: python

- name: Upload wheels
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
version="${{ needs.create-release.outputs.version }}"
gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }}
python-sdist:
name: Python sdist
needs: ['create-release']
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: python
- name: Upload sdist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
version="${{ needs.create-release.outputs.version }}"
gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }}
126 changes: 0 additions & 126 deletions .github/workflows/python.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,24 @@ jobs:
cargo publish -p arx
cargo publish -p tar2arx
cargo publish -p zip2arx
do_python_publication:
name: Publish on PyPi
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Get wheels & dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
version=${{ github.event.release.name }}
gh release download "$version" -p "wheels-*"
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing wheels-*
Loading

0 comments on commit e9a62d8

Please sign in to comment.