Skip to content

Commit

Permalink
Merge pull request #40 from sezna/ci
Browse files Browse the repository at this point in the history
initial ci
  • Loading branch information
sezna authored Jun 22, 2024
2 parents bf64008 + 8ed7ff1 commit 780fcc1
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 56 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

name: CI
on:
pull_request: { branches: "*" }
push: { branches: "main" }
env:
RUSTFLAGS: "-Dwarnings"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Machete
uses: bnjbvr/cargo-machete@main

clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features
34 changes: 0 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pete/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ petr-resolve = { "path" = "../petr-resolve", optional = true }
petr-pkg = { "path" = "../petr-pkg" }
petr-profiling = { path = "../petr-profiling" }
miette = { version = "7.2.0", features = ["fancy"] }
thiserror = "1.0.61"
toml = "0.8.14"
thiserror = "1.0"
toml = "0.8"

[features]
debug = ["petr-utils/debug", "petr-resolve/debug"]
Expand Down
20 changes: 16 additions & 4 deletions pete/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ use petr_pkg::BuildPlan;
use petr_utils::{IndexMap, SourceId, SpannedItem};
use petr_vm::Vm;

mod error {
use thiserror::Error;
#[derive(Error, Debug)]
pub enum PeteError {
#[error(transparent)]
IoError(#[from] std::io::Error),
#[error(transparent)]
TomlSeriatlizeError(#[from] toml::ser::Error),
}
}

#[derive(ClapParser)]
#[command(version = "0.0", author = "Alex H <alex@alex-hansen.com>")]
struct Cli {
Expand Down Expand Up @@ -63,7 +74,7 @@ enum Commands {
},
}

fn main() {
fn main() -> Result<(), error::PeteError> {
let cli = Cli::parse();

match cli.command {
Expand Down Expand Up @@ -148,7 +159,7 @@ fn main() {
timings.end("load files");

timings.start("format");
petr_fmt::format_sources(files, manifest.formatter.into()).expect("TODO errs");
petr_fmt::format_sources(files, manifest.formatter.into())?;
timings.end("format");

if time {
Expand All @@ -163,9 +174,9 @@ fn main() {
},
Commands::Ir { path } => {
let (lockfile, buf, _build_plan) = load_project_and_dependencies(&path);
let lockfile_toml = toml::to_string(&lockfile).expect("Failed to serialize lockfile to TOML");
let lockfile_toml = toml::to_string(&lockfile)?;
let lockfile_path = path.join("petr.lock");
fs::write(lockfile_path, lockfile_toml).expect("Failed to write lockfile");
fs::write(lockfile_path, lockfile_toml)?;

// convert pathbufs into strings for the parser
let buf = buf
Expand Down Expand Up @@ -201,6 +212,7 @@ fn main() {
println!("{}", lowerer.pretty_print());
},
}
Ok(())
}

fn load_project_and_dependencies(path: &Path) -> (petr_pkg::Lockfile, Vec<(PathBuf, String)>, BuildPlan) {
Expand Down
2 changes: 1 addition & 1 deletion petr-codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ petr-ir = { path = "../petr-ir" }

cranelift = "0.108.1"
cranelift-native = "0.108.1"
cranelift-reader = "0.108.1"
# cranelift-reader = "0.108.1"
cranelift-object = { version = "0.108.1" }
cranelift-module = "0.108.1"

Expand Down
1 change: 0 additions & 1 deletion petr-fmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ petr-parse = { path = "../petr-parse" }
petr-utils = { path = "../petr-utils" }
petr-ast = { path = "../petr-ast" }
structopt = { version = "0.3.26", features = ["color"] }
serde = { version = "1.0.203", features = ["derive"] }

[dev-dependencies]
expect-test = "1.5.0"
2 changes: 0 additions & 2 deletions petr-ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
miette = { version = "7.2.0", features = ["fancy"] }
thiserror = "1.0.61"
petr-utils = { path = "../petr-utils" }
petr-typecheck = { path = "../petr-typecheck" }

Expand Down
2 changes: 1 addition & 1 deletion petr-ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl Lowerer {
lit: &petr_typecheck::Literal,
) -> DataLabel {
use petr_typecheck::Literal::*;

self.data_section.insert(match lit {
Integer(val) => DataSectionEntry::Int64(*val),
Boolean(val) => DataSectionEntry::Bool(*val),
Expand Down
6 changes: 0 additions & 6 deletions petr-manifest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,3 @@
name = "petr-manifest"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = { version = "1.0.203", features = ["derive"] }
petr-fmt = { path = "../petr-fmt" }
petr-pkg = { path = "../petr-pkg" }
toml = "0.8.14"
1 change: 0 additions & 1 deletion petr-pkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ git2 = "0.19.0"
serde = { version = "1.0.203", features = ["derive"] }
toml = "0.8.14"
petr-fmt = { path = "../petr-fmt" }
petgraph = "0.6.5"
1 change: 0 additions & 1 deletion petr-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2021"
[dependencies]
lazy_static = { version = "1.4.0", optional = true }
miette = { version = "7.2.0", features = ["fancy"] }
thiserror = "1.0.61"

[features]
debug = ["lazy_static"]
6 changes: 3 additions & 3 deletions petr-utils/src/common_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ impl From<usize> for SymbolId {
}
}
#[cfg(feature = "debug")]
impl Into<usize> for SymbolId {
fn into(self) -> usize {
self.0
impl From<SymbolId> for usize {
fn from(o: SymbolId) -> usize {
o.0
}
}
#[cfg(feature = "debug")]
Expand Down

0 comments on commit 780fcc1

Please sign in to comment.