Skip to content

Commit

Permalink
🐎 ci: Add workflow for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Sep 19, 2024
1 parent 5077ed8 commit 14e0bc2
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 6 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Linux Build

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- .github/**
- "!.github/workflows/linux_build.yml"
- "**.md"
- "docs/**"
push:
branches:
- main
paths-ignore:
- .github/**
- "!.github/workflows/linux_build.yml"
- "**.md"
- "docs/**"

env:
BETTER_MEDIA_INFO_VERSION: 0.2.0

jobs:
build_package:
name: Build for Linux x86_64
runs-on: ubuntu-latest

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout the code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Upgrade Ubuntu
run: |
sudo apt-get update
sudo apt-get install -y libsoup2.4-dev libwebkit2gtk-4.0-dev librsvg2-dev
- name: Build zlib
run: |
cd ..
curl -o zlib.tar.gz https://www.zlib.net/zlib-1.3.1.tar.gz
tar -xzvf zlib.tar.gz
mv zlib-1.3.1 zlib
rm zlib.tar.gz
cd zlib
./configure --static
make -j 4
- name: Build ZenLib
run: |
cd ..
git clone https://github.com/MediaArea/ZenLib.git
cd ZenLib/Project/GNU/Library
./autogen.sh
./configure --enable-static
make -j 4
- name: Build MediaInfoLib
run: |
cd ..
git clone https://github.com/MediaArea/MediaInfoLib.git
cd MediaInfoLib/Project/GNU/Library
./autogen.sh
./configure --enable-static
make -j 4
- name: Build BetterMediaInfo
run: |
pnpm install
pnpm tauri build
- name: Upload the deb
uses: actions/upload-artifact@v4
with:
name: BetterMediaInfo-linux-x86_64-${{ env.BETTER_MEDIA_INFO_VERSION }}-deb
path: |
src-tauri/target/release/bundle/deb/*.deb
- name: Upload the rpm
uses: actions/upload-artifact@v4
with:
name: BetterMediaInfo-linux-x86_64-${{ env.BETTER_MEDIA_INFO_VERSION }}-rpm
path: |
src-tauri/target/release/bundle/rpm/*.rpm
- name: Upload the AppImage
uses: actions/upload-artifact@v4
with:
name: BetterMediaInfo-linux-x86_64-${{ env.BETTER_MEDIA_INFO_VERSION }}-AppImage
path: |
src-tauri/target/release/bundle/appimage/*.AppImage
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# BetterMediaInfo

[![MacOS Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml) [![Windows Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml)
[![Linux Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/linux_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/linux_build.yml) [![MacOS Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/macos_build.yml) [![Windows Build](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml/badge.svg)](https://github.com/caoccao/BetterMediaInfo/actions/workflows/windows_build.yml)

BetterMediaInfo is a better GUI for [MediaInfo](https://github.com/MediaArea/MediaInfo). Why? Because I'm not a fan of the official MediaInfo GUI.

BetterMediaInfo is built on top of [MediaInfoLib](https://github.com/MediaArea/MediaInfoLib).

## Features

* MacOS (x86_64 + arm64) + Windows (x86_64)
* Linux (x86_64) + MacOS (x86_64 + arm64) + Windows (x86_64)
* Drag and drop
* Multiple files / directories
* Real-time filter
Expand Down
44 changes: 44 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,50 @@ git clone https://github.com/MediaArea/MediaInfoLib.git
git clone https://github.com/MediaArea/ZenLib.git
```

### Build MediaInfoLib for Linux

* Upgrade Ubuntu.

```sh
sudo apt-get update
sudo apt-get install -y libsoup2.4-dev libwebkit2gtk-4.0-dev librsvg2-dev
```

* Download zlib.

```sh
curl -o zlib.tar.gz https://www.zlib.net/zlib-1.3.1.tar.gz
tar -xzvf zlib.tar.gz
mv zlib-1.3.1 zlib
rm zlib.tar.gz
```

* Build zlib.

```sh
cd zlib
./configure --static
make -j`nproc`
```

* Build ZenLib.

```sh
cd ZenLib/Project/GNU/Library
./autogen.sh
./configure --enable-static
make -j`nproc`
```

* Build MediaInfoLib.

```sh
cd MediaInfoLib/Project/GNU/Library
./autogen.sh
./configure --enable-static
make -j`nproc`
```

### Build MediaInfoLib for MacOS

* Install XCode.
Expand Down
10 changes: 7 additions & 3 deletions src-tauri/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn main() {
let better_media_info_path = Path::new(cargo_manifest_dir.as_str());
let root_path = better_media_info_path.parent().unwrap().parent().unwrap();

#[cfg(target_os = "macos")]
#[cfg(not(target_os = "windows"))]
{
let z_lib = ExternalLib {
is_static: true,
Expand All @@ -106,11 +106,15 @@ fn main() {
source_path: "ZenLib/Project/GNU/Library/.libs".to_owned(),
};
zen_lib.link(root_path);

println!("cargo:rustc-link-lib=c++");
}

#[cfg(target_os = "linux")]
println!("cargo:rustc-link-lib=libc++");

#[cfg(target_os = "macos")]
println!("cargo:rustc-link-lib=c++");

#[cfg(not(target_os = "windows"))]
let media_info_lib = ExternalLib {
is_static: true,
file_name: "libmediainfo.a".to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/media_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type mi_kind = raw::c_int;
type mi_void = raw::c_void;
#[cfg(target_os = "windows")]
type mi_wchar = u16;
#[cfg(target_os = "macos")]
#[cfg(not(target_os = "windows"))]
type mi_wchar = u32;

const DEFAULT_OPTION_VALUE: &str = "";
Expand Down

0 comments on commit 14e0bc2

Please sign in to comment.