Skip to content

Commit

Permalink
added a new CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sanbox-irl committed Sep 29, 2024
1 parent c286255 commit 9e577fa
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 6 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: ci
on:
pull_request:
push:
branches:
- main

jobs:
rustfmt:
name: Check rustfmt
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v2
- run: cargo fmt --all -- --check

test:
name: Run linter
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-
- name: Cache cargo target dirs
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-target-lint-stable-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-target-lint-stable-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-target-lint-stable-
${{ runner.os }}-target-lint-
- name: all features
run: cargo clippy

- name: no features
run: cargo clippy --no-default-features

- name: examples, all features
run: cargo clippy --examples

- name: examples, no features
run: cargo clippy --examples --no-default-features

- name: tests
run: cargo clippy --examples --no-default-features

- name: examples, all features
run: cargo test

- name: examples, no features
run: cargo test --no-default-features
13 changes: 7 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use std::{borrow::Cow, error::Error, fmt::Display, mem::size_of, num::NonZeroU32, rc::Rc};

use imgui::{
internal::RawWrapper, BackendFlags, Context as ImGuiContext, DrawCmd, DrawCmdParams, DrawData,
DrawIdx, DrawVert, FontAtlas, TextureId, Textures,
internal::RawWrapper, Context as ImGuiContext, DrawCmd, DrawCmdParams, DrawData, DrawIdx,
DrawVert, FontAtlas, TextureId, Textures,
};

use crate::versions::{GlVersion, GlslVersion};
Expand Down Expand Up @@ -493,7 +493,7 @@ impl Renderer {
imgui_context
.io_mut()
.backend_flags
.insert(BackendFlags::RENDERER_HAS_VTX_OFFSET);
.insert(imgui::BackendFlags::RENDERER_HAS_VTX_OFFSET);
}
}

Expand Down Expand Up @@ -616,7 +616,8 @@ impl GlStateBackup {
}
}

fn pre_render(&mut self, gl: &Context, gl_version: GlVersion) {
// note: the CFG is because `gl_version` is unused in `no-default-features`
fn pre_render(&mut self, gl: &Context, #[allow(unused_variables)] gl_version: GlVersion) {
#[allow(clippy::cast_sign_loss)]
unsafe {
self.active_texture = gl.get_parameter_i32(glow::ACTIVE_TEXTURE) as _;
Expand Down Expand Up @@ -1085,9 +1086,9 @@ fn gl_debug_message<G: glow::HasContext>(gl: &G, message: impl AsRef<str>) {
#[cfg(any(target_vendor = "apple", not(feature = "debug_message_insert_support")))]
fn gl_debug_message<G: glow::HasContext>(_gl: &G, _message: impl AsRef<str>) {}

#[cfg_attr(not(feature = "clip_origin_support"), allow(unused_variables))]
#[allow(clippy::deprecated_cfg_attr)]
fn calculate_matrix(draw_data: &DrawData, clip_origin_is_lower_left: bool) -> [f32; 16] {
#![allow(clippy::deprecated_cfg_attr)]

let left = draw_data.display_pos[0];
let right = draw_data.display_pos[0] + draw_data.display_size[0];
let top = draw_data.display_pos[1];
Expand Down

0 comments on commit 9e577fa

Please sign in to comment.