fractol/mlx/.github/workflows/ci.yml

79 lines
2.2 KiB
YAML
Raw Normal View History

2023-10-25 13:29:53 +02:00
# -----------------------------------------------------------------------------
# Codam Coding College, Amsterdam @ 2022-2023-2023 by W2Wizard.
# See README in the root project for more information.
# -----------------------------------------------------------------------------
2023-03-01 04:36:42 +01:00
name: Build
2023-10-25 13:29:53 +02:00
#=============================================================================#
2023-03-01 04:36:42 +01:00
on:
2023-10-25 13:29:53 +02:00
push:
branches: [ master ]
2023-03-01 04:36:42 +01:00
pull_request:
branches: [ master ]
2023-10-25 13:29:53 +02:00
#=============================================================================#
2023-03-01 04:36:42 +01:00
jobs:
2023-10-25 13:29:53 +02:00
# Tests
#=============================================================================#
2023-03-01 04:36:42 +01:00
unit-test:
timeout-minutes: 10
runs-on: ubuntu-latest
2023-10-25 13:29:53 +02:00
needs: build
2023-03-01 04:36:42 +01:00
env:
DISPLAY: ":99"
steps:
2023-10-25 13:29:53 +02:00
- name: Clone repository
uses: actions/checkout@v3
2023-03-01 04:36:42 +01:00
2023-10-25 13:29:53 +02:00
- name: Install Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq xorg-dev xvfb
- name: Setup virtual screen
run: Xvfb $DISPLAY -screen 0 1280x1024x24 &
2023-03-01 04:36:42 +01:00
2023-10-25 13:29:53 +02:00
- name: Build MLX42 & tests
run: cmake -DBUILD_TESTS=YES -B ${{github.workspace}}/build && cmake --build ${{github.workspace}}/build --parallel
2023-03-01 04:36:42 +01:00
2023-10-25 13:29:53 +02:00
- name: Run tests
run: ctest --output-on-failure --test-dir ${{github.workspace}}/build
# Unix
#=============================================================================#
2023-03-01 04:36:42 +01:00
2023-10-25 13:29:53 +02:00
build:
2023-03-01 04:36:42 +01:00
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
matrix:
2023-10-25 13:29:53 +02:00
os: [ubuntu-latest, macos-latest, windows-latest]
2023-03-01 04:36:42 +01:00
steps:
- name: Clone repository
2023-10-25 13:29:53 +02:00
uses: actions/checkout@v3
2023-03-01 04:36:42 +01:00
2023-10-25 13:29:53 +02:00
# Windows will just fetch glfw with cmake automatically.
# This avoids doing extra work like installing a package manager.
2023-03-01 04:36:42 +01:00
- name: Install Dependencies
2023-10-25 13:29:53 +02:00
if: matrix.os != 'windows-latest'
2023-03-01 04:36:42 +01:00
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update -qq
2023-10-25 13:29:53 +02:00
sudo apt-get install -y -qq xorg-dev
2023-03-01 04:36:42 +01:00
elif [ "$RUNNER_OS" == "macOS" ]; then
brew update
brew install glfw
fi
- name: Build
2023-10-25 13:29:53 +02:00
run: cmake -B build && cmake --build build --parallel
2023-03-01 04:36:42 +01:00
2023-10-25 13:29:53 +02:00
#=============================================================================#