From 08b38d97be4fec37bd2c1d5f8346dc448b38167e Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 May 2024 14:53:58 -0400 Subject: [PATCH 1/6] Start flatgfa-py CI This is the raw output of `maturin generate-ci github --pytest`, which doubtless needs some work. --- .github/workflows/flatgfa-py.yml | 177 +++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 .github/workflows/flatgfa-py.yml diff --git a/.github/workflows/flatgfa-py.yml b/.github/workflows/flatgfa-py.yml new file mode 100644 index 00000000..4f8ca4ab --- /dev/null +++ b/.github/workflows/flatgfa-py.yml @@ -0,0 +1,177 @@ +# This file is autogenerated by maturin v1.5.1 +# To update, run +# +# maturin generate-ci github --pytest +# +name: CI + +on: + push: + branches: + - main + - master + tags: + - '*' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-latest + target: x86_64 + - runner: ubuntu-latest + target: x86 + - runner: ubuntu-latest + target: aarch64 + - runner: ubuntu-latest + target: armv7 + - runner: ubuntu-latest + target: s390x + - runner: ubuntu-latest + target: ppc64le + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + shell: bash + run: | + set -e + pip install flatgfa --find-links dist --force-reinstall + pip install pytest + pytest + - name: pytest + if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} + uses: uraimo/run-on-arch-action@v2.5.0 + with: + arch: ${{ matrix.platform.target }} + distro: ubuntu22.04 + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y --no-install-recommends python3 python3-pip + pip3 install -U pip pytest + run: | + set -e + pip3 install flatgfa --find-links dist --force-reinstall + pytest + + windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + - runner: windows-latest + target: x86 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + architecture: ${{ matrix.platform.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} + shell: bash + run: | + set -e + pip install flatgfa --find-links dist --force-reinstall + pip install pytest + pytest + + macos: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: macos-latest + target: x86_64 + - runner: macos-14 + target: aarch64 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist + - name: pytest + if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} + shell: bash + run: | + set -e + pip install flatgfa --find-links dist --force-reinstall + pip install pytest + pytest + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [linux, windows, macos, sdist] + steps: + - uses: actions/download-artifact@v4 + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing wheels-*/* From 99a9d32369665c179c43d36a3a665dbab2a96644 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 May 2024 15:06:22 -0400 Subject: [PATCH 2/6] Add Python package metadata --- flatgfa-py/pyproject.toml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/flatgfa-py/pyproject.toml b/flatgfa-py/pyproject.toml index 19e5d9eb..86b926bb 100644 --- a/flatgfa-py/pyproject.toml +++ b/flatgfa-py/pyproject.toml @@ -1,3 +1,22 @@ +[project] +name = "flatgfa" +version = "0.1.0" +description = "efficient processing of pangenomes in Graphical Fragment Assembly (GFA) format" +readme = "README.md" +requires-python = ">=3.8" +license = "MIT" +keywords = ["genomics", "pangenomics", "gfa"] +classifiers = [ + "Scientific/Engineering :: Bio-Informatics", + "OSI Approved :: MIT License", +] + +[project.urls] +repository = "https://github.com/cucapra/pollen" + +[project.optional-dependencies] +test = ["pytest"] + [build-system] requires = ["maturin>=1.0,<2.0"] build-backend = "maturin" From 601cede32918dd25c442b1a3144f57da14f49a36 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 May 2024 15:09:07 -0400 Subject: [PATCH 3/6] Include manifest path in generated CI script As the comment mentions, this is the result of: maturin generate-ci github --pytest -m flatgfa-py/Cargo.toml -o .github/workflows/flatgfa-py.yml --- .github/workflows/flatgfa-py.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/flatgfa-py.yml b/.github/workflows/flatgfa-py.yml index 4f8ca4ab..d11080ae 100644 --- a/.github/workflows/flatgfa-py.yml +++ b/.github/workflows/flatgfa-py.yml @@ -1,7 +1,7 @@ # This file is autogenerated by maturin v1.5.1 # To update, run # -# maturin generate-ci github --pytest +# maturin generate-ci github --pytest -m flatgfa-py/Cargo.toml -o .github/workflows/flatgfa-py.yml # name: CI @@ -45,7 +45,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist + args: --release --out dist --manifest-path flatgfa-py/Cargo.toml sccache: 'true' manylinux: auto - name: Upload wheels @@ -60,7 +60,7 @@ jobs: set -e pip install flatgfa --find-links dist --force-reinstall pip install pytest - pytest + cd flatgfa-py && pytest - name: pytest if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} uses: uraimo/run-on-arch-action@v2.5.0 @@ -75,7 +75,7 @@ jobs: run: | set -e pip3 install flatgfa --find-links dist --force-reinstall - pytest + cd flatgfa-py && pytest windows: runs-on: ${{ matrix.platform.runner }} @@ -96,7 +96,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist + args: --release --out dist --manifest-path flatgfa-py/Cargo.toml sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 @@ -110,7 +110,7 @@ jobs: set -e pip install flatgfa --find-links dist --force-reinstall pip install pytest - pytest + cd flatgfa-py && pytest macos: runs-on: ${{ matrix.platform.runner }} @@ -130,7 +130,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist + args: --release --out dist --manifest-path flatgfa-py/Cargo.toml sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 @@ -144,7 +144,7 @@ jobs: set -e pip install flatgfa --find-links dist --force-reinstall pip install pytest - pytest + cd flatgfa-py && pytest sdist: runs-on: ubuntu-latest @@ -154,7 +154,7 @@ jobs: uses: PyO3/maturin-action@v1 with: command: sdist - args: --out dist + args: --out dist --manifest-path flatgfa-py/Cargo.toml - name: Upload sdist uses: actions/upload-artifact@v4 with: From 5799b0affb19bf02d612e19f379df3e61e754ad9 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 May 2024 15:35:12 -0400 Subject: [PATCH 4/6] Restrict paths for CI --- .github/workflows/flatgfa-py.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/flatgfa-py.yml b/.github/workflows/flatgfa-py.yml index d11080ae..048d5a36 100644 --- a/.github/workflows/flatgfa-py.yml +++ b/.github/workflows/flatgfa-py.yml @@ -3,17 +3,15 @@ # # maturin generate-ci github --pytest -m flatgfa-py/Cargo.toml -o .github/workflows/flatgfa-py.yml # -name: CI +name: flatgfa-py CI on: push: branches: - main - - master - tags: - - '*' pull_request: - workflow_dispatch: + paths: + - "flatgfa-py/**" permissions: contents: read @@ -40,13 +38,13 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} args: --release --out dist --manifest-path flatgfa-py/Cargo.toml - sccache: 'true' + sccache: "true" manylinux: auto - name: Upload wheels uses: actions/upload-artifact@v4 @@ -90,14 +88,14 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" architecture: ${{ matrix.platform.target }} - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} args: --release --out dist --manifest-path flatgfa-py/Cargo.toml - sccache: 'true' + sccache: "true" - name: Upload wheels uses: actions/upload-artifact@v4 with: @@ -125,13 +123,13 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} args: --release --out dist --manifest-path flatgfa-py/Cargo.toml - sccache: 'true' + sccache: "true" - name: Upload wheels uses: actions/upload-artifact@v4 with: From 6f34db3f98590b79df8138ca47de2ca13c688cec Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 May 2024 15:36:14 -0400 Subject: [PATCH 5/6] Remove a lot of architectures --- .github/workflows/flatgfa-py.yml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/.github/workflows/flatgfa-py.yml b/.github/workflows/flatgfa-py.yml index 048d5a36..4d0cb4d8 100644 --- a/.github/workflows/flatgfa-py.yml +++ b/.github/workflows/flatgfa-py.yml @@ -24,16 +24,6 @@ jobs: platform: - runner: ubuntu-latest target: x86_64 - - runner: ubuntu-latest - target: x86 - - runner: ubuntu-latest - target: aarch64 - - runner: ubuntu-latest - target: armv7 - - runner: ubuntu-latest - target: s390x - - runner: ubuntu-latest - target: ppc64le steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -59,21 +49,6 @@ jobs: pip install flatgfa --find-links dist --force-reinstall pip install pytest cd flatgfa-py && pytest - - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} - uses: uraimo/run-on-arch-action@v2.5.0 - with: - arch: ${{ matrix.platform.target }} - distro: ubuntu22.04 - githubToken: ${{ github.token }} - install: | - apt-get update - apt-get install -y --no-install-recommends python3 python3-pip - pip3 install -U pip pytest - run: | - set -e - pip3 install flatgfa --find-links dist --force-reinstall - cd flatgfa-py && pytest windows: runs-on: ${{ matrix.platform.runner }} @@ -82,8 +57,6 @@ jobs: platform: - runner: windows-latest target: x64 - - runner: windows-latest - target: x86 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 From 0e7a6af006bcc8569cad25bf650318a39c720318 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 May 2024 15:51:38 -0400 Subject: [PATCH 6/6] macOS action runner is ARM by default Currently, `macos-latest` is an ARM machine. We can build for both Intel and ARM on this machine, but we can only run the tests for the ARM version (because this Python is an ARM Python). --- .github/workflows/flatgfa-py.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flatgfa-py.yml b/.github/workflows/flatgfa-py.yml index 4d0cb4d8..dc5f0b61 100644 --- a/.github/workflows/flatgfa-py.yml +++ b/.github/workflows/flatgfa-py.yml @@ -90,7 +90,7 @@ jobs: platform: - runner: macos-latest target: x86_64 - - runner: macos-14 + - runner: macos-latest target: aarch64 steps: - uses: actions/checkout@v4 @@ -109,7 +109,7 @@ jobs: name: wheels-macos-${{ matrix.platform.target }} path: dist - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} + if: ${{ startsWith(matrix.platform.target, 'aarch64') }} shell: bash run: | set -e