Skip to content

Commit

Permalink
Add actions and end-to-end test
Browse files Browse the repository at this point in the history
  • Loading branch information
Colonial-Dev committed Sep 6, 2023
1 parent 999bb08 commit 99a0d0b
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 2 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# i hate yaml so much
# semantic whitespace ass config format
# "wrong syntax on line 42" REAL HELPFUL

name: Release

on: workflow_dispatch

env:
CARGO_TERM_COLOR: always

jobs:
build-linux:
name: Build (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install MUSL dependencies
run: sudo apt-get install -y musl-tools
- name: Install MUSL toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
- name: Build
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: satpaper-x86_64-unknown-linux-musl
path: target/x86_64-unknown-linux-musl/release/satpaper
build-win:
name: Build (Windows)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: cargo build --release
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: satpaper-x86_64-pc-windows-gnu.exe
path: target/release/satpaper.exe
build-mac:
name: Build (macOS)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: cargo build --release
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: satpaper-x86_64-apple-darwin
path: target/release/satpaper
22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Cargo Comprehensive

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build
- name: Run tests
run: cargo test --release
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v0.5.1
- Fix issue where Ubuntu GNOME was not recognized as supported (#7)
- Fix issue where `--once` flag check was incorrectly timed (after the automatic wallpaper update handling rather than before)
- Image tiles are now downloaded serially rather than spawning a thread-per; this is somewhat slower, but avoids hogging FDs on *nix and is probably easier on SLIDER.

### September 3, 2023 / v0.5.0
- Added `--once` flag to make program usable in non-daemon context
- Switched to `mimalloc` for greater control over when memory is returned to the OS
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<h1 align="center">Satpaper</h1>
<h3 align="center">Display near-real-time satellite imagery on your desktop.</h3>

<p align="center">
<img src="https://img.shields.io/github/actions/workflow/status/Colonial-Dev/Satpaper/rust.yml">
<img src="https://img.shields.io/github/license/Colonial-Dev/Satpaper">
<img src="https://img.shields.io/github/stars/Colonial-Dev/Satpaper">
</p>

<p align = "center">
<img src=".github/satpaper_latest.png" width = 768>
<br>
Expand Down Expand Up @@ -36,7 +42,12 @@ If your environment is not supported, you have a few options:
PRs to add automatic support are also welcome!

### Precompiled Binaries
Precompiled versions of Satpaper are available for Linux (compiled against `x86_64-unknown-linux-musl`, which should Just Work™ on most distributions) and Windows in the [releases](https://github.com/Colonial-Dev/satpaper/releases) section.
Precompiled versions of Satpaper are available for:
- Linux (compiled against `x86_64-unknown-linux-musl`, which should Just Work™ on most distributions)
- Windows (compiled on Github actions `windows-latest`)
- macOS (compiled on Github actions `macos-latest`)

All binaries can be found in the [releases](https://github.com/Colonial-Dev/satpaper/releases) section. Additionally, please note that I'm only able to test the Linux binary - please open an issue if there's something wrong with the binary for your platform (doesn't work at all, only works on the newest version, whatever.)

### From Source

Expand Down
26 changes: 25 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use anyhow::{Result, Context};
use clap::Parser;
use mimalloc::MiMalloc;

use config::*;
use crate::config::*;

#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
Expand Down Expand Up @@ -84,3 +84,27 @@ fn update_wallpaper() -> Result<()> {
#[allow(unreachable_code)]
Ok(())
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn generate_wallpaper() -> Result<()> {
let config = Config {
satellite: Satellite::GOESEast,
resolution_x: 2556,
resolution_y: 1440,
disk_size: 95,
target_path: ".".into(),
wallpaper_command: None,
once: false
};

slider::composite_latest_image(&config)?;

std::fs::remove_file("./satpaper_latest.png")?;

Ok(())
}
}

0 comments on commit 99a0d0b

Please sign in to comment.