Skip to content

Commit

Permalink
Add CI, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate committed Jul 30, 2023
1 parent eaf9131 commit 4be26a4
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 3 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/rust ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Rust CI

on:
push:
branches:
- main
pull_request:
env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install Clippy
run: rustup component add clippy

- name: Run Clippy
run: cargo clippy --all-targets --all-features

- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly

- name: Install Rustfmt
run: rustup component add rustfmt --toolchain nightly

- name: Run Rustfmt
run: cargo +nightly fmt --all -- --check

- name: Build release artifacts
run: cargo build --release

- name: find
run: |
dir=$HOME
files=$(find $dir -name "*.exe")
if [ -z "$files" ]; then
echo "No files found in $dir"
else
echo "Files found in $dir:"
echo "$files"
fi
file=$(basename $(find "$HOME" -name "*.exe"))
echo "$file"
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: release-artifacts
path: target/release/snake_xenzia.exe
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
name = "snake_game"
version = "0.2.0"
edition = "2021"
author = "PiXinCreate (Pa1NarK)"
authors = ["PiXinCreate (Pa1NarK)"]
description = "A simple snake game made with Rust and Piston"
readme = "README.md"
keywords = ["snake", "game", "rust", "piston"]
repository = "https://github.com/pixincreate/snake_game"

[dependencies]
piston2d-opengl_graphics = "0.82.0"
Expand All @@ -11,4 +15,8 @@ piston = "0.53.2"
rand = "0.8.5"

[dependencies.pistoncore-glutin_window]
git = "https://github.com/PistonDevelopers/glutin_window"
git = "https://github.com/PistonDevelopers/glutin_window"

[[bin]]
name = "snake_xenzia"
path = "src/main.rs"
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Snake Xenzia

Execute `cargo doc --open` to get reference to all the methods, functions and libs used.

## Usage

- Clone this repo
Expand All @@ -16,3 +18,22 @@

- Make the code more robust and error safe
- Add bonus food every 5 points

## Tree

```tree
SNAKE_GAME
| .gitignore
| Cargo.lock
| Cargo.toml
| README.md
|
+---src
| food.rs
| game.rs
| lib.rs
| main.rs
| snake.rs
|
\---target
```
2 changes: 1 addition & 1 deletion src/snake.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::LinkedList;
use opengl_graphics;
use piston::input;
use std::collections::LinkedList;

#[derive(Clone, PartialEq)]
pub enum Direction {
Expand Down

0 comments on commit 4be26a4

Please sign in to comment.