macos changes #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: Install Gnome and friends | |
| run: | | |
| sudo apt update | |
| sudo apt install ubuntu-desktop -y | |
| - 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: gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' | |
| - 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 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Prepare Scripts | |
| run: | | |
| New-Item -Path "$env:USERPROFILE/.config/dark-mode-daemon/scripts/" -ItemType Directory | |
| 'Add-Content -Path $env:USERPROFILE/protocol.txt -Value "scripts ran"' | Out-File -FilePath "$env:USERPROFILE/.config/dark-mode-daemon/scripts/executable.ps1" | |
| - name: Run Daemon | |
| run: cargo run --verbose -- daemon & | |
| - name: Switch Mode | |
| run: New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force | |
| - name: Assert Scripts Did Ran | |
| run: | | |
| Start-Sleep -Seconds 5 | |
| # Once when starting the scripts | |
| Add-Content -Path "$env:USERPROFILE/expected.txt" -Value "scripts ran" | |
| # Once for when we toggled the mode | |
| Add-Content -Path "$env:USERPROFILE/expected.txt" -Value "scripts ran" | |
| Compare-Object expected.txt protocol.txt |