test: add test.yml #1
This file contains 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: Test | |
on: | |
push: | |
pull_request: | |
jobs: | |
test-with-xdg-var: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
substituters = https://cache.garnix.io https://cache.nixos.org/ | |
- id: create-temp-dir | |
run: mkdir -p $HOME/test-data-dir/ | |
- id: run-wine | |
run: | | |
XDG_DATA_HOME=$HOME/test-data-dir/ nix run .#winetricks | |
- id: test-directory | |
run: | | |
if [ -d "$HOME/test-data-dir/affinity" ]; then | |
echo "$HOME/test-data-dir/affinity exists correctly" | |
else | |
echo "::error::Directory '$HOME/test-data-dir' does not exist" | |
exit 1 | |
fi | |
test-without-xdg-var: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
substituters = https://cache.garnix.io https://cache.nixos.org/ | |
- id: run-wine | |
run: | | |
unset XDG_DATA_HOME | |
nix run .#winetricks | |
- id: test-directory | |
run: | | |
if [ -d "$HOME/.local/share/affinity" ]; then | |
echo "Fell back without xdg_data_home correctly" | |
else | |
echo "::error::Directory '$HOME/.local/share/affinity' does not exist" | |
exit 1 | |
fi |