Skip to content

Commit

Permalink
MAC
Browse files Browse the repository at this point in the history
  • Loading branch information
qarmin committed Feb 26, 2025
1 parent 6037c68 commit dcb8e99
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 85 deletions.
156 changes: 127 additions & 29 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ env:
CARGO_TERM_COLOR: always

jobs:
macos:
runs-on: macos-latest
macos_x86_64:
runs-on: macos-13
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -52,38 +52,136 @@ jobs:

- name: Prepare files to release
run: |
mv target/release/czkawka_cli macos_czkawka_cli
mv target/release/czkawka_gui macos_czkawka_gui
mv target/release/krokiet macos_krokiet
mv target/release/czkawka_cli macos_czkawka_cli_x86_64
mv target/release/czkawka_gui macos_czkawka_gui_x86_64
mv target/release/krokiet macos_krokiet_x86_64
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.ref == 'refs/heads/master' }}
with:
tag_name: "Nightly"
files: |
macos_czkawka_cli_x86_64
macos_czkawka_gui_x86_64
macos_krokiet_x86_64
token: ${{ secrets.PAT_REPOSITORY }}

# TODO - compilation is broken, not sure why, if you want to use it you need to fix it(I'm too lazy and don't have MacOS)
- name: Build Release Heif
run: cargo build --release --features heif

- name: Store MacOS CLI Heif
uses: actions/upload-artifact@v4
with:
name: czkawka_cli-${{ runner.os }}-heif
path: target/release/czkawka_cli

- name: Store MacOS GUI Heif
uses: actions/upload-artifact@v4
with:
name: czkawka_gui-${{ runner.os }}-heif
path: target/release/czkawka_gui

- name: Store MacOS Krokiet Heif
uses: actions/upload-artifact@v4
with:
name: krokiet-${{ runner.os }}-heif
path: target/release/krokiet

- name: Prepare files to release 2
run: |
mv target/release/czkawka_cli macos_czkawka_cli_heif_x86_64
mv target/release/czkawka_gui macos_czkawka_gui_heif_x86_64
mv target/release/krokiet macos_krokiet_heif_x86_64
- name: Release 2
uses: softprops/action-gh-release@v2
if: ${{ github.ref == 'refs/heads/master' }}
with:
tag_name: "Nightly"
files: |
macos_czkawka_cli_heif_x86_64
macos_czkawka_gui_heif_x86_64
macos_krokiet_heif_x86_64
token: ${{ secrets.PAT_REPOSITORY }}

macos_arm:
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4

- name: Install Homebrew
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

- name: Install GTK4
run: |
brew link --overwrite [email protected]
brew install rust gtk4 libheif || true
brew link --overwrite [email protected]
- name: Setup rust version
run: rustup default 1.85.0

- name: Enable LTO
run: sed -i '' 's/#lto = "thin"/lto = "thin"/g' Cargo.toml

- name: Build Release
run: cargo build --release

- name: Store MacOS CLI
uses: actions/upload-artifact@v4
with:
name: czkawka_cli-${{ runner.os }}
path: target/release/czkawka_cli

- name: Store MacOS GUI
uses: actions/upload-artifact@v4
with:
name: czkawka_gui-${{ runner.os }}
path: target/release/czkawka_gui

- name: Store MacOS Krokiet
uses: actions/upload-artifact@v4
with:
name: krokiet-${{ runner.os }}
path: target/release/krokiet

- name: Prepare files to release
run: |
mv target/release/czkawka_cli macos_czkawka_cli_arm
mv target/release/czkawka_gui macos_czkawka_gui_arm
mv target/release/krokiet macos_krokiet_arm
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ github.ref == 'refs/heads/master' }}
with:
tag_name: "Nightly"
files: |
macos_czkawka_cli
macos_czkawka_gui
macos_krokiet
macos_czkawka_cli_arm
macos_czkawka_gui_arm
macos_krokiet_arm
token: ${{ secrets.PAT_REPOSITORY }}

# # TODO - compilation is broken, not sure why
# - name: Build Release Heif
# run: cargo build --release --features heif
#
# - name: Store MacOS CLI Heif
# uses: actions/upload-artifact@v4
# with:
# name: czkawka_cli-${{ runner.os }}-heif
# path: target/release/czkawka_cli
#
# - name: Store MacOS GUI Heif
# uses: actions/upload-artifact@v4
# with:
# name: czkawka_gui-${{ runner.os }}-heif
# path: target/release/czkawka_gui
#
# - name: Store MacOS Krokiet Heif
# uses: actions/upload-artifact@v4
# with:
# name: krokiet-${{ runner.os }}-heif
# path: target/release/krokiet
# TODO - compilation is broken, not sure why, if you want to use it you need to fix it(I'm too lazy and don't have MacOS)
- name: Build Release Heif
run: cargo build --release --features heif

- name: Store MacOS CLI Heif
uses: actions/upload-artifact@v4
with:
name: czkawka_cli-${{ runner.os }}-heif
path: target/release/czkawka_cli

- name: Store MacOS GUI Heif
uses: actions/upload-artifact@v4
with:
name: czkawka_gui-${{ runner.os }}-heif
path: target/release/czkawka_gui

- name: Store MacOS Krokiet Heif
uses: actions/upload-artifact@v4
with:
name: krokiet-${{ runner.os }}-heif
path: target/release/krokiet
5 changes: 2 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
- Image cache, due using by now exif orientation, is incompatible with previous versions, and needs to be regenerated
- Duplicate cache, due using smaller prehash size, is incompatible with previous versions, and needs to be regenerated


### Known regressions
- Rarely crashes when using similar videos tool with some broken videos

### CI

### Core
- Rotating all images by default, basing on their exif orientation - [#1368](https://github.com/qarmin/czkawka/pull/1368)
- Fixed negative time crash in some OS - [#1369](https://github.com/qarmin/czkawka/pull/1369)
Expand All @@ -32,6 +29,8 @@
- Added window icon in wayland - [#1400](https://github.com/qarmin/czkawka/pull/1400)
- Disabled broken sort button - [#1400](https://github.com/qarmin/czkawka/pull/1400)

### CI

### CLI


Expand Down
107 changes: 54 additions & 53 deletions czkawka_gui/src/connect_things/connect_popovers_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,57 +232,58 @@ mod test {
}
}

#[gtk4::test]
pub fn _fuzzer_test() {
for _ in 0..10000 {
let columns_types: &[Type] = &[Type::BOOL, Type::STRING];
let list_store = gtk4::ListStore::new(columns_types);
let tree_view = TreeView::builder().model(&list_store).build();
let popover = Popover::new();

let first_row: &[(u32, &dyn ToValue)] = &[(0, &true), (1, &"AAA")];
list_store.set(&list_store.append(), first_row);

let mut since_last_header = 0;

(0..(random::<u32>() % 10 + 5)).for_each(|_| {
let bool_val = if since_last_header < 2 {
since_last_header += 1;
false
} else {
since_last_header = 0;
random()
};
let string_val = rand::random::<u32>().to_string();
let a: Vec<(u32, &dyn ToValue)> = vec![(0, &bool_val), (1, &string_val)];

list_store.set(&list_store.append(), &a);
});

if since_last_header < 2 {
// This is invalid, and should be vec![(0, &false), (1, &"AAA")]
// but this triggers the bug
let a: Vec<(u32, &dyn ToValue)> = vec![(0, &true), (1, &"AAA")];
list_store.set(&list_store.append(), &a);
let b: Vec<(u32, &dyn ToValue)> = vec![(0, &false), (1, &"BBB")];
list_store.set(&list_store.append(), &b);
}

print_two_items_model(&list_store);

popover_sort_general::<String>(&popover, &tree_view, 1, 0);
}
}

fn print_two_items_model(model: &gtk4::ListStore) {
let iter = model.iter_first().expect("Failed to get first iter");
loop {
let bool_val = model.get::<bool>(&iter, 0);
let string_val = model.get::<String>(&iter, 1);
println!("{bool_val} {string_val}");
if !model.iter_next(&iter) {
break;
}
}
}
// TODO - This test uncovers a bug in the code, so it is disabled for now, with sort button
// #[gtk4::test]
// pub fn _fuzzer_test() {
// for _ in 0..10000 {
// let columns_types: &[Type] = &[Type::BOOL, Type::STRING];
// let list_store = gtk4::ListStore::new(columns_types);
// let tree_view = TreeView::builder().model(&list_store).build();
// let popover = Popover::new();
//
// let first_row: &[(u32, &dyn ToValue)] = &[(0, &true), (1, &"AAA")];
// list_store.set(&list_store.append(), first_row);
//
// let mut since_last_header = 0;
//
// (0..(random::<u32>() % 10 + 5)).for_each(|_| {
// let bool_val = if since_last_header < 2 {
// since_last_header += 1;
// false
// } else {
// since_last_header = 0;
// random()
// };
// let string_val = rand::random::<u32>().to_string();
// let a: Vec<(u32, &dyn ToValue)> = vec![(0, &bool_val), (1, &string_val)];
//
// list_store.set(&list_store.append(), &a);
// });
//
// if since_last_header < 2 {
// // This is invalid, and should be vec![(0, &false), (1, &"AAA")]
// // but this triggers the bug
// let a: Vec<(u32, &dyn ToValue)> = vec![(0, &true), (1, &"AAA")];
// list_store.set(&list_store.append(), &a);
// let b: Vec<(u32, &dyn ToValue)> = vec![(0, &false), (1, &"BBB")];
// list_store.set(&list_store.append(), &b);
// }
//
// print_two_items_model(&list_store);
//
// popover_sort_general::<String>(&popover, &tree_view, 1, 0);
// }
// }
//
// fn print_two_items_model(model: &gtk4::ListStore) {
// let iter = model.iter_first().expect("Failed to get first iter");
// loop {
// let bool_val = model.get::<bool>(&iter, 0);
// let string_val = model.get::<String>(&iter, 1);
// println!("{bool_val} {string_val}");
// if !model.iter_next(&iter) {
// break;
// }
// }
// }
}

0 comments on commit dcb8e99

Please sign in to comment.