forked from vlang/v
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (114 loc) · 4.47 KB
/
c2v_ci.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
name: C2V apps
on:
push:
paths-ignore:
- "**.md"
- "**.yml"
- "doc/**"
- "examples/**"
- "tutorials/**"
pull_request:
paths-ignore:
- "**.md"
- "**.yml"
- "doc/**"
- "examples/**"
- "tutorials/**"
concurrency:
group: build-c2v-apps-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
doom-compiles:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Build V
run: make && ./v symlink -githubci
- name: Build C2V
run: |
echo "Clone C2V"
mkdir -p ~/code/
git clone --depth 1 https://github.com/vlang/c2v ~/code/c2v
ln -s ~/code/c2v ~/.vmodules/c2v
v -g ~/.vmodules/c2v/
~/.vmodules/c2v/c2v || true
- name: Install Doom Dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
- name: Build original Chocolate Doom
run: |
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: |
cd ~/code/doom
touch ~/DOOM1.WAD
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh
doom-regressions:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 20
env:
VFLAGS: -cc tcc
DISPLAY: :99
LIBGL_ALWAYS_SOFTWARE: true
VTMP: /tmp
steps:
- uses: actions/checkout@v3
- name: Build V
run: make && ./v symlink -githubci
- name: Setup dependencies
run: |
sudo apt-get update -y -qq
# c2v / DOOM dependencies
sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
# 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
sudo apt-get install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb xsel xclip
# Fetch the free ~4MB DOOM1.WAD from the link at https://doomwiki.org/wiki/DOOM1.WAD
wget https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad -O ~/doom1.wad
# Get imgur upload script
wget https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
chmod +x ./imgur.sh
# Get regression images to test against
git clone https://github.com/Larpon/doom-regression-images
- name: Build C2V
run: |
echo "Clone C2V"
mkdir -p ~/code/
git clone --depth 1 https://github.com/vlang/c2v ~/code/c2v
ln -s ~/code/c2v ~/.vmodules/c2v
v -g ~/.vmodules/c2v/
~/.vmodules/c2v/c2v || true
- name: Build original Chocolate Doom
run: |
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: |
cd ~/code/doom
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 1; while [ ! -f /var/tmp/Xvfb_screen0 ]; do sleep 0.5; done # give xvfb time to start, even on slow CI runs
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