You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to get binary releases automatically for pyo3-pack, I had to do look into many existing projects and do much experimenting. That's why I thought I might eventually want to make a template out of this and have created a template-like configuration. I also thought about a CLI for configuring everything (maybe even with ability to add/remove features such as coverage in existing projects), so I'm pretty excited about this project!
I had a slightly different focus, which is that I wanted a minimal configuration without any extra files, but don't need real cross compilation. I still think that crossgen could profit from merging those configurations in.
language: rustenv:
global:
# Change this to the name of your binary
- BINARY_NAME="pyo3-pack"addons:
apt:
packages: [] # If your project needs any system packages add them herematrix:
fast_finish: trueinclude:
# These create deployments
- os: linuxrust: stableenv: TARGET=x86_64-unknown-linux-gnu
- os: osxrust: stableenv: TARGET=x86_64-apple-darwin# Those are only tested
- os: linuxrust: betaenv: TARGET=x86_64-unknown-linux-gnu
- os: linuxrust: nightlyenv: TARGET=x86_64-unknown-linux-gnu# Minimum Rust supported channel
- os: linuxrust: 1.27.0env: TARGET=x86_64-unknown-linux-gnuscript:
- cargo test --target $TARGETbefore_deploy:
- cargo build --release
- cd target/release/# You can add more file to the archive by adding them to this line
- tar czf ../../${BINARY_NAME}-$TRAVIS_TAG-$TARGET.tar.gz ${BINARY_NAME}
- cd ../..deploy:
# Add zipped binary to the github releaseprovider: releasesfile: ${BINARY_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gzskip_cleanup: trueon:
condition: $TRAVIS_RUST_VERSION = stabletags: true# - Create a `public_repo` GitHub token at https://github.com/settings/tokens/new# . If you haven't already, install the travis gem: `gem install TRAVIS_TAG`# - Encrypt it with `travis encrypt 0123456789012345678901234567890123456789`# - Paste the output down hereapi_key:
secure: "bKY3J8FBwgit9inzp2CMxQC3icBVco+COcRnqM6NhaOWX3KefXYG/yWQ7htBkeTRAfQERlOkZZOPsOto2dAD49/Mo4Uin9wbRPjPDGPJpFcQofX5aKHqK1Xd1k96rtZKZRIEG5k5J2IKAzPso3GnA0FESAZlZbxEShSCBD6aOlVmjFXwB2kKzJDo9zECxCg84GSvR/7wQg4hwMaMBa79y3VJRCohGTMaISL22QJ0haG+gqZgTv/r9K8P9lwSMBIiTXX3wFJU871sqUNTSSwkmHlVLhVUOwluv+KQ2DI/V/gWfx2CuiZ/7OQlz4zkOB/Y56msH0G7vOwqbSHLwkMYC+zgDWvF0oI/Eb/mdY5VliQdsLDOkKwWm3EuoEUvCgyV9UB1POxxogIx1sAU+Vt9QUj5/cRIJc1zrtA3LdNlbg9M9rYG8jJ6JMbeYTFDTL6YNoHc2lPAdmAqQAZQy6vyR515vm76JfS7yDcLRXKKhLE4dEPUEpv0qU8vCA/FdaZaiW+GJZSS5rJoE0vHaMRsWkgFLqCNSDpUZBd2x60E+n6dQ7XX4DrJ1JmzcG+IZ6AfuIWyRD9s3jQBxRjtyM61ZGo3Nb4zwX2ML1PftNURNAo8rPlgIrqPaveic45hP6PAeX+iMIWzTckq8shlYngjBTw/3UmA8Z18udrRyKCbygs="cache: cargobranches:
only:
# Pushes to the master branch
- master# Match release tags with a regex
- /^v\d+\.\d+\.\d+.*$/notifications:
email:
on_success: never
appveyor.yml
environment:
# Change this to the name of your binaryBINARY_NAME: "unnamed-ci-template.exe"CARGO_HOME: "c:\\cargo"RUSTUP_HOME: "c:\\rustup"global:
RUST_BACKTRACE: fullmatrix:
# 32-bit
- TARGET: i686-pc-windows-gnuCHANNEL: stable
- TARGET: i686-pc-windows-msvcCHANNEL: stable# 64-bit
- TARGET: x86_64-pc-windows-gnuCHANNEL: stable
- TARGET: x86_64-pc-windows-msvcCHANNEL: stablematrix:
fast_finish: true# Install Rust and Cargo# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml)install:
- ps: | # For the gnu target we need gcc, provided by mingw. mingw which is already preinstalled, # but we need to add the right version (32-bit or 64-bit) to the PATH. # See https://www.appveyor.com/docs/build-environment/#mingw-msys-cygwin if ($env:target -like "*-gnu") { if ($env:target -like "x86_64-*") { # x86_64-pc-windows-gnu $env:path += ";C:\msys64\mingw64\bin" } else { # i686-pc-windows-gnu $env:path += ";C:\msys64\mingw32\bin" } gcc --version }
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -yv --default-host %TARGET% --no-modify-path
- SET PATH=%PATH%;%CARGO_HOME%\bin
- rustc -V
- cargo -Vtest_script:
- cargo testbefore_deploy:
- cargo build --release# Grab the binary and pack it into a zip archive
- cd target\release\# You can add more file to the archive by adding them to this line
- 7z a ../../%APPVEYOR_PROJECT_SLUG%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip %BINARY_NAME%
- appveyor PushArtifact ../../%APPVEYOR_PROJECT_SLUG%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zipdeploy:
# Add zipped binary to the github release
- artifact: /.*\.zip/# - Create a `public_repo` GitHub token at https://github.com/settings/tokens/new# - Encrypt it at https://ci.appveyor.com/tools/encrypt# - Paste the output down hereauth_token:
secure: PQ91ezDbGmow+5tjZCAQ2/Y/2bHFffmQZoa5lr09JQIwARsAa2jHtucVn9826lWGprovider: GitHubon:
# Deploy when a new tag is pushed and only on the stable channel# Make sure you only release *once* per targetCHANNEL: stableappveyor_repo_tag: truecache:
- '%CARGO_HOME%\registry'
- target
- '%RUSTUP_HOME%'branches:
only:
# Pushes to the master branch
- master# Match release tags with a regex
- /^v\d+\.\d+\.\d+.*$/build: off # Otherwise appveyor assumes we're building a .NET project
I also wrote a few words about how to use those templates and how to add badges, which might be useful:
Setup
This assumes you already have project on github and now want to add CI to it.
Start by copying .travis.yml and appveyor.yml from this repository.
Change the value of BINARY_NAME in appveyor.yml, just this time with .exe at the end.
Make a commit with your changes and push it. The first build will take loner than subsequent builds since the caches are not yet initialized.
You can easily add other targets, e.g. nightly rust on windows, by adding them in the respective matrix list. Just make sure that you the target that get attach to releases don't clash.
Badges
The following snippet adds travis, appveyor, crates.io and docs.rs badges to your readme. Those ci badges are for the master branch, meaning that a broken pull request won't show you ci as broken. Note that appveyor is a bit weird: You needd the project id, which you can find e.g. under settings -> badges, and also the link to the project doesn't use the project's organization's name, but the name of the user that registered at appveyor.
[![Linux and Mac Build Status](https://img.shields.io/travis/{org}/{repo}/master.svg?style=flat-square)](https://travis-ci.org/{org}/{repo})[![Windows Build status](https://ci.appveyor.com/api/projects/status/github/{repo}/{repo}?branch=master&svg=true)](https://ci.appveyor.com/project/{username}/{repo}/branch/master)[![Crates.io](https://img.shields.io/crates/v/{crate-name}.svg?style=flat-square)](https://crates.io/crates/pyo3-pack)[![API Documentation on docs.rs](https://docs.rs/{crate-name}/badge.svg)](https://docs.rs/pyo3-pack)
Don't forget that you can also add those badges to your Cargo.toml:
@konstin thanks so much for sharing! Everything you've shared has been super helpful to know!
There's an issue specifically about packaging apps cross-platform here. It seems you've done a bit of research on it, and input would be greatly valued!
Regarding badges: perhaps we should add a flag to crossgen to generate them? Does that sound like something you would like to add to the project?
There's an issue specifically about packaging apps cross-platform here. It seems you've done a bit of research on it, and input would be greatly valued!
The research I've done is summarized in the post above, so I doubt I could contribute much there.
Regarding badges: perhaps we should add a flag to crossgen to generate them? Does that sound like something you would like to add to the project?
Thanks, but I don't want to start contributing to yet another project.
Trying to get binary releases automatically for pyo3-pack, I had to do look into many existing projects and do much experimenting. That's why I thought I might eventually want to make a template out of this and have created a template-like configuration. I also thought about a CLI for configuring everything (maybe even with ability to add/remove features such as coverage in existing projects), so I'm pretty excited about this project!
I had a slightly different focus, which is that I wanted a minimal configuration without any extra files, but don't need real cross compilation. I still think that crossgen could profit from merging those configurations in.
Since you mentioned snap on twitter: Ubuntu has there own ci-like service for building snaps. Unfortunately the rust plugin is completely broken and apparently unmaintained, see https://forum.snapcraft.io/t/the-rust-plugin-sets-an-invalid-manifest-path/6565 and the issue tracker.
.travis.yml
appveyor.yml
I also wrote a few words about how to use those templates and how to add badges, which might be useful:
The text was updated successfully, but these errors were encountered: