fix linux, macos and windows release builds

This commit is contained in:
Clément DOUIN 2024-01-01 00:27:45 +01:00
parent 131acd6230
commit be877f0b3e
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
5 changed files with 65 additions and 38 deletions

View file

@ -42,9 +42,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixos-22.11
nix_path: nixpkgs=channel:nixos-23.05
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12
@ -52,15 +52,17 @@ jobs:
name: soywod
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build release
run: nix build .#${{ matrix.target }}
- name: Fix interpreter path on Linux
if: ${{ matrix.target == 'linux' }}
run: |
nix-shell -p patchelf --command "patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 target/release/himalaya"
- name: Compress executable
run: nix build -L .#${{ matrix.target }}
- name: Copy executable and prepare folders
run: |
mkdir -p {man,completions}
cp result/bin/himalaya* .
- name: Patch interpreter
if: ${{ matrix.target == 'linux' }}
run: |
nix-shell -p patchelf --command "sudo patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 himalaya"
- name: Build release archive
run: |
nix run .#${{ matrix.target }} man ./man
nix run .#${{ matrix.target }} completion bash > ./completions/himalaya.bash
nix run .#${{ matrix.target }} completion elvish > ./completions/himalaya.elvish
@ -141,14 +143,15 @@ jobs:
needs: create_release
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixos-22.11
nix_path: nixpkgs=channel:nixos-23.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Publish library to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN}
run: |
nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN}

17
Cargo.lock generated
View file

@ -1216,9 +1216,9 @@ dependencies = [
[[package]]
name = "email-lib"
version = "0.19.0"
version = "0.19.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aedb0b8ce6dd6120160c07f00df2501d200b790d65b03657a7df34f645ccf8ea"
checksum = "9e4c31e26febefc822561fe388677cec106bbf0a7fe16608e7638daa3d1da9d9"
dependencies = [
"advisory-lock",
"anyhow",
@ -2203,14 +2203,13 @@ dependencies = [
[[package]]
name = "keyring-lib"
version = "0.3.0"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d5fa6d6a6a7d27d09c3e5e6c0371d97dd4cc3b0208eaba9f26dae728f1ae072"
checksum = "3278575ee927d4155314ccd89982bc37face05d9db076f5e40342cba4dd6e4ab"
dependencies = [
"keyring",
"log",
"once_cell",
"secret-service",
"serde",
"thiserror",
"tokio",
@ -2516,9 +2515,9 @@ dependencies = [
[[package]]
name = "mml-lib"
version = "1.0.4"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f33cd06aa9255baedbc7df36ae12b22e544c38426d879109a1597267d4b7c08"
checksum = "3767365c25258656f689a63f645fff963c94716caba0dc079bf19c2119ea1df7"
dependencies = [
"async-recursion",
"chumsky",
@ -3709,9 +3708,9 @@ dependencies = [
[[package]]
name = "secret-lib"
version = "0.3.0"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b06c6eda723fc17a853234defb5784ec2b3377d9bce8a6577c89788f1b6dc117"
checksum = "545285fca1cf00676621557d25814d589264d5635e8a767c603b3ff89364370e"
dependencies = [
"keyring-lib",
"process-lib",

View file

@ -50,20 +50,20 @@ clap_mangen = "0.2"
console = "0.15.2"
dialoguer = "0.10.2"
dirs = "4.0"
email-lib = { version = "=0.19.0", default-features = false }
email-lib = { version = "=0.19.5", default-features = false }
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"
indicatif = "0.17"
keyring-lib = "=0.3.0"
keyring-lib = "=0.3.2"
log = "0.4"
mail-builder = "0.3"
md5 = "0.7.0"
mml-lib = { version = "=1.0.4", default-features = false }
mml-lib = { version = "=1.0.6", default-features = false }
oauth-lib = "=0.1.0"
once_cell = "1.16"
process-lib = "=0.3.0"
secret-lib = "=0.3.0"
secret-lib = "=0.3.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shellexpand-utils = "=0.2.0"

View file

@ -31,9 +31,9 @@ pub struct Cli {
/// applicable). If the path does not point to a valid file, the
/// wizard will propose to assist you in the creation of the
/// configuration file.
#[arg(long, short, global = true)]
#[arg(short, long = "config", global = true)]
#[arg(value_name = "PATH", value_parser = config::path_parser)]
pub config: Option<PathBuf>,
pub config_path: Option<PathBuf>,
/// Customize the output format
///
@ -116,15 +116,40 @@ pub enum HimalayaCommand {
}
impl HimalayaCommand {
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
pub async fn execute(
self,
printer: &mut impl Printer,
config_path: Option<&PathBuf>,
) -> Result<()> {
match self {
Self::Account(cmd) => cmd.execute(printer, config).await,
Self::Folder(cmd) => cmd.execute(printer, config).await,
Self::Envelope(cmd) => cmd.execute(printer, config).await,
Self::Flag(cmd) => cmd.execute(printer, config).await,
Self::Message(cmd) => cmd.execute(printer, config).await,
Self::Attachment(cmd) => cmd.execute(printer, config).await,
Self::Template(cmd) => cmd.execute(printer, config).await,
Self::Account(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Folder(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Envelope(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Flag(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Message(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Attachment(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Template(cmd) => {
let config = TomlConfig::from_some_path_or_default(config_path).await?;
cmd.execute(printer, &config).await
}
Self::Manual(cmd) => cmd.execute(printer).await,
Self::Completion(cmd) => cmd.execute(printer).await,
}

View file

@ -33,9 +33,9 @@ async fn main() -> Result<()> {
}
let cli = Cli::parse();
let mut printer = StdoutPrinter::new(cli.output, cli.color);
let config = TomlConfig::from_some_path_or_default(cli.config.as_ref()).await?;
cli.command.execute(&mut printer, &config).await
cli.command
.execute(&mut printer, cli.config_path.as_ref())
.await
}