-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitLab pipeline support in maturin generate-ci
#1507
Comments
Workaround-For: PyO3/maturin#1507
I'm trying to create PR for this issue and would love to get some thoughts about the implementation. Gitlab CI essentially is different from github actions and thus I think not all logics built in the I'd imagine that the generated CI pipeline for gitlab would look sth like below:
The problem with starting with |
We can start from scratch, but we should only use |
Hi, I'm quite interested in this too as I will try to set up a gitlab pipeline for my project. What's the best practice currently? Is there documentation somewhere already? |
Sorry I don't know much about gitlab pipeline, we can come up with a basic one first and optimize later. |
Hi there, @mpizenberg are you still working on this? I've already setup a gitlab pipeline for my project using maturin and I'm interested to add a minimal version for review. |
@shehab-as Feel free to open a PR. |
@shehab-as could you share your gitlab yaml? Happy to collaborate on a PR. I have a rough untested draft of how I'd lay this out to achieve parallelization on different platforms and caching. I think if we can pin down a valid gitlab yaml that covers all the edge cases that's the best starting point - then we can figure out how to build it dynamically in the default:
before_script:
- poetry config virtualenvs.in-project true
cache:
paths:
- .venv
- .cargo/bin
- .cargo/registry/index
- .cargo/registry/cache
- target/debug/deps
- target/debug/build
variables:
CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
stages:
- build
- test
- publish
build-general:
needs: []
stage: build
image: ghcr.io/pyo3/maturin:latest
environment:
name: $TARGET
tags:
- $TARGET
parallel:
matrix:
- TARGET: ["x86_64", "x86", "aarch64", "armv7", "s390x", "ppc64le"]
script:
- maturin build --release --out dist --find-interpreter --target $TARGET
artifacts:
when: on_success
paths:
- dist/
build-musl:
needs: []
stage: build
image: alpine
script:
- maturin build --release --out dist --find-interpreter --target 'musl value goes here'
artifacts:
when: on_success
paths:
- dist/
test:
needs: [build-general, build-musl]
stage: test
script:
- maturin develop
- pip install pytest
- pytest
tags:
- $IMAGE
parallel:
matrix:
- IMAGE: ["linux", "windows", "macos"]
image: $IMAGE
publish:
needs: [build-general, build-musl, test]
stage: test
image: ghcr.io/pyo3/maturin:latest
dependencies: [build-general, build-musl]
script:
- maturin publish --non-interactive --skip-existing
|
@osintalex Feel free to take it over if there is no response/PR from @shehab-as for several weeks. |
@osintalex hey, thanks for sharing. Here's a refined (and untested) version of my gitlab-ci yaml. Happy to collaborate on a PR. I've already made some progress in my fork, I can add you to the PR once I push latest changes in my branch, and from there we can discuss a "comprehensive" version of gitlab-ci per your proposal.
|
@messense apologies I've been occupied the last couple of weeks. Picking this up now. |
Hey, sounds good! Feel free to add me to the fork and we can take it from there :-) |
@osintalex I've sent you an invite and created a draft PR to start collaborating on this. |
Thanks! Taking a look now :-) |
Had a look and made some changes to get the yaml working in Gitlab with cross-compilation support for linux/macos/windows which are tier 1 rust targets. I think that's probably good enough for a first pass on this. Haven't got cross compilation working for windows though even though I think that's possible from the docs - would appreciate help with this! This is my CI yaml and this is an example pipeline. For windows, I've been trying to get it working by adding the appropriate Pyo3 feature with Also open to other ways of doing this for windows, I couldn't really figure out how the github actions stuff does it since the github CI mostly just links to other actions and I found the repos for those actions fairly opaque. |
Don't bother with zig windows cross compiling, it does not work for MSVC target yet and has issue with GNU target. #922 BTW |
Sorry - just made it public. Thanks, will refactor to stop trying to cross compile to windows.
…On Tue, Apr 23, 2024 at 02:41, messense ***@***.***(mailto:On Tue, Apr 23, 2024 at 02:41, messense <<a href=)> wrote:
> For windows, I've been trying to get it working by adding the appropriate Pyo3 feature with cargo add pyo3 -F generate-import-lib and then based off [these](https://docs.rs/python3-dll-a/latest/python3_dll_a/) docs using the ZIG_COMMAND env var since I've already installed and cached zig from targeting linux/mac. But that doesn't seem to work :-(
Don't bother with zig windows cross compiling, it does not work for MSVC target yet and has issue with GNU target. [#922](#922)
—
Reply to this email directly, [view it on GitHub](#1507 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/APHRW4QSDDV6FZNAS6JEMXDY6W35JAVCNFSM6AAAAAAVL2VRI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZRGI2TIOJVG4).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks @osintalex! I don't have enough permission to start a PR with refactored CI in your gitlab repo. However, I've updated your latest yml file on my PR supporting only target As you've mentioned earlier, I think we're in a good state now with an end-to-end version of the gitlab-ci for tier 1 rust targets. I've added the final version in |
Ah sorry, yeah I just made that repo since needed somewhere to actually test that yaml. As is evident from this thread I have not really set it up properly :-( . Just gave you a review and v happy to collaborate, I just wanted to start from a working gitlab pipeline if that makes sense. Left you some comments and gonna try and sort out windows cross compilation without using zig. |
Thanks! Sorry I forgot to submit my review lol. I just pushed your latest gitlab yaml to my repo after playing around some more, I think it's the closest we've got to this :-) Erm @messense or anyone else who knows compilation to windows well, do you have any thoughts on how we could add support for more windows targets? Adding more targets here leads to pipeline failures. Achieving this is complicated by the fact that gitlab doesn't support windows images out of the box like github does, so imo we need to find a way to cross compile to windows in a default template. That or use some kind of windows base docker image but afaik that doesn't exist. I've tried getting this to work using a fedora base image but haven't had any luck yet. |
For anyone reading this. If you're looking for a windows build on GitLab, your best option is to select a Windows-based runner on GitLab by using the available tag(s) from their docs here in your gitlab-ci file. |
I don't use GitLab so I'm not going to work on this anytime soon, help appreciated!
The text was updated successfully, but these errors were encountered: