From a0b8337b8fd8f48c6bf9b753dcfa13b00df219aa Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 8 Oct 2024 10:27:07 +0200 Subject: [PATCH] [WIP] Merge python workflow in other workflows --- .github/workflows/check_release.yml | 79 ++++++++++++++++ .github/workflows/ci.yml | 68 +++++++++++++- .github/workflows/pre_release.yml | 70 ++++++++++++++ .github/workflows/python.yml | 140 ---------------------------- .github/workflows/release.yml | 21 +++++ 5 files changed, 237 insertions(+), 141 deletions(-) delete mode 100644 .github/workflows/python.yml diff --git a/.github/workflows/check_release.yml b/.github/workflows/check_release.yml index f3f4b13..b5233cc 100644 --- a/.github/workflows/check_release.yml +++ b/.github/workflows/check_release.yml @@ -153,6 +153,71 @@ jobs: ${{ env.ASSET }} 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: --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 }}-${{ 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 + check-publication: name: Check cargo publication runs-on: ubuntu-latest @@ -175,3 +240,17 @@ 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 + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + with: + command: upload + args: --non-interactive --repository=testpypi --skip-existing wheels-*/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f2c904..51a18b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: jobs: build_and_test: - name: Rust project - latest + name: Rust runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -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: --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 }}-${{ 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 diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml index e2ba041..a7f7829 100644 --- a/.github/workflows/pre_release.yml +++ b/.github/workflows/pre_release.yml @@ -162,3 +162,73 @@ jobs: run: | version="${{ needs.create-release.outputs.version }}" gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }} + + 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: --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 + 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 }} + + diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml deleted file mode 100644 index 7cda9b4..0000000 --- a/.github/workflows/python.yml +++ /dev/null @@ -1,140 +0,0 @@ -# This file is autogenerated by maturin v1.5.1 -# To update, run -# -# maturin generate-ci github -# -name: Python wrapping - -on: - pull_request: - release: - types: [released] - -permissions: - contents: read - -jobs: - linux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Install dependencies - run: | - sudo apt-get install -y libfuse-dev - - 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-linux-x86_64 - path: python/dist - - windows: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: windows-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Checkout code - uses: actions/checkout@v4 - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - args: --release --out dist --find-interpreter - sccache: 'true' - working-directory: python - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-windows-x64 - path: python/dist - - macos: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: macos-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Install dependencies - 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' - working-directory: python - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-macos-x86_64 - path: python/dist - - 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 - - test-release: - name: Test Release - runs-on: ubuntu-latest - needs: [linux, windows, macos, sdist] - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v4 - - name: Publish to PyPI - uses: PyO3/maturin-action@v1 - with: - command: upload - args: --non-interactive --repository=testpypi --skip-existing wheels-*/* - - release: - name: Release - runs-on: ubuntu-latest - if: "github.event_name == 'release'" - needs: [linux, windows, macos, sdist] - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v4 - - name: Publish to PyPI - uses: PyO3/maturin-action@v1 - with: - command: upload - args: --non-interactive --skip-existing wheels-*/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49167b1..8048997 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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=${{TODO}} + gh release download "$version" -p "wheels-*/*" + + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + with: + command: upload + args: --non-interactive --skip-existing wheels-*/*