From 2034df76983d74281e56567185ad79b371e1dacd Mon Sep 17 00:00:00 2001 From: Lain-dono Date: Tue, 26 Dec 2023 18:15:28 +0300 Subject: [PATCH 1/5] add ci.yaml workflow --- .github/workflows/ci.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..ec67ddd --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + checker: + name: Cargo clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: r7kamura/rust-problem-matchers@v1.1.0 + - name: clippy + run: cargo clippy --all --all-targets + - name: fmt + run: cargo fmt --all -- --check + - name: build + run: cargo build --verbose From 8b1f7cdb3af957d5812db1323684b176b715e0ae Mon Sep 17 00:00:00 2001 From: Lain-dono Date: Tue, 26 Dec 2023 18:48:56 +0300 Subject: [PATCH 2/5] add bevy external deps to ci --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ec67ddd..99b806f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: r7kamura/rust-problem-matchers@v1.1.0 + - uses: r7kamura/rust-problem-matchers@v1.4.0 + - name: install alsa and udev + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - name: clippy run: cargo clippy --all --all-targets - name: fmt From 7fe693170adf44a8edf933724cd3a81ba57f5503 Mon Sep 17 00:00:00 2001 From: Lain-dono Date: Tue, 26 Dec 2023 18:55:00 +0300 Subject: [PATCH 3/5] add ci cache --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99b806f..184336a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,10 +13,11 @@ env: jobs: checker: - name: Cargo clippy + name: clippy, fmt, build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 - uses: r7kamura/rust-problem-matchers@v1.4.0 - name: install alsa and udev run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev From 4b9676b4601fa944ac330888997a9786f427a88a Mon Sep 17 00:00:00 2001 From: Lain-dono Date: Tue, 26 Dec 2023 19:06:06 +0300 Subject: [PATCH 4/5] separate ci jobs --- .github/workflows/ci.yaml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 184336a..9446614 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,9 @@ name: CI on: push: + branches: [main] pull_request: + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -12,8 +14,8 @@ env: CARGO_TERM_COLOR: always jobs: - checker: - name: clippy, fmt, build + clippy: + name: clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -23,7 +25,29 @@ jobs: run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - name: clippy run: cargo clippy --all --all-targets + env: + RUSTFLAGS: "-C debuginfo=0 -D warnings" + + fmt: + name: fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: r7kamura/rust-problem-matchers@v1.4.0 + - name: install alsa and udev + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - name: fmt run: cargo fmt --all -- --check + + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - uses: r7kamura/rust-problem-matchers@v1.4.0 + - name: install alsa and udev + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - name: build run: cargo build --verbose From 0662cc8264d5062accac0b35714cd373d9283d21 Mon Sep 17 00:00:00 2001 From: Lain-dono Date: Tue, 26 Dec 2023 19:17:48 +0300 Subject: [PATCH 5/5] fix main.rs warnings and formating --- src/main.rs | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index bcd9308..1f9e429 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,10 @@ use bevy::{ use bevy::input::mouse::*; #[derive(Component)] -struct PlayerCamera { control_speed: f32, rot_speed: f32 } +struct PlayerCamera { + control_speed: f32, + rot_speed: f32, +} pub struct PlayerInputPlugin; impl Plugin for PlayerInputPlugin { @@ -72,13 +75,26 @@ fn setup( }); // camera - commands.spawn((Camera3dBundle { - transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), - ..default() - }, PlayerCamera { control_speed: 1000.0, rot_speed: 5.0 })); + commands.spawn(( + Camera3dBundle { + transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), + ..default() + }, + PlayerCamera { + control_speed: 1000.0, + rot_speed: 5.0, + }, + )); } -fn update_player_camera(mut query: Query<(&mut Transform, &PlayerCamera)>, keyboard: Res>, mouse_button: Res>, time: Res