From 013f68631b54a9da180ed4098c62c024360898d1 Mon Sep 17 00:00:00 2001 From: FantasyTeddy Date: Sun, 12 May 2024 11:27:27 +0200 Subject: [PATCH 1/2] Replace discontinued actions-rs --- .github/workflows/macchina.yml | 42 ++++++++++++---------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/macchina.yml b/.github/workflows/macchina.yml index de5de23..46453fa 100644 --- a/.github/workflows/macchina.yml +++ b/.github/workflows/macchina.yml @@ -6,6 +6,8 @@ jobs: checks: name: ${{ matrix.name }} (${{ matrix.target }}) runs-on: ${{ matrix.os }} + env: + PROGRAM: ${{ matrix.cross && 'cross' || 'cargo' }} strategy: fail-fast: false matrix: @@ -98,48 +100,34 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Bootstrap - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable components: rustfmt, clippy - target: ${{ matrix.target }} + targets: ${{ matrix.target }} + + - name: Install cross + run: cargo install cross --git https://github.com/cross-rs/cross + if: ${{ matrix.cross }} - name: Formatting - uses: actions-rs/cargo@v1 - with: - command: fmt - use-cross: ${{ matrix.cross }} + run: cargo fmt --all -- --check + if: ${{ !matrix.cross }} continue-on-error: false - name: Lints - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --target=${{ matrix.target }} -- --no-deps -D clippy::all - use-cross: ${{ matrix.cross }} + run: ${{ env.PROGRAM }} clippy --target=${{ matrix.target }} -- --no-deps -D clippy::all continue-on-error: false - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --target=${{ matrix.target }} - use-cross: ${{ matrix.cross }} + run: ${{ env.PROGRAM }} build --target=${{ matrix.target }} - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --target=${{ matrix.target }} + run: ${{ env.PROGRAM }} test --target=${{ matrix.target }} if: ${{ !matrix.cross && !contains(matrix.target, 'aarch64') }} - name: Doctor - uses: actions-rs/cargo@v1 - with: - command: run - args: --target=${{ matrix.target }} -- --doctor - use-cross: ${{ matrix.cross }} + run: ${{ env.PROGRAM }} run --target=${{ matrix.target }} -- --doctor if: ${{ matrix.test }} From 5d9510ab020a0465c79b8099ae2288d92e0811bd Mon Sep 17 00:00:00 2001 From: FantasyTeddy Date: Sun, 12 May 2024 11:29:36 +0200 Subject: [PATCH 2/2] Fix formatting --- src/ascii.rs | 4 ++-- src/buffer.rs | 4 ++-- src/theme/color.rs | 2 +- src/theme/components.rs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ascii.rs b/src/ascii.rs index b1e31e4..c204fdf 100644 --- a/src/ascii.rs +++ b/src/ascii.rs @@ -2,11 +2,11 @@ use crate::Result; use ansi_to_tui::IntoText; use colored::Colorize; use io::Read; +use ratatui::style::{Color, Style}; +use ratatui::text::{Line, Span, Text}; use std::fs::File; use std::io::{self, BufReader}; use std::path::Path; -use ratatui::style::{Color, Style}; -use ratatui::text::{Span, Line, Text}; lazy_static! { static ref BLUE: Style = Style::default().fg(Color::Blue); diff --git a/src/buffer.rs b/src/buffer.rs index 7e462e7..b78fff1 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -2,13 +2,13 @@ use crate::data::Readout; use crate::theme::Theme; use crate::widgets::readout::ReadoutList; use atty::Stream; -use std::io; -use std::io::Stdout; use ratatui::backend::{Backend, CrosstermBackend}; use ratatui::buffer::{Buffer, Cell}; use ratatui::layout::{Margin, Rect}; use ratatui::text::Text; use ratatui::widgets::{Block, Borders, Paragraph, Widget}; +use std::io; +use std::io::Stdout; use unicode_width::UnicodeWidthStr; pub fn create_backend() -> CrosstermBackend { diff --git a/src/theme/color.rs b/src/theme/color.rs index 7ec3e45..e7bcbf2 100644 --- a/src/theme/color.rs +++ b/src/theme/color.rs @@ -1,6 +1,6 @@ use rand::seq::SliceRandom; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; use ratatui::style::Color; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[derive(Debug, Clone)] pub enum ColorTypes { diff --git a/src/theme/components.rs b/src/theme/components.rs index a8abca7..8828696 100644 --- a/src/theme/components.rs +++ b/src/theme/components.rs @@ -1,10 +1,10 @@ use crate::theme::borders::Border; use crate::theme::color::*; use rand::Rng; -use serde::{Deserialize, Serialize}; -use std::path::PathBuf; use ratatui::style::Color; use ratatui::widgets::BorderType; +use serde::{Deserialize, Serialize}; +use std::path::PathBuf; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Palette {