GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want. The source code and workflow actions for the Hello World example can be found in this GitHub repository.
src/main.rsfile with the following content.
/directory of the GitHub repository, and add a
Cargo.tomlfile. This file describes how the Rust cargo system should build and package our project.
Cargo.tomlfile at the root directory of the repository
main.rs, and show us the results.
ymlfiles under the
.github/workflowsdirectory. You can write your own
ymlfiles, or pick from one of the ready-made templates.
rust.ymlfile before checking it into the repository.
rust.ymlfile says that
rust.ymlworkflow will be triggered.
cargo build --verbosecommand to compile and build the Rust code.
cargo test --verbosecommand to execute the test cases.
cargo run, which runs the compiled binary program. Our updated
rust.ymlfile is as follows.
rust.ymlare performed. You can see the results under the Actions tab.
Cargo.toml, and build complex Rust applications in main.rs. Every time someone pushes code, we will be able to see the results.
cargo runabove is just a show. In reality, most developers write functions and test cases for those functions. The most frequent task after compiling and building is to run test cases. Let's see how it is done.
src/lib.rsfile below. As you can see, it defines a Rust function and a few test cases. It can be built and released as a Rust library package.
/directory of the GitHub repository, and add the following
cargo test, which is exactly what we need here.