-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
152 lines (144 loc) · 5.85 KB
/
Copy pathc2v_ci.yml
File metadata and controls
152 lines (144 loc) · 5.85 KB
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
name: C2V apps
on:
push:
branches:
- master
paths-ignore:
- 'vlib/v3/**'
- '**.md'
- '**.yml'
- '!**/c2v_ci.yml'
- 'doc/**'
- 'examples/**'
- 'tutorials/**'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
pull_request:
paths-ignore:
- 'vlib/v3/**'
- '**.md'
- '**.yml'
- '!**/c2v_ci.yml'
- 'doc/**'
- 'examples/**'
- 'tutorials/**'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
concurrency:
group: c2v-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
build-doom:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- uses: ./.github/actions/cache-apt-packages-action
- name: Build V
run: make && ./v symlink
- name: Set 8.8.8.8 as dns server
run: |
sudo sed -i 's/#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
sudo systemctl daemon-reload
sudo systemctl restart systemd-networkd
sudo systemctl restart systemd-resolved
dig distro.ibiblio.org
- name: Install C2V
run: |
v retry -- v install --git https://github.com/vlang/c2v
v -g ~/.vmodules/c2v/ || true
- name: Install dependencies
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
.github/workflows/disable_azure_mirror.sh
v retry -- sudo apt update -y -qq
v retry -- sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
else
v retry -- brew install sdl2 sdl2_mixer sdl2_net libpng libsamplerate
fi
- name: Build original Chocolate Doom
run: |
v retry -- git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
cd ~/code/doom/chocolate-doom
cmake -DCMAKE_BUILD_TYPE=Debug .
make chocolate-doom
- name: Translate the whole game in project/folder mode and compile it
run: |
touch ~/DOOM1.WAD
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh
test-regression:
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
VFLAGS: -cc tcc
DISPLAY: :99
LIBGL_ALWAYS_SOFTWARE: true
VTMP: /tmp
steps:
- uses: actions/checkout@v7.0.1
- uses: ./.github/actions/cache-apt-packages-action
- name: Build V
run: make && ./v symlink
- name: Set 8.8.8.8 as dns server
run: |
sudo sed -i 's/#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
sudo systemctl daemon-reload
sudo systemctl restart systemd-networkd
sudo systemctl restart systemd-resolved
dig distro.ibiblio.org
- name: Install C2V
run: |
v retry -- v install --git https://github.com/vlang/c2v
v -g ~/.vmodules/c2v/ || true
- name: Install dependencies
run: |
.github/workflows/disable_azure_mirror.sh
v retry -- sudo apt update -y -qq
v retry -- sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
# c2v / DOOM dependencies
# vgret dependencies
# imagemagick : convert, mogrify, import
# xvfb : For starting X11 Virtual FrameBuffers
# openimageio-tools : idiff
# libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true)
# freeglut3-dev : Fixes graphic apps compilation with tcc
v retry -- sudo apt install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb xsel xclip
- name: Setup test tools
run: |
# Fetch the free shareware DOOM1.WAD from NetBSD's pkgsrc distfile mirror
v retry -- v download https://cdn.NetBSD.org/pub/pkgsrc/distfiles/doom1-1.9/shareware_doom_iwad.zip
echo '9fe5a32a24efa622ff7017303d3c8fdc7b4e6c4ec548e50bea402bfa9a1f320ce3f316f4a7f62e64786af876776d51b20fc7688f497896aa176f97b85ada30f9 shareware_doom_iwad.zip' | sha512sum --check
unzip -p shareware_doom_iwad.zip DOOM1.WAD > ~/doom1.wad
rm shareware_doom_iwad.zip
# Get imgur upload script
v retry -- v download https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
chmod +x ./imgur.sh
# Get regression images to test against
v retry -- git clone https://github.com/Larpon/doom-regression-images
- name: Build original Chocolate Doom
run: |
v retry -- git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
cd ~/code/doom/chocolate-doom
cmake -DCMAKE_BUILD_TYPE=Debug .
make chocolate-doom
- name: Translate the whole game in project/folder mode
run: WAD_FILE=~/doom1.wad ~/code/doom/build_whole_project.sh
- name: Sample and compare with vgret
id: compare
continue-on-error: true
run: |
Xvfb "$DISPLAY" -screen 0 800x600x24 -fbdir /var/tmp/ &
sleep 2; while [ ! -f /var/tmp/Xvfb_screen0 ]; do sleep 0.5; done # give xvfb time to start, even on slow CI runs
sleep 5
v gret -r ~/code/doom -t ./doom-regression-images/vgret.doom.toml -v ./doom-sample_images ./doom-regression-images || {
echo "First vgret comparison failed, retrying once with fresh screenshots..."
rm -rf ./doom-sample_images
sleep 5
v gret -r ~/code/doom -t ./doom-regression-images/vgret.doom.toml -v ./doom-sample_images ./doom-regression-images
}
- name: Upload regression to imgur
if: steps.compare.outcome != 'success'
run: |
./imgur.sh /tmp/fail.png
./imgur.sh /tmp/diff.png
exit 1