One thing you might want to do at some stage is set up continuous integration.
I was looking for an option that gave me rust support and windows, mac and linux builds. Travis does offer all of that and is free to use for open source projects. I spent too much time setting it up, especially with the uploading part, so here we go:
language: rust
rust:
- nightly-2019-06-24
cache: cargo
script:
- cargo build --release
- git config --local user.name "Johann Woelper"
- git config --local user.email "woelper@gmail.com"
os:
- linux
- osx
- windows
before_deploy:
- cd $TRAVIS_BUILD_DIR
- export TRAVIS_TAG="latest"-$TRAVIS_OS_NAME
deploy:
provider: releases
skip_cleanup: true
file_glob: true
# draft: true
overwrite: true
name: $TRAVIS_OS_NAME
file:
- target/release/my_executable
- target/release/my_executable.exe
api_key:
secure: <done with travis setup releases>
First of all, I wanted to pin a specific nightly version because a dependency did not work with the latest nightly - and by default travis installs the latest before building. You can now specify a specific version like nightly-2019-06-24
.
Next up, on the os:
section all operating systems are added
in the script:
section, declare your git credentials
before deploy:
will run on each VM that has spun up, so that's where we set the TRAVIS_TAG
to the tag we want for our build and change to the build dir.
This will create three releases, one for each OS. If you want to have a single release make sure you have unique executable names for each operating systems - then you could set draft
to true
so the release does not trigger at each os
build step and realease it after all builds are done.
Lastly, travis setup releases
is convenient to modify your config file automatically with the correct oauth token.