At work we have a bunch of internal projects using Rust and can’t publish them to crates.io (they’re part of our product). We used to use GitLab Pages to host documentation, but then switched to a private S3 bucket because GitLab Pages will serve content anyone (i.e. you can’t stop outsiders from seeing our internal docs).
I can’t share the config we use at work, but here’s a fairly similar one I’ve got for one of my personal projects:
- rustc --version && cargo --version
- cargo build --verbose --all
- cargo test --verbose --all
- cargo doc --all
- cp -R target/doc ./crate-docs
- echo "<meta http-equiv=refresh content=0;url=foo/index.html>" > ./crate-docs/index.html
# Upload the generated documentation to S3. Taken mostly from:
- mkdir public
- mv crate-docs public/crate-docs
- aws s3 sync public s3://foo.xyz.com --size-only --only-show-errors
Something to keep in mind with CI is to take that extra couple minutes to make sure you get caching set up right. It’s a pain, but if you don’t bother early on you’ll find that over time build times for trivial changes go through the roof.
If your project has custom build dependencies (e.g. you interface with C code), you can create your own docker images and then push them to a private repo-specific registry provided by GitLab. It’s super useful because it means there’s no more need to install deps on every build.
I used to use GitLab for cross-compiling and releasing binaries, but most of our customers use Windows and cross-compiling to Windows can be a pain when there are non-trivial C dependencies involved.