ci: try fixing ALSA
errors on ubuntu-latest
#87
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: Visual CI | |
on: | |
push: | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
concurrency: | |
group: visual-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
ubuntu-latest-visual-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
env: | |
VFLAGS: -cc tcc -no-retry-compilation | |
VTMP: /tmp | |
DISPLAY: :99 | |
LIBGL_ALWAYS_SOFTWARE: true | |
SDL2_VERSION: 2.28.2 | |
SHY_CI_VISUAL_TEST: 1 | |
steps: | |
- name: Checkout V | |
uses: actions/checkout@v2 | |
with: | |
repository: vlang/v | |
- name: Build local v | |
run: make && sudo ./v symlink | |
- name: Install dependencies | |
run: | | |
curl -L https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz -o SDL2.tar.gz | |
tar -zxvf SDL2.tar.gz | |
sudo apt-get update | |
# vgret dependencies | |
# imagemagick : convert, mogrify, import | |
# xvfb : xvfb | |
# openimageio-tools : idiff | |
# libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true) | |
# freeglut3-dev : Fixes graphic apps compilation with tcc | |
# alsa-utils : Fixes `ALSA lib confmisc.c:855:(parse_card) cannot find card '0'` errors on newer ubuntu-images | |
sudo apt-get install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb alsa-utils | |
# Get imgur upload script | |
wget https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh | |
chmod +x ./imgur.sh | |
# Get reference images to test against | |
git clone https://github.com/Larpon/shy-visual-tests | |
- name: Build SDL | |
run: | | |
cd SDL2-${SDL2_VERSION} | |
mkdir build | |
cd build | |
../configure | |
make | |
sudo make install | |
- name: Install sdl module | |
run: | | |
git clone https://github.com/vlang/sdl.git ~/.vmodules/sdl | |
v run ~/.vmodules/sdl/setup.vsh | |
- name: Checkout shy | |
uses: actions/checkout@v2 | |
with: | |
path: shy | |
- name: Simulate "v install shy" | |
run: mv shy ~/.vmodules | |
- name: Build shy | |
run: v -g ~/.vmodules/shy | |
- name: Symlink shy | |
run: sudo ln -s ~/.vmodules/shy/shy /usr/local/bin/shy | |
- name: Run 'shy --help' | |
run: shy --help | |
- name: Run 'shy doctor' | |
run: shy doctor | |
- name: Sample and compare | |
id: compare | |
continue-on-error: true | |
run: | | |
Xvfb $DISPLAY -dpi 96 -screen 0 960x614x24 & | |
sleep 1 # give xvfb time to start | |
v gret -r ~/.vmodules/shy -t ./shy-visual-tests/vgret.shy_examples.toml -v ./fresh-examples ./shy-visual-tests | |
v gret -r ~/.vmodules/shy -t ./shy-visual-tests/vgret.shy_visual_tests.toml -v ./fresh-visual-tests ./shy-visual-tests | |
- name: Upload regression to imgur | |
if: steps.compare.outcome != 'success' | |
run: | | |
./imgur.sh /tmp/fail.png | |
./imgur.sh /tmp/diff.png | |
exit 1 |