Skip to content

Commit

Permalink
gh action test for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasvanEyk committed Sep 1, 2024
1 parent 6d62d65 commit 3ace766
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Integration Tests

on:
push:

env:
CARGO_TERM_COLOR: always

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Prepare Scripts
run: |
mkdir -p $HOME/.config/dark-mode-daemon/scripts/
cat <<EOF > $HOME/.config/dark-mode-daemon/scripts/executable.sh
#!/usr/bin/env bash
echo "scripts ran" >> $HOME/protocol.txt
EOF
chmod +x $HOME/.config/dark-mode-daemon/scripts/executable.sh
- name: Run Daemon
run: cargo run --verbose -- daemon &
- name: Switch Mode
# TODO: Actually switch the mode
run: echo "Switching mode..."
- name: Assert Scripts Did Ran
run: |
sleep 5
# Once when starting the scripts
echo "scripts ran" >> $HOME/expected.txt
# Once for when we toggled the mode
echo "scripts ran" >> $HOME/expected.txt
diff $HOME/expected.txt $HOME/protocol.txt
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Prepare Scripts
run: |
mkdir -p $HOME/.config/dark-mode-daemon/scripts/
cat <<EOF > $HOME/.config/dark-mode-daemon/scripts/executable.sh
#!/usr/bin/env bash
echo "scripts ran" >> $HOME/protocol.txt
EOF
chmod +x $HOME/.config/dark-mode-daemon/scripts/executable.sh
- name: Run Daemon
run: cargo run --verbose -- daemon &
- name: Switch Mode
run: osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to not dark mode'
- name: Assert Scripts Did Ran
run: |
sleep 5
# Once when starting the scripts
echo "scripts ran" >> $HOME/expected.txt
# Once for when we toggled the mode
echo "scripts ran" >> $HOME/expected.txt
diff $HOME/expected.txt $HOME/protocol.txt
# windows:
# runs-on: windows-latest
# # TODO: Continue
# steps:
# - uses: actions/checkout@v4
# - name: Build
# run: cargo build --verbose
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use clap::ValueEnum;
use crate::platform::macos::MacOSNativeAdapter;

#[cfg(target_os = "linux")]
use gsettings::{
use crate::platform::linux::gsettings::{
freedesktop::FreeDesktopSettingsProvider, gnome::GnomeDesktopSettingsProvider,
GSettingsAdapter, SettingsProviderImplementation,
};
Expand Down Expand Up @@ -43,10 +43,10 @@ fn main() {

match implementation {
SettingsProviderImplementation::Gnome => {
dark_mode_daemon::cli::run(GSettingsAdapter::<GnomeDesktopSettingsProvider>::new());
crate::cli::run(GSettingsAdapter::<GnomeDesktopSettingsProvider>::new());
}
SettingsProviderImplementation::Freedesktop => {
dark_mode_daemon::cli::run(GSettingsAdapter::<FreeDesktopSettingsProvider>::new());
crate::cli::run(GSettingsAdapter::<FreeDesktopSettingsProvider>::new());
}
};
}

0 comments on commit 3ace766

Please sign in to comment.