rust/README.md
Paul Campbell 3f87d011e7
All checks were successful
/ test (map[name:nightly]) (push) Successful in 1m16s
/ test (map[name:stable]) (push) Successful in 1m21s
feat: add dbus-dev to image
2025-01-18 20:25:51 +00:00

94 lines
1.6 KiB
Markdown

# docker-builder-rust
Docker image for building Rust projects with Cargo.
## Usage
In a Forgejo action file, e.g. `.forgejo/workflows/test.yml`:
```yml
on: [push]
jobs:
test:
runs-on: docker
container:
image:
git.kemitix.net/kemitix/rust:v3.0.0
steps:
- name: test with nightly
run: cargo +nightly test
- name: build with v1.74.1
run: cargo +1.74.1 cargo build
- name: test with stable
run: cargo test
```
## Toolchains
The available toolchain in the image are:
- `nightly`
- stable
- 1.74.1
## Contents
- nodejs
- rust
- git
- cargo
- cargo-binstall
- cargo-mutants
- cargo-chef
- cargo-hack
- release-plz
- dbus-dev
- perl
### Scripts
- `check-for-ignored`
Checks for files that are being tracked by Git but should be ignored according
to the `.gitignore` file.
#### Usage
```yaml
steps:
- name: Check for Ignored Files
run: check-for-ignored
```
## Caveats
### openssl
The alpine linux install doesn't build with this dependency. You can either compile `native-tls` with the `vendored` feature, or not use `openssl`.
#### vendoered native-tls
This crate *must* use the `vendored` feature in order to compile in the Alpine Linux image.
```toml
native-tls = { version = "0.2", features = ["vendored"] }
```
#### Don't use `openssl`
Check that none of your dependencies require `openssl`:
```bash
cargo tree --edges normal -i openssl
```
This will list the tree of dependencies that are bringing in `openssl`.
If you do need ssl/tls, try using `rustls`. e.g.
```toml
reqwest = { version = "0.12", default-features = false, features = [
"json",
"rustls-tls",
] }
```