-
Notifications
You must be signed in to change notification settings - Fork 85
118 lines (112 loc) · 3.92 KB
/
test.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
name: Test
on:
push:
branches: [ master ]
paths-ignore:
- 'docs/**'
- '.github/workflows/publish-site.yml'
pull_request:
branches: [ master ]
paths-ignore:
- 'docs/**'
- '.github/workflows/publish-site.yml'
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
artifact: windows
reqs_file: requirements_full.txt
- name: Windows (Qt 5)
os: windows-latest
artifact: windows-qt5
reqs_file: requirements_qt5_full.txt
- name: MacOS
os: macos-latest
artifact: macos
reqs_file: requirements_full.txt
- name: Linux
os: ubuntu-latest
artifact: linux
reqs_file: requirements_full.txt
runs-on: ${{ matrix.os }}
env:
game_test_files_token: ${{ secrets.GAME_TEST_FILES_TOKEN }}
DISPLAY: ':99.0'
defaults:
run:
shell: bash
steps:
- name: Checkout wwrando
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout game-test-files
if: ${{ env.game_test_files_token != '' }}
uses: actions/checkout@v4
with:
repository: LagoLunatic/game-test-files
path: game-test-files
token: ${{ env.game_test_files_token }}
- name: Extract test files
if: ${{ env.game_test_files_token != '' }}
run: |
7z x $PWD/game-test-files/files/GZLE01.7z -o$PWD/game-test-files/files
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # Cache all pip dependency downloads
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ${{ matrix.reqs_file }}
- name: Install any missing Qt dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y qtbase5-dev libxcb-cursor0 libxcb-xinerama0 xvfb herbstluftwm
- name: Set variables
id: vars
run: |
USER_INPUT_VERSION=${{ github.event.inputs.version }}
TXT_VERSION=$(cat version.txt)
GIT_SHA_SHORT=$(git rev-parse --short=7 ${{ github.sha }})
echo "full_version=${USER_INPUT_VERSION:-${TXT_VERSION}_${GIT_SHA_SHORT}}" >> $GITHUB_OUTPUT
- name: Set up Qt
uses: tlambert03/setup-qt-libs@v1
if: runner.os == 'Linux'
- name: Build "display"
if: runner.os == 'Linux'
run: |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
- name: Prepare test env vars (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
echo WW_GZLE01_STRIPPED_PATH=%CD%/game-test-files/files/GZLE01.iso >> .env
echo WW_RANDO_OUTPUT_DIR=%CD%/wwrando-output >> .env
- name: Prepare test env vars (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
echo WW_GZLE01_STRIPPED_PATH=$PWD/game-test-files/files/GZLE01.iso >> .env
echo WW_RANDO_OUTPUT_DIR=$PWD/wwrando-output >> .env
- name: Test with pytest (with saving)
if: ${{ env.game_test_files_token != '' }}
run: |
pip install pytest pytest-cov
pytest test --cov --cov-report=html
- name: Test with pytest (without saving)
if: ${{ env.game_test_files_token == '' }}
run: |
pip install pytest pytest-cov
pytest test --cov --cov-report=html -m "not saving"
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: wwrando-htmlcov-${{ steps.vars.outputs.full_version }}-${{ matrix.artifact }}
path: htmlcov