From 3bdf73c12a0652bef8bf6cf2fc3631ce67ee42cd Mon Sep 17 00:00:00 2001 From: Quartinal <148902345+Quartinal@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:28:48 -0800 Subject: [PATCH] Create rust.yml for Rust installation --- .github/workflows/rust.yml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..013ae51 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,46 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Check if Cargo.toml exists + id: check-cargo + run: | + if [ -f Cargo.toml ]; then + echo "Cargo.toml exists. Skipping initialization." + echo "project_initialized=true" >> $GITHUB_ENV + else + echo "Cargo.toml does not exist. Need to initialize the project." + echo "project_initialized=false" >> $GITHUB_ENV + fi + + - name: Initialize Rust project + if: env.project_initialized == 'false' + run: | + cargo init --vcs none . + git add . + git config --global user.name 'Quartinal' + git config --global user.email 'prehistorical.dinosaurs@outlook.com' + git commit -m "Initial commit with cargo init" + git push + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose \ No newline at end of file