Skip to content

Commit

Permalink
feat[#7]: update ci workflow to build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
zfwf committed Jan 3, 2024
1 parent fc78ca0 commit 4aa622b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
# # Build package
# pwsh ./install/windows/choco/update.ps1
# env:
# STARSHIP_VERSION: v1.2.3
# ORBITER_VERSION: v0.5.0

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
6 changes: 1 addition & 5 deletions src/hooks/init.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use crate::utils::{
config::{ShellSpecificCommand, SupportedShellSpecificCommand},
script::*,
shells::SupportedShell,
};
use crate::utils::{config::ShellSpecificCommand, script::*, shells::SupportedShell};

pub fn init(
current_shell: &SupportedShell,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/src.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use glob::glob;
use std::fs;

use crate::utils::{
config::{ShellSpecificSourceTarget, SourceTarget, SupportedShellSpecificSourceTarget},
config::{ShellSpecificSourceTarget, SourceTarget},
shells::SupportedShell,
};

Expand Down
73 changes: 40 additions & 33 deletions src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,13 @@ pub struct SupportedShellSpecificSourceTarget {
pub wincmd: Option<SourceTarget>,
}


#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ShellSpecificSourceTarget {
Generic(SourceTarget),
ShellSpecific(SupportedShellSpecificSourceTarget),
}


#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct SupportedShellSpecificEvaluatable {
pub sh: Option<String>,
Expand All @@ -154,7 +152,6 @@ pub enum ShellSpecificEvaluatable {
ShellSpecific(SupportedShellSpecificEvaluatable),
}


#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct Payload {
// The `string_or_struct` function delegates deserialization to a type's
Expand Down Expand Up @@ -232,11 +229,15 @@ mod parse_tests {
resource: AdaptiveResource::Standard(Resource::Location("https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=en-US".to_string())),
install: Some(ShellSpecificCommand::ShellSpecific(SupportedShellSpecificCommand{
sh:Some( OSSpecificCommand::OSSpecific( SupportedOSSpecificCommand{
macos: Some("./GitAhead*.sh --include-subdir".to_string()),
linux: None, windows: None},
)),
zsh: None, bash: None, fish: None, powershell: None, wincmd: None}
),
macos: Some("./GitAhead*.sh --include-subdir".to_string()),
linux: None, windows: None}
)),
zsh: None,
bash: None,
fish: None,
powershell: None,
wincmd: None
}),
),
update: None,
src: None,
Expand Down Expand Up @@ -281,13 +282,20 @@ mod parse_tests {
from_release: None,
binary_pattern: None,
})),
install: Some(ShellSpecificCommand::ShellSpecific(SupportedShellSpecificCommand{
sh: Some(OSSpecificCommand::OSSpecific( SupportedOSSpecificCommand{
macos: Some("./GitAhead*.sh --include-subdir".to_string()),
linux: None, windows: None })
),
zsh: None, bash: None, fish: None, powershell: None, wincmd: None
})),
install: Some(ShellSpecificCommand::ShellSpecific(
SupportedShellSpecificCommand {
sh: Some(OSSpecificCommand::OSSpecific(SupportedOSSpecificCommand {
macos: Some("./GitAhead*.sh --include-subdir".to_string()),
linux: None,
windows: None,
})),
zsh: None,
bash: None,
fish: None,
powershell: None,
wincmd: None,
},
)),
update: None,
src: None,
extract: None,
Expand Down Expand Up @@ -320,9 +328,9 @@ mod parse_tests {
let actual_resource = &actual.first().unwrap().resource;
if let AdaptiveResource::Standard(res) = actual_resource {
if let Resource::Repo(rel) = res {
return assert_eq!(rel.binary_pattern.as_ref().unwrap(), expected)
return assert_eq!(rel.binary_pattern.as_ref().unwrap(), expected);
}
}
}

panic!("No binary_pattern")
}
Expand All @@ -346,15 +354,7 @@ mod parse_tests {
let actual: Vec<Payload> = parse(config).unwrap();
let expected = "*.tar.gz";

assert_eq!(
actual
.first()
.unwrap()
.extract
.as_ref()
.unwrap(),
expected
)
assert_eq!(actual.first().unwrap().extract.as_ref().unwrap(), expected)
}

#[test]
Expand Down Expand Up @@ -428,13 +428,20 @@ mod from_reader_tests {
from_release: None,
binary_pattern: None,
})),
install:Some(ShellSpecificCommand::ShellSpecific( SupportedShellSpecificCommand {
sh: Some(OSSpecificCommand::OSSpecific( SupportedOSSpecificCommand {
macos: Some("./GitAhead*.sh --include-subdir".to_string()),
linux: None, windows: None,
})),
zsh: None, bash: None, fish: None, powershell: None, wincmd: None,
})),
install: Some(ShellSpecificCommand::ShellSpecific(
SupportedShellSpecificCommand {
sh: Some(OSSpecificCommand::OSSpecific(SupportedOSSpecificCommand {
macos: Some("./GitAhead*.sh --include-subdir".to_string()),
linux: None,
windows: None,
})),
zsh: None,
bash: None,
fish: None,
powershell: None,
wincmd: None,
},
)),
update: None,
src: None,
extract: None,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub fn update_payload(payload: &Payload) -> Result<(), Box<dyn std::error::Error
};

// 2. rename current folder
let current_folder_path = get_payload_current_install_dir_path(&payload);
//let current_folder_path = get_payload_current_install_dir_path(&payload);

// 3. process payload (create new current folder)
Ok(())
Expand Down
4 changes: 1 addition & 3 deletions src/utils/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use std::error::Error;
use std::process::{Command, Output};
use std::str;

use log::debug;

use super::config::{OSSpecificCommand, SupportedOSSpecificCommand, SupportedShellSpecificCommand};
use super::config::{OSSpecificCommand, SupportedShellSpecificCommand};
use super::shells::SupportedShell;

pub fn run_cmd(
Expand Down

0 comments on commit 4aa622b

Please sign in to comment.