photo-album
A application for fetching photos by album id. Written in Rust.
This uses https://jsonplaceholder.typicode.com as the photo store.
Running Locally
There are multiple options for running this project. This will mostly depend on what tools you want to install.
Most commands will refer to make
.
If make
is not installed, copy the commands in makefile,
and run them directly in the terminal.
Pre-built Binary
Linux is the only current platform with a pre-built binary
- Go to latest release page
and download the
photo-album
under assets. cd
to download folder.chmod +x ./photo-album
./photo-album 1
Docker
This only requires that Docker be installed and running.
make docker
docker run --rm rcoy-v/photo-album 1
Building the Docker image runs linter, format check, and all tests before building a binary with release profile. This will take a few minutes the first time it is ran.
From Source
To run everything from source, the following tools need to be setup:
- Install rustup.
rustup
manages installations ofrustc
andcargo
. - Add
~/.cargo/bin
to$PATH
, if not done so duringrustup
install. - Verify everything is installed correctly.
rustc --version
cargo --version
rustup component install clippy-preview
. Installs the linter.rustup component install rustfmt
. Install the formatter.
Now all tools are installed to run everything:
make
make
./target/debug/photo-album 1
Builds an unoptimized binary for testing. Much faster than building an actual release.
make release
make release
./target/release/photo-album 1
Builds a fully optimized binary with release profile. Can take a few minutes.
cargo run
cargo run -- 1
Direct way to run application without building and referencing binary.
Everything after --
is passed directly as arguments to the application.
make test
make test
Runs the following:
- Clippy linter
- rustfmt format check
- unit tests
- integration tests
make fmt
make fmt
Fixes format issues in code.