This is an example program and CI pipeline showing how to run a Rust project on Semaphore 2.0.
The program is a simple hello-world HTTP server implemented with the Hyper asynchronous framework.
This sequence describes a setup on a newly installed Linux system. If some of the tools have already been installed, you may just skip those steps.
- Install Rust with
curl https://sh.rustup.rs -sSf | sh
- Clone the project with
git clone ${REPOSITORY}
- Run the project with
cargo run --verbose --release -- --port 8080
The release build of the Hyper HTTP server is now running in your terminal on port 8080.
The workflow executes the following actions:
- Checkouts the source code from the Git repository
- Gets the cargo package index from the cache
- Checks the code with
rustfmt
andclippy
- Installs the formatter
rustfmt
and linterclippy
usingrustup
- Gets the linter build from the cache
- Checks formatting with the
rustfmt
formatter - Checks the source code with the
clippy
linter - Puts the linter build to the cache
- Installs the formatter
- Builds and tests the project
- Gets the default build from the cache
- Builds the project and runs the tests
- Puts the default build and ~/.cargo to the cache
Sequences 3 and 4 are executed in parallel.
Linter and default builds are different, so they are built and stored separately.
Copyright (c) 2019 Rendered Text
Distributed under the MIT License. See the file LICENSE.