Skip to content

Commit

Permalink
feat: embed version from git
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeladler committed Sep 2, 2024
1 parent f41bfb1 commit 2258a91
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 259 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed to embed version information
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install deps
run: sudo apt-get update -q && sudo apt-get install -y libnotmuch-dev
- run: cargo build
- run: cargo build --release
- run: cargo test --all-features
- uses: actions/upload-artifact@v4
with:
name: notmuch-mailmover
path: |
target/release/notmuch-mailmover
format:
name: cargo fmt
Expand All @@ -33,21 +40,6 @@ jobs:
components: clippy
- run: cargo clippy

generate:
name: generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install deps
run: sudo apt-get update -q && sudo apt-get install -y libnotmuch-dev
- name: Generate files
run: cargo build
env:
GEN_ARTIFACTS: share
- name: Check if files have changed
run: git diff --exit-code

coverage:
runs-on: ubuntu-latest
env:
Expand Down
23 changes: 22 additions & 1 deletion Cargo.lock

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

26 changes: 18 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
[package]
name = "notmuch-mailmover"
version = "0.2.0"
version = "0.3.0"
authors = ["Michael Adler <[email protected]>"]
description = "Move notmuch tagged mails into Maildir folders"
homepage = "https://github.com/michaeladler/notmuch-mailmover"
license = "Apache-2.0"
edition = "2021"

[lib]
name = "nm_mailmover"
path = "src/lib/mod.rs"

[[bin]]
name = "notmuch-mailmover"
path = "src/main.rs"

[profile.release]
lto = true
panic = "abort"
codegen-units = 1

[dependencies]
uuid = { version = "1.10.0", features = ["v4"] }
anyhow = "1.0.82"
Expand All @@ -18,16 +31,13 @@ serde_yaml = "0.9.34"
directories = "5.0.1"
shellexpand = "3.0.0"
clap = { version = "4.5.13", features = [ "derive", "cargo" ] }

[dev-dependencies]
regex = "1.10.6"
git-version = "0.3.9"

[build-dependencies]
clap = { version = "4.5.13", features = [ "derive", "cargo" ] }
clap_complete = "4.5.13"
clap_mangen = "0.2.23"
git-version = "0.3.9"

[profile.release]
lto = true
panic = "abort"
codegen-units = 1
[dev-dependencies]
regex = "1.10.6"
23 changes: 10 additions & 13 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
env,
fs::{create_dir_all, File},
path::Path,
};
Expand All @@ -8,22 +7,20 @@ use clap::CommandFactory;
use clap_complete::{generate_to, Shell};
use clap_mangen::Man;

include!("src/cli.rs");
include!("src/lib/cli.rs");

fn main() {
println!("cargo:rerun-if-env-changed=GEN_ARTIFACTS");
println!("cargo::rerun-if-changed=src/lib/cli.rs");

if let Some(dir) = env::var_os("GEN_ARTIFACTS") {
let out = &Path::new(&dir);
create_dir_all(out).unwrap();
let cmd = &mut Cli::command();
let out = &Path::new("share");
create_dir_all(out).unwrap();
let cmd = &mut Cli::command();

Man::new(cmd.clone())
.render(&mut File::create(out.join("notmuch-mailmover.1")).unwrap())
.unwrap();
Man::new(cmd.clone())
.render(&mut File::create(out.join("notmuch-mailmover.1")).unwrap())
.unwrap();

for shell in Shell::value_variants() {
generate_to(*shell, cmd, "notmuch-mailmover", out).unwrap();
}
for shell in Shell::value_variants() {
generate_to(*shell, cmd, "notmuch-mailmover", out).unwrap();
}
}
41 changes: 0 additions & 41 deletions share/_notmuch-mailmover

This file was deleted.

40 changes: 0 additions & 40 deletions share/_notmuch-mailmover.ps1

This file was deleted.

32 changes: 0 additions & 32 deletions share/notmuch-mailmover.1

This file was deleted.

58 changes: 0 additions & 58 deletions share/notmuch-mailmover.bash

This file was deleted.

34 changes: 0 additions & 34 deletions share/notmuch-mailmover.elv

This file was deleted.

5 changes: 0 additions & 5 deletions share/notmuch-mailmover.fish

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 2258a91

Please sign in to comment.