-
Notifications
You must be signed in to change notification settings - Fork 5
153 lines (130 loc) · 4.5 KB
/
run-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# 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 ]]
)