CI #2236
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
paths-ignore: ['**/*.md', '^\.*', 'LICENSE'] | |
pull_request: | |
paths-ignore: ['**/*.md', '^\.*', 'LICENSE'] | |
schedule: | |
- cron: '31 1,12 * * *' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout V | |
uses: actions/checkout@v4 | |
with: | |
repository: vlang/v | |
- name: Checkout C2V | |
uses: actions/checkout@v4 | |
with: | |
path: c2v | |
- name: Install dependencies | |
run: | | |
if [ "${{ runner.os }}" == "Linux" ]; then | |
sudo apt update -y -qq | |
sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev | |
else | |
brew install sdl2 sdl2_mixer sdl2_net libpng libsamplerate | |
fi | |
- name: Build V | |
run: make && ./v symlink | |
- name: Setup C2V | |
run: | | |
mv c2v ~/.vmodules/c2v | |
v -g ~/.vmodules/c2v/ || true | |
- name: Test C2V | |
run: v -g test ~/.vmodules/c2v/ | |
- 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 just p_enemy.v | |
run: | | |
cd ~/.vmodules/c2v/ | |
v -g run tools/build_doom_file.vsh doom/p_enemy | |
- name: Translate the whole game in project/folder mode | |
run: | | |
touch ~/DOOM1.WAD | |
if [ "${{ runner.os }}" == "Linux" ]; then | |
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh | |
else | |
echo "TODO: ... building doom should be fixed on macos, after it regressed in eafdd3c" | |
fi | |
test-regressions: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
VFLAGS: -cc tcc | |
DISPLAY: :99 | |
LIBGL_ALWAYS_SOFTWARE: true | |
VTMP: /tmp | |
steps: | |
- name: Checkout V | |
uses: actions/checkout@v4 | |
with: | |
repository: vlang/v | |
- name: Checkout C2V | |
uses: actions/checkout@v4 | |
with: | |
path: c2v | |
- name: Install dependencies | |
run: | | |
sudo apt update -y -qq | |
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 | |
sudo apt install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb xsel xclip | |
- name: Setup test tools | |
run: | | |
# 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 V | |
run: make && ./v symlink | |
- name: Setup C2V | |
run: | | |
mv c2v ~/.vmodules/c2v | |
v -g ~/.vmodules/c2v/ || true | |
- name: Test C2V | |
run: v -g test ~/.vmodules/c2v/ | |
- 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: WAD_FILE=~/doom1.wad ~/code/doom/build_whole_project.sh | |
- name: Sample and compare | |
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 | |
sleep 1; 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 |