Skip to content

Merge pull request #85 from hartwork/precommit-autoupdate #305

Merge pull request #85 from hartwork/precommit-autoupdate

Merge pull request #85 from hartwork/precommit-autoupdate #305

Workflow file for this run

# This file is part of the sandwine project.
#
# Copyright (c) 2023 Sebastian Pipping <[email protected]>
#
# sandwine is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# sandwine is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with sandwine. If not, see <https://www.gnu.org/licenses/>.
name: Run the test suite
# Drop permissions to minimum, for security
permissions:
contents: read
on:
pull_request:
push:
schedule:
- cron: '0 3 * * 5' # Every Friday at 3am
workflow_dispatch:
jobs:
run-tests:
name: Run the test suite
strategy:
matrix:
python-version: [3.9, 3.13] # no particular need for in-between versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends --yes -V \
libcap-dev \
python3-pip \
wget \
xvfb \
zenity
sudo apt-get install --no-install-recommends --yes -V \
wine32:i386
pip3 install --ignore-installed build pip setuptools wheel
- name: Build sandwine
run: |
set -x
python3 -m build
ls -l dist/
tar vtf dist/sandwine-*.tar.gz
unzip -l dist/sandwine-*.whl
- name: Install recent-enough Bubblewrap
run: |
bubble_wrap_version=0.8.0
bubble_wrap_sha256sum=957ad1149db9033db88e988b12bcebe349a445e1efc8a9b59ad2939a113d333a
set -x -u
wget https://github.com/containers/bubblewrap/releases/download/v${bubble_wrap_version}/bubblewrap-${bubble_wrap_version}.tar.xz
sha256sum -c <(echo "${bubble_wrap_sha256sum} *bubblewrap-${bubble_wrap_version}.tar.xz")
tar xf bubblewrap-${bubble_wrap_version}.tar.xz
cd bubblewrap-${bubble_wrap_version}
./configure
make -j$(nproc)
sudo make install
[[ "$(bwrap --version)" = "bubblewrap ${bubble_wrap_version}" ]]
- name: Install sandwine
run: |
set -x -u
pip3 install -e .
echo "${HOME}/.local/bin" >> "${GITHUB_PATH}"
- name: Run smoke tests
run: |
set -x
python --version
head -n1 "$(type -P sandwine)"
sandwine --help
sandwine --version
sand --help
sand --version
# Defaults
sandwine -- CMD /C DIR 'Z:\'
# File system effect
sudo touch /mnt/file123
ls -l /mnt/file123
(
set +e
sandwine --no-wine -- ls -l /mnt/file123
[[ $? == 2 ]]
)
sandwine --no-wine --pass /mnt/file123:ro -- ls -l /mnt/file123
sandwine --no-wine --pass /mnt/:ro -- ls -l /mnt/file123
sandwine --no-wine --pass /mnt:ro -- ls -l /mnt/file123
sandwine --no-wine --pass /mnt:rw -- ls -l /mnt/file123
# Custom wine prefix
mkdir dotwine # to suppress call to winecfg
sandwine --dotwine dotwine/:rw -- CMD /C DIR "Z:\\home\\${USER}\\.wine\\"
# X11
(
set +e
sandwine --xvfb --no-wine -- zenity --timeout 1 --info hello
[[ $? == 5 ]] # i.e. timeout exceeded
)
# Retry
(
set +e
sandwine --retry --no-wine --pass "${PWD}":rw -- sh -c 'echo line >> file.txt ; exit 123'
[[ $? == 123 ]]
)
[[ "$(wc -l < file.txt)" == 2 ]]
rm file.txt
# Networking
wget -S -O/dev/null https://github.com/
(
set +e
sandwine --no-wine -- wget -S -O/dev/null https://github.com/
[[ $? == 4 ]]
)
sandwine --network --no-wine -- wget -S -O/dev/null https://github.com/
# Without PTY (not recommended!)
(
set +e
sandwine --no-wine --no-pty -- sh -c 'exit 123'
[[ $? == 123 ]]
)