Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 81 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ jobs:
- os: macos-latest
gifsicle-path: vendor/gifsicle/gifsicle
skip_gifsicle: ''
- os: ubuntu-latest
gifsicle-path: vendor/gifsicle/gifsicle
skip_gifsicle: ''
# todo: prebuilt gifsicle.exe for ci and windows release
- os: windows-latest
gifsicle-path: vendor/gifsicle/gifsicle.exe
Expand Down Expand Up @@ -100,6 +103,20 @@ jobs:
if: runner.os == 'macOS'
run: brew install dav1d

- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libxdo-dev \
libssl-dev \
libdav1d-dev \
nasm \
patchelf

- name: Cache vcpkg (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v5
Expand All @@ -124,7 +141,7 @@ jobs:
run: ./scripts/set-vc-runtime-env.ps1

- name: Cache gifsicle binary
if: runner.os == 'macOS'
if: runner.os != 'Windows'
uses: actions/cache@v5
id: gifsicle-cache
with:
Expand All @@ -138,3 +155,66 @@ jobs:

- name: Rust tests
run: npm run ci:rust

build-linux:
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
cache: npm

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libxdo-dev \
libssl-dev \
libdav1d-dev \
libfuse2 \
nasm \
file \
patchelf

- name: Cache gifsicle binary
uses: actions/cache@v5
with:
path: vendor/gifsicle/gifsicle
key: gifsicle-${{ runner.os }}-${{ runner.arch }}-1.96

- name: Install dependencies
run: npm ci
env:
HUSKY: 0

- name: Build AppImage
run: >-
npm run tauri -- build --bundles appimage
--config '{"bundle":{"createUpdaterArtifacts":false}}'

- name: Verify AppImage bundle
run: |
appimage="$(find src-tauri/target -name '*.AppImage' -path '*/release/bundle/appimage/*' | head -1)"
if [[ -z "$appimage" ]]; then
echo "build-linux: AppImage bundle not found"
exit 1
fi
ls -lh "$appimage"
82 changes: 78 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: publish

# Windows release build. Trigger manually after version bump is on main.
# Creates a draft GitHub release for v<package.json version>.
# Then: Mac build locally, upload assets, merge latest.json, publish release.

on:
workflow_dispatch:

Expand Down Expand Up @@ -154,8 +150,86 @@ jobs:

- macOS: `DropSlim_*_aarch64.dmg` (Apple Silicon)
- Windows: `DropSlim_*_x64-setup.exe` (64-bit)
- Linux: `DropSlim_*_amd64.AppImage` (x86_64)

macOS assets are uploaded separately after the local release build.
releaseDraft: true
prerelease: false
args: '--bundles nsis'

publish-linux:
permissions:
contents: write
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Read app version
id: app
run: |
version=$(node -p "require('./package.json').version")
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
cache: npm

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri

- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libxdo-dev \
libssl-dev \
libdav1d-dev \
libfuse2 \
nasm \
file \
patchelf

- name: Cache gifsicle binary
uses: actions/cache@v5
with:
path: vendor/gifsicle/gifsicle
key: gifsicle-${{ runner.os }}-${{ runner.arch }}-1.96

- name: Install dependencies
run: npm ci
env:
HUSKY: 0

- name: Build and release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tagName: ${{ steps.app.outputs.tag }}
releaseName: DropSlim v${{ steps.app.outputs.version }}
releaseBody: |
DropSlim v${{ steps.app.outputs.version }}

- macOS: `DropSlim_*_aarch64.dmg` (Apple Silicon)
- Windows: `DropSlim_*_x64-setup.exe` (64-bit)
- Linux: `DropSlim_*_amd64.AppImage` (x86_64)

macOS assets are uploaded separately after the local release build.
releaseDraft: true
prerelease: false
args: '--bundles appimage'
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ src-tauri/icons/icon.ico

.DS_Store
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
*.swp
*.swo
*~
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dropslim",
"version": "1.4.0",
"version": "1.5.0-linux-test.1",
"description": "Optimize your images and graphics in a single drag and drop.",
"author": "Martin Farkas",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dropslim"
version = "1.4.0"
version = "1.5.0-linux-test.1"
description = "Optimize your images and graphics in a single drag and drop."
authors = ["Martin Farkas"]
edition = "2021"
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/platform/dialogs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
mod macos;

#[cfg(not(target_os = "macos"))]
mod desktop;
mod non_macos;

#[cfg(target_os = "macos")]
pub use macos::{pick_paths, pick_save_folder};

#[cfg(not(target_os = "macos"))]
pub use desktop::{pick_paths, pick_save_folder};
pub use non_macos::{pick_paths, pick_save_folder};
12 changes: 1 addition & 11 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,7 @@
"icon": ["icons/icon.png"],
"fileAssociations": [
{
"ext": [
"png",
"jpg",
"jpeg",
"gif",
"svg",
"webp",
"avif",
"heic",
"heif"
],
"ext": ["png", "jpg", "jpeg", "gif", "svg", "webp", "avif"],
"name": "Image",
"role": "Editor"
}
Expand Down
31 changes: 31 additions & 0 deletions src-tauri/tauri.linux.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"app": {
"windows": [
{
"label": "main",
"title": "DropSlim",
"width": 480,
"height": 840,
"minWidth": 480,
"minHeight": 840,
"resizable": true,
"dragDropEnabled": true,
"transparent": false,
"titleBarStyle": "Visible",
"acceptFirstMouse": false
}
]
},
"bundle": {
"targets": ["appimage"],
"icon": ["icons/icon.png"],
"resources": {
"resources/": "resources/"
},
"linux": {
"appimage": {
"bundleMediaFramework": false
}
}
}
}
17 changes: 17 additions & 0 deletions src-tauri/tauri.macos.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
"bundle": {
"targets": ["dmg", "app"],
"icon": ["icons/icon.png", "icons/icon.icns"],
"fileAssociations": [
{
"ext": [
"png",
"jpg",
"jpeg",
"gif",
"svg",
"webp",
"avif",
"heic",
"heif"
],
"name": "Image",
"role": "Editor"
}
],
"macOS": {
"minimumSystemVersion": "11.0",
"signingIdentity": "-",
Expand Down
15 changes: 8 additions & 7 deletions src-tauri/tests/optimize_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ fn create_raster_fixture(dir: &TempDir, name: &str, create: impl FnOnce(&Path))
path
}

// skips when gifsicle is missing (e.g. windows ci with ci_skip_gifsicle=1)
// todo: bundle gifsicle.exe and run gif integration tests on windows
// skips tests when gifsicle is missing (e.g. windows ci with ci_skip_gifsicle=1)
// linux/macos build gifsicle from source, windows ci still needs a prebuilt .exe
fn require_gifsicle() -> Option<PathBuf> {
let binary_name = if cfg!(windows) {
"gifsicle.exe"
} else {
"gifsicle"
};
let gifsicle = project_root()
.join("vendor")
.join("gifsicle")
.join(if cfg!(windows) {
"gifsicle.exe"
} else {
"gifsicle"
});
.join(binary_name);

if !gifsicle.exists() {
eprintln!(
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/all-formats/sample-no-doctype.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions test/fixtures/all-formats/sample-with-doctype.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/all-formats/sample.avif
Binary file not shown.
Binary file added test/fixtures/all-formats/sample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/all-formats/sample.heic
Binary file not shown.
Binary file added test/fixtures/all-formats/sample.heif
Binary file not shown.
Binary file added test/fixtures/all-formats/sample.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/all-formats/sample.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/all-formats/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/fixtures/all-formats/sample.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ui/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const boot = async () => {
document.body.classList.add('platform-desktop')
if (osType === 'windows') {
document.body.classList.add('platform-win')
} else if (osType === 'linux') {
document.body.classList.add('platform-linux')
}
}

Expand Down
Loading