-
Notifications
You must be signed in to change notification settings - Fork 7
146 lines (127 loc) · 4.29 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
# This file is part of the sandwine project.
#
# Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
#
# 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-24.04
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 \
apparmor-profiles \
bubblewrap \
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: Allow creation of user namespaces to bubblewrap
run: |
# .. so that we don't get error:
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
# Idea from https://github.com/ocaml/opam/issues/5968#issuecomment-2151748424 .
set -x
sudo ln -s /usr/share/apparmor/extra-profiles/bwrap-userns-restrict /etc/apparmor.d/
sudo systemctl reload apparmor
- 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 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 ]]
)