Skip to content

Commit

Permalink
Create rust.yml for Rust installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Quartinal authored Dec 1, 2023
1 parent d67299f commit 3bdf73c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -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 '[email protected]'
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

1 comment on commit 3bdf73c

@vercel
Copy link

@vercel vercel bot commented on 3bdf73c Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.