-
-
Notifications
You must be signed in to change notification settings - Fork 5
144 lines (125 loc) · 3.63 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
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
name: test
on:
pull_request:
branches:
- main
- dev
workflow_dispatch:
env:
TOOL_NAME: Tuw
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: |
pip3 install cpplint==1.6.1 codespell
cpplint --recursive --quiet .
codespell -S subprojects
test:
strategy:
fail-fast: false
matrix:
os: [windows-2022, macos-14]
runs-on: ${{ matrix.os }}
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Meson for Windows
if: runner.os == 'Windows'
run: pip install meson
- name: Install Meson for Unix
if: runner.os != 'Windows'
run: pip3 install meson ninja
- name: Prepare MSVC
if: runner.os == 'Windows'
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
- name: build and run tests for Windows
if: runner.os == 'Windows'
run: |
cd batch_files
./test.bat
# xquartz has xvfb functions
- name: build and run tests for mac
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
bash shell_scripts/test.sh
test_linux_arm64:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
os: [ubuntu, alpine]
steps:
- uses: actions/checkout@v4
- name: Run tests on arm64 image
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static binfmt-support
docker buildx build --platform linux/arm64 -t tuw_arm_test -f docker/${{ matrix.os }}.dockerfile ./
docker run --rm --init -i tuw_arm_test xvfb-run bash test.sh
test_linux_x64:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
os: [ubuntu, alpine]
steps:
- uses: actions/checkout@v4
- name: Run tests on x64 image
run: |
docker build -t tuw_test -f docker/${{ matrix.os }}.dockerfile ./
docker run --rm --init -i tuw_test xvfb-run bash test.sh
build_tests_windows_arm64:
runs-on: windows-2022
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Meson
run: pip install meson
- name: Prepare MSVC
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
- name: build tests
run: |
cd batch_files
./test_arm.bat
- name: copy test files to ./workspace
run: |
mkdir workspace
cp build/ReleaseARM-Test/tests/unit_test.exe workspace
mkdir workspace/json
cp build/ReleaseARM-Test/tests/json/*.json* workspace/json
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tests-windows-arm64
path: workspace
run_tests_windows_arm64:
runs-on: ubuntu-latest
needs: [lint, build_tests_windows_arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: tests-windows-arm64
path: workspace
- name: Run tests with wine-arm64
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static xvfb
docker run --rm --init -i -v $(pwd)/workspace/:/workspace docker.io/linaro/wine-arm64 xvfb-run wine-arm64 cmd.exe /c '/workspace/unit_test.exe'