From eb82d5383627c22bb7eea72b07932674f8c70fe5 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Sat, 14 Oct 2023 12:37:41 +0200 Subject: [PATCH 1/2] ci: update workflows --- .github/workflows/ci.yml | 126 ++++++++++++--------- .github/workflows/doom_gfx_regressions.yml | 100 ---------------- 2 files changed, 71 insertions(+), 155 deletions(-) delete mode 100644 .github/workflows/doom_gfx_regressions.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3108dbb..92877b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,109 +2,125 @@ name: CI on: push: - branches: - - 'master' pull_request: schedule: - cron: '31 1,12 * * *' jobs: - ubuntu: - runs-on: ubuntu-latest + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + fail-fast: false + runs-on: ${{ matrix.os }} steps: - name: Checkout V - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: vlang/v - - name: Checkout c2v - uses: actions/checkout@v2 + - name: Checkout C2V + uses: actions/checkout@v4 with: path: c2v - - - name: Install Dependencies + - name: Install dependencies run: | - sudo apt-get update -y -qq - sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev - + 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 -githubci - - - name: Build c2v and setup ~/code + run: make -j4 && ./v symlink -githubci + - name: Setup C2V run: | - ls -la /home/runner/work/c2v/c2v/c2v - ln -s /home/runner/work/c2v/c2v/c2v ~/.vmodules/c2v - mkdir -p ~/code/ - v -g ~/.vmodules/c2v/ - ~/.vmodules/c2v/c2v || true - - - name: Test c2v + mv c2v ~/.vmodules/c2v + v -g ~/.vmodules/c2v/ || true + - name: Test C2V run: | v -g test ~/.vmodules/c2v/ v -g run ~/.vmodules/c2v/tests/run_tests.vsh - - 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: | - cd ~/code/doom touch ~/DOOM1.WAD WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh - macos: - runs-on: macos-latest + 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@v2 + uses: actions/checkout@v4 with: repository: vlang/v - - name: Checkout c2v - uses: actions/checkout@v2 + - name: Checkout C2V + uses: actions/checkout@v4 with: path: c2v - - - name: Install Dependencies - run: brew install sdl2 sdl2_mixer sdl2_net libpng libsamplerate - + - 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 -githubci - - - name: Build c2v and setup ~/code + run: make -j4 && ./v symlink -githubci + - name: Setup C2V run: | - ls -la /Users/runner/work/c2v/c2v/c2v - ln -s /Users/runner/work/c2v/c2v/c2v ~/.vmodules/c2v - mkdir -p ~/code/ - v -g ~/.vmodules/c2v/ - ~/.vmodules/c2v/c2v || true - - - name: Test c2v + mv c2v ~/.vmodules/c2v + v -g ~/.vmodules/c2v/ || true + - name: Test C2V run: | v -g test ~/.vmodules/c2v/ v -g run ~/.vmodules/c2v/tests/run_tests.vsh - - 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: WAD_FILE=~/doom1.wad ~/code/doom/build_whole_project.sh + - name: Sample and compare + id: compare + continue-on-error: true run: | - cd ~/code/doom - touch ~/DOOM1.WAD - WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh + 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 diff --git a/.github/workflows/doom_gfx_regressions.yml b/.github/workflows/doom_gfx_regressions.yml deleted file mode 100644 index 9f47bc4..0000000 --- a/.github/workflows/doom_gfx_regressions.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Graphics CI - -on: - push: - branches: - - 'master' - paths-ignore: - - "**.md" - pull_request: - paths-ignore: - - "**.md" - -jobs: - 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: 10 - env: - VFLAGS: -cc tcc - DISPLAY: :99 - LIBGL_ALWAYS_SOFTWARE: true - VTMP: /tmp - steps: - - name: Checkout V - uses: actions/checkout@v2 - with: - repository: vlang/v - - - name: Build local v - run: make && ./v symlink -githubci - - - name: Checkout c2v - uses: actions/checkout@v2 - with: - path: c2v - - - 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 : 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 - 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 and setup ~/code - run: | - ls -la /home/runner/work/c2v/c2v/c2v - ln -s /home/runner/work/c2v/c2v/c2v ~/.vmodules/c2v - mkdir -p ~/code/ - v -g ~/.vmodules/c2v/ - ~/.vmodules/c2v/c2v || true - - - name: Test c2v - run: | - v -g test ~/.vmodules/c2v/ - v -g run ~/.vmodules/c2v/tests/run_tests.vsh - - - 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 - id: compare - continue-on-error: true - run: | - Xvfb $DISPLAY -screen 0 800x600x24 & - sleep 1 # give xvfb time to start - 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 From fd56f6b565b6364fcbbf7e77f56e80ff5596d9cc Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Sat, 14 Oct 2023 13:02:06 +0200 Subject: [PATCH 2/2] ci: ignore unrelated paths --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92877b1..b3e72fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,9 @@ name: CI on: push: + paths-ignore: ['**/*.md', '^\.*', 'LICENSE'] pull_request: + paths-ignore: ['**/*.md', '^\.*', 'LICENSE'] schedule: - cron: '31 1,12 * * *'