#ci #docker-image #io #workflow #example #building #multi-platform

bin+lib fnichol-cime

A demonstration of a Rust CI build/test/release workflow supporting multi-platform testing, binary builds, Docker image building, and Crates.io publishing

6 releases (breaking)

0.7.0 Apr 23, 2021
0.6.0 Apr 19, 2021
0.5.0 Feb 26, 2021
0.4.0 Feb 26, 2021
0.1.1-dev Feb 23, 2021

#1093 in Rust patterns

MPL-2.0 license

76KB
2K SLoC

Shell 1.5K SLoC // 0.0% comments Pan 202 SLoC // 0.1% comments PowerShell 113 SLoC // 0.3% comments Rust 54 SLoC // 0.2% comments


fnichol-cime

A demonstration of a Rust CI build/test/release workflow supporting multi-platform testing, binary builds, Docker image building, and Crates.io publishing.

CI CI Status
Bors enabled
Latest Version Latest version
Documentation Documentation
Crate Downloads Crate downloads
GitHub Downloads Github downloads
Docker Pulls Docker pulls
License Crate license
Table of Contents

CLI

Usage

There's not much to this program. To greet the currently logged in user, run:

> fnichol-cime "$USER"
Hello, jdoe!

For more help and full usage, use the --help or -h flags:

> fnichol-cime --help

Installation

install.sh (Pre-Built Binaries)

An installer is provided at https://fnichol.github.io/fnichol-cime/install.sh which installs a suitable pre-built binary for common systems such as Linux, macOS, Windows, and FreeBSD. It can be downloaded and run locally or piped into a shell interpreter in the "curl-bash" style as shown below. Note that if you're opposed to this idea, feel free to check some of the alternatives below.

To install the latest release for your system into $HOME/bin:

> curl -sSf https://fnichol.github.io/fnichol-cime/install.sh | sh

When the installer is run as root the installation directory defaults to /usr/local/bin:

> curl -sSf https://fnichol.github.io/fnichol-cime/install.sh | sudo sh

A nightly release built from HEAD of the main branch is available which can also be installed:

> curl -sSf https://fnichol.github.io/fnichol-cime/install.sh \
    | sh -s -- --release=nightly

For a full set of options, check out the help usage with:

> curl -sSf https://fnichol.github.io/fnichol-cime/install.sh \
    | sh -s -- --help

GitHub Releasees (Pre-Built Binaries)

Each release comes with binary artifacts published in GitHub Releases. The install.sh program downloads its artifacts from this location so this serves as a manual alternative. Each artifact ships with MD5 and SHA256 checksums to help verify the artifact on a target system.

Docker Image

A minimal image ships with each release (including a nightly built version from HEAD of the main branch) published to Docker Hub. The entrypoint invokes the binary directly, so any arguments to docker run will be passed to the program. For example, to display the full help usage:

> docker run fnichol/fnichol-cime --help

Cargo Install

If Rust is installed on your system, then installing with Cargo is straight forward with:

> cargo install fnichol-cime

From Source

To install from source, you can clone the Git repository, build with Cargo and copy the binary into a destination directory. This will build the project from the latest commit on the main branch, which may not correspond to the latest stable release:

> git clone https://github.com/fnichol/fnichol-cime.git
> cd fnichol-cime
> cargo build --release
> cp ./target/release/fnichol-cime /dest/path/

Library

This crate executes a highly specialized algorithm to dynamically generate a greeting in english to a given subject. It is serious business.

Usage

This crate is on crates.io and can be used by adding the crate to your dependencies in your project's Cargo.toml file:

[dependencies]
fnichol-cime = { version = "0.7.0", default-features = false }

Note that the default features include dependencies which are required to build a CLI and are not needed for the library.

Examples

Example: greeting a human

Assuming we have a human named Jane:

let greeting = fnichol_cime::greeting("Jane");
// #=> "Hello, Jane!"

CI Status

Build (main branch)

Operating System Target Stable Rust
FreeBSD x86_64-unknown-freebsd FreeBSD Build Status
Linux arm-unknown-linux-gnueabihf Linux Build Status
Linux aarch64-unknown-linux-gnu Linux Build Status
Linux i686-unknown-linux-gnu Linux Build Status
Linux i686-unknown-linux-musl Linux Build Status
Linux x86_64-unknown-linux-gnu Linux Build Status
Linux x86_64-unknown-linux-musl Linux Build Status
macOS x86_64-apple-darwin macOS Build Status
Windows x86_64-pc-windows-msvc Windows Build Status

Test (main branch)

Operating System Stable Rust Nightly Rust
FreeBSD FreeBSD Stable Test Status FreeBSD Nightly Test Status
Linux Linux Stable Test Status Linux Nightly Test Status
macOS macOS Stable Test Status macOS Nightly Test Status
Windows Windows Stable Test Status Windows Nightly Test Status

Note: The Minimum Supported Rust Version (MSRV) is also tested and can be viewed in the CI dashboard.

Check (main branch)

Status
Lint Lint Status
Format Format Status

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to fnichol@nichol.ca.

Issues

If you have any problems with or questions about this project, please contact us through a GitHub issue.

Contributing

You are invited to contribute to new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

Release History

See the changelog for a full release history.

Authors

Created and maintained by Fletcher Nichol (fnichol@nichol.ca).

License

Licensed under the Mozilla Public License Version 2.0 (LICENSE.txt).

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.

Dependencies

~240KB