Skip to content

wip

wip #132

name: Build & Test
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
pull_request:
jobs:
build-and-test:
name: Build and test
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
zig_version:
- latest
#- master - not compatible yet
runs-on: ${{ matrix.os }}
steps:
- name: Prepare git to leave line endings alone
run: git config --global core.autocrlf input
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
with:
version: ${{ matrix.zig_version }}
- if: matrix.os == 'ubuntu-latest'
name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install libgl-dev libxi-dev \
libx11-dev xserver-xorg-dev xorg-dev
- name: Debug
shell: bash
run: |
xxd src/test_data/atreus-internal.json
- run: |
zig build
zig build test
- uses: actions/upload-artifact@v4
if: always()
with:
name: klawa-${{ matrix.os }}
path: zig-out/bin/klawa*
retention-days: 2
if-no-files-found: error
run-functional-tests:
name: Run functional tests
needs:
- build-and-test
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: klawa-${{ matrix.os }}
path: zig-out/bin
- name: Install dependencies
shell: bash
run: |
pwd
ls -alh zig-out/bin
- if: matrix.os == 'ubuntu-latest'
name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install ffmpeg xdotool x11-apps xvfb
- if: matrix.os == 'windows-latest'
name: Install dependencies
shell: bash
run: |
choco install autohotkey.portable ffmpeg
- if: matrix.os == 'windows-latest'
name: Install Mesa
shell: cmd
run: |
curl.exe -L --output mesa.7z --url https://github.com/pal1000/mesa-dist-win/releases/download/24.2.7/mesa3d-24.2.7-release-msvc.7z
"C:\Program Files\7-Zip\7z.exe" x mesa.7z
dir
systemwidedeploy.cmd 1
- name: Install python dependencies
shell: bash
run: |
cd tests
pip install -r dev-requirements.txt
- if: matrix.os == 'ubuntu-latest'
name: Fix executable permisions
shell: bash
run: |
chmod +x zig-out/bin/klawa
- name: Run tests
shell: bash
run: |
# not running with pytest-xdist because renders are way off
# when framerate drops below expected 60fps:
cd tests && python -m pytest src/
- uses: actions/upload-artifact@v4
if: always()
with:
name: report-${{ matrix.os }}
path: tests/report/
retention-days: 2
if-no-files-found: error
# deploy-preview:
# name: Deploy tests results
# needs:
# - run-functional-tests
# runs-on: ubuntu-latest
# defaults:
# run:
# shell: bash
# working-directory: ./tests
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# name: report
# path: tests/report
# - name: Install Vercel CLI
# run: npm install --global vercel@latest
# - name: Pull Vercel Environment Information
# run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
# - name: Build Project Artifacts
# run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
# - name: Deploy Project Artifacts to Vercel
# run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > url.txt
# - name: Add summary
# shell: bash
# run: |
# echo '### Deployed' >> $GITHUB_STEP_SUMMARY
# cat url.txt >> $GITHUB_STEP_SUMMARY