Skip to content

Commit

Permalink
Merge pull request #1 from ruru-m07/ci/cd
Browse files Browse the repository at this point in the history
feat: implement CI/CD workflows
  • Loading branch information
Znackt authored Jul 6, 2024
2 parents 8d82b00 + d6bca03 commit d310c0f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 18 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/quick_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]

name: Rust CI Workflow

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: check

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: test

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: clippy
args: -- -D warnings
26 changes: 10 additions & 16 deletions src/editor.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use std::io::{self, Read};
use crossterm::event;
use crossterm::event::{read, Event::Key, KeyCode::Char};
use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
pub struct Editor {

}
use std::io::{self, Read};
pub struct Editor {}
impl Editor {
pub fn default() -> Self {
Editor {}
Expand Down Expand Up @@ -32,20 +29,17 @@ impl Editor {
loop {
match read() {
Ok(Key(event)) => {
println!("{:?} \r",event);
match (event.code) {
Char(c) => {
if c == 'q' {
break;
}
},
_ => (),
println!("{:?} \r", event);
if let Char(c) = event.code {
if c == 'q' {
break;
}
}
},
}
Err(err) => println!("Error: {}", err),
_ => ()
_ => (),
}
}
disable_raw_mode().unwrap();
}
}
}
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod editor;
use editor::Editor;
fn main(){
fn main() {
let editor = Editor::default();
editor.run();
}
}

0 comments on commit d310c0f

Please sign in to comment.