v2 / .github / workflows / c2v_ci.yml
140 lines · 132 sloc · 5.21 KB · a51ed8416224e15d17196584165f9fae71ec613f
Raw
1name: C2V apps
2
3on:
4 push:
5 paths-ignore:
6 - '**.md'
7 - '**.yml'
8 - '!**/c2v_ci.yml'
9 - 'doc/**'
10 - 'examples/**'
11 - 'tutorials/**'
12 - 'cmd/tools/**'
13 - '!cmd/tools/builders/**.v'
14 pull_request:
15 paths-ignore:
16 - '**.md'
17 - '**.yml'
18 - '!**/c2v_ci.yml'
19 - 'doc/**'
20 - 'examples/**'
21 - 'tutorials/**'
22 - 'cmd/tools/**'
23 - '!cmd/tools/builders/**.v'
24
25concurrency:
26 group: c2v-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
27 cancel-in-progress: true
28
29jobs:
30 build-doom:
31 runs-on: ubuntu-24.04
32 timeout-minutes: 30
33 steps:
34 - uses: actions/checkout@v6
35 - uses: ./.github/actions/cache-apt-packages-action
36 - name: Build V
37 run: make && ./v symlink
38
39 - name: Set 8.8.8.8 as dns server
40 run: |
41 sudo sed -i 's/#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
42 sudo systemctl daemon-reload
43 sudo systemctl restart systemd-networkd
44 sudo systemctl restart systemd-resolved
45 dig distro.ibiblio.org
46
47 - name: Install C2V
48 run: |
49 v retry -- v install --git https://github.com/vlang/c2v
50 v -g ~/.vmodules/c2v/ || true
51 - name: Install dependencies
52 run: |
53 if [ "${{ runner.os }}" == "Linux" ]; then
54 .github/workflows/disable_azure_mirror.sh
55 v retry -- sudo apt update -y -qq
56 v retry -- sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
57 else
58 v retry -- brew install sdl2 sdl2_mixer sdl2_net libpng libsamplerate
59 fi
60 - name: Build original Chocolate Doom
61 run: |
62 v retry -- git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
63 cd ~/code/doom/chocolate-doom
64 cmake -DCMAKE_BUILD_TYPE=Debug .
65 make chocolate-doom
66 - name: Translate the whole game in project/folder mode and compile it
67 run: |
68 touch ~/DOOM1.WAD
69 WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh
70
71 test-regression:
72 runs-on: ubuntu-24.04
73 timeout-minutes: 20
74 env:
75 VFLAGS: -cc tcc
76 DISPLAY: :99
77 LIBGL_ALWAYS_SOFTWARE: true
78 VTMP: /tmp
79 steps:
80 - uses: actions/checkout@v6
81 - uses: ./.github/actions/cache-apt-packages-action
82 - name: Build V
83 run: make && ./v symlink
84
85 - name: Set 8.8.8.8 as dns server
86 run: |
87 sudo sed -i 's/#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
88 sudo systemctl daemon-reload
89 sudo systemctl restart systemd-networkd
90 sudo systemctl restart systemd-resolved
91 dig distro.ibiblio.org
92
93 - name: Install C2V
94 run: |
95 v retry -- v install --git https://github.com/vlang/c2v
96 v -g ~/.vmodules/c2v/ || true
97 - name: Install dependencies
98 run: |
99 .github/workflows/disable_azure_mirror.sh
100 v retry -- sudo apt update -y -qq
101 v retry -- sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
102 # c2v / DOOM dependencies
103 # vgret dependencies
104 # imagemagick : convert, mogrify, import
105 # xvfb : For starting X11 Virtual FrameBuffers
106 # openimageio-tools : idiff
107 # libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true)
108 # freeglut3-dev : Fixes graphic apps compilation with tcc
109 v retry -- sudo apt install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb xsel xclip
110 - name: Setup test tools
111 run: |
112 # Fetch the free ~4MB DOOM1.WAD from the link at https://doomwiki.org/wiki/DOOM1.WAD
113 v retry -- v download https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad
114 mv doom1.wad ~/doom1.wad
115 # Get imgur upload script
116 v retry -- v download https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
117 chmod +x ./imgur.sh
118 # Get regression images to test against
119 v retry -- git clone https://github.com/Larpon/doom-regression-images
120 - name: Build original Chocolate Doom
121 run: |
122 v retry -- git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
123 cd ~/code/doom/chocolate-doom
124 cmake -DCMAKE_BUILD_TYPE=Debug .
125 make chocolate-doom
126 - name: Translate the whole game in project/folder mode
127 run: WAD_FILE=~/doom1.wad ~/code/doom/build_whole_project.sh
128 - name: Sample and compare with vgret
129 id: compare
130 continue-on-error: true
131 run: |
132 Xvfb "$DISPLAY" -screen 0 800x600x24 -fbdir /var/tmp/ &
133 sleep 2; while [ ! -f /var/tmp/Xvfb_screen0 ]; do sleep 0.5; done # give xvfb time to start, even on slow CI runs
134 sleep 5; v gret -r ~/code/doom -t ./doom-regression-images/vgret.doom.toml -v ./doom-sample_images ./doom-regression-images
135 - name: Upload regression to imgur
136 if: steps.compare.outcome != 'success'
137 run: |
138 ./imgur.sh /tmp/fail.png
139 ./imgur.sh /tmp/diff.png
140 exit 1
141