Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #85

Merged
merged 18 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/clippy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Clippy check"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-features
19 changes: 19 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Formatting"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
formatting:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ pub use modules::modules_info;
pub use modules::nav_route;
pub use modules::odyssey;
pub use modules::outfitting;
pub use modules::partials;
pub use modules::ship;
pub use modules::ship_locker;
pub use modules::shipyard;
pub use modules::partials;
pub use modules::state;
pub use modules::station;
pub use modules::status;
Expand All @@ -47,10 +47,10 @@ mod modules;

#[cfg(test)]
mod tests {
use std::env::current_dir;
use std::path::PathBuf;
use crate::logs::LogDir;
use crate::logs::LogEventContent;
use std::env::current_dir;
use std::path::PathBuf;

pub fn test_root() -> PathBuf {
PathBuf::from("./test-files")
Expand Down
7 changes: 3 additions & 4 deletions src/modules/civilization/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
pub use models::conflict::Conflict;
pub use models::conflict::ConflictFaction;
pub use models::conflict::ConflictWarType;
pub use models::crime::Crime;
pub use models::economy::Economy;
pub use models::engineer::Engineer;
pub use models::engineer::EngineerError;
pub use models::faction::Faction;
pub use models::faction::FactionActiveState;
pub use models::faction_happiness::FactionHappiness;
Expand All @@ -12,9 +15,5 @@ pub use models::superpower::Superpower;
pub use models::system_security::SystemSecurity;
pub use models::thargoid_war::ThargoidWar;
pub use models::thargoid_war::ThargoidWarState;
pub use models::crime::Crime;
pub use models::engineer::Engineer;
pub use models::engineer::EngineerError;

mod models;

4 changes: 2 additions & 2 deletions src/modules/civilization/models.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub mod conflict;
pub mod crime;
pub mod economy;
pub mod engineer;
pub mod faction;
pub mod faction_happiness;
pub mod faction_state;
Expand All @@ -8,5 +10,3 @@ pub mod location_info;
pub mod superpower;
pub mod system_security;
pub mod thargoid_war;
pub mod crime;
pub mod engineer;
4 changes: 2 additions & 2 deletions src/modules/civilization/models/crime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ pub enum Crime {

#[cfg(test)]
mod tests {
use serde_json::Value;
use crate::civilization::Crime;
use serde_json::Value;

#[test]
fn all_crimes_are_parsed_correctly() {
let content = include_str!("zz_crimes.txt");
let mut lines = content.lines();
let lines = content.lines();

for line in lines {
if line.starts_with('#') {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/civilization/models/engineer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt::{Display, Formatter};
use crate::try_from_deserialize_impl;
use serde::Serialize;
use std::fmt::{Display, Formatter};
use thiserror::Error;
use crate::{from_str_deserialize_impl, try_from_deserialize_impl};

#[derive(Debug, Serialize, Clone, PartialEq)]
pub enum Engineer {
Expand Down
13 changes: 3 additions & 10 deletions src/modules/exobiology/models/spawn_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@ pub mod spawn_source_star;
pub mod target_planet;
pub mod target_system;

use std::cmp::min;
use std::collections::HashSet;

use serde::Serialize;
use strum::IntoEnumIterator;

use crate::exobiology::models::spawn_source::spawn_source_star::SpawnSourceStar;
use crate::exobiology::models::spawn_source::target_planet::TargetPlanet;
use crate::exobiology::models::spawn_source::target_system::TargetSystem;
use crate::exobiology::{SpawnCondition, Species};
use crate::galaxy::{
Atmosphere, AtmosphereDensity, AtmosphereType, Nebula, PlanetClass, PlanetComposition,
StarClass, StarLuminosity, Volcanism, VolcanismType,
};
use crate::logs::scan_event::{ScanEventParent};
use crate::galaxy::{AtmosphereDensity, AtmosphereType, Nebula, VolcanismType};
use crate::logs::scan_event::ScanEventParent;

#[derive(Debug)]
pub struct SpawnSource<'a> {
Expand Down Expand Up @@ -47,7 +40,7 @@ impl<'a> SpawnSource<'a> {
&self.target_planet.surface_temperature >= min_temp
}
SpawnCondition::MaxMeanTemperature(max_temp) => {
&self.target_planet.surface_temperature <= &max_temp
&self.target_planet.surface_temperature <= max_temp
}
SpawnCondition::NoAtmosphere => {
self.target_planet.atmosphere.kind == AtmosphereType::None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::galaxy::{Atmosphere, Gravity, PlanetClass, PlanetComposition, Volcanism};
use crate::logs::scan_event::ScanEventParent;
use crate::materials::Material;
use serde::Serialize;
use std::collections::HashSet;
use crate::logs::scan_event::ScanEventParent;

#[derive(Debug, Serialize)]
pub struct TargetPlanet {
Expand Down
8 changes: 4 additions & 4 deletions src/modules/exobiology/models/species.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::fmt::{Display, Formatter};
use std::str::FromStr;

use crate::exobiology::Genus;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use strum::EnumIter;
use crate::exobiology::Genus;

use crate::modules::exobiology::models::spawn_condition::SpawnCondition;
use crate::modules::exobiology::r#static::species_spawn_conditions::SPECIES_SPAWN_CONDITIONS;
Expand Down Expand Up @@ -634,7 +634,7 @@ impl Species {
Species::BacteriumVesicula => 1_000_000,
Species::BacteriumAlcyoneum => 1_658_500,
Species::BacteriumTela => 1_949_000,
Species::BacteriumInformem => 8_418_00,
Species::BacteriumInformem => 8_418_000,
Species::BacteriumVolu => 7_774_700,
Species::BacteriumBullaris => 1_152_500,
Species::BacteriumOmentum => 4_689_800,
Expand Down Expand Up @@ -697,10 +697,10 @@ impl Species {

Species::ReceptaUmbrux => 12_934_900,
Species::ReceptaDeltahedronix => 16_202_800,
Species::ReceptaConditivus => 14_3133_700,
Species::ReceptaConditivus => 14_313_700,

Species::StratumExcutitus => 2_448_900,
Species::StratumPaleas => 1_362_00,
Species::StratumPaleas => 1_362_000,
Species::StratumLaminamus => 2_788_300,
Species::StratumAraneamus => 2_448_900,
Species::StratumLimaxus => 1_362_000,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/exobiology/models/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod tests {
#[test]
fn variants_test_file_entries_all_parse() {
let content = include_str!("zz_variants.txt");
let mut lines = content.lines();
let lines = content.lines();

for line in lines {
if line.starts_with('#') {
Expand All @@ -160,7 +160,7 @@ mod tests {
#[test]
fn variants_datadump_test_file_entries_all_parse() {
let content = include_str!("zz_datamined_variants.txt");
let mut lines = content.lines();
let lines = content.lines();

for line in lines {
if line.starts_with('#') {
Expand Down
Loading
Loading