162 lines
5.5 KiB
YAML
162 lines
5.5 KiB
YAML
name: Presubmit
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
format:
|
|
name: Code formatting
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install clang-format
|
|
run: sudo apt-get install clang-format clang-format-9
|
|
- name: Check format
|
|
run: ./scripts/check-format.sh
|
|
build:
|
|
needs: format
|
|
name: Build ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.deps }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04, macos-latest]
|
|
compiler: [gcc, clang]
|
|
deps: [os, fetch, vcpkg]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
- name: Build
|
|
run: |
|
|
if [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then
|
|
sudo apt update
|
|
sudo apt install -y libidn11 libx11-dev libxrandr-dev libxi-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libudev-dev \
|
|
`if [[ "${{matrix.deps}}" == "os" ]]; then echo libtclap-dev libglm-dev libglew-dev libsfml-dev libstb-dev; fi;`
|
|
if [[ "${{matrix.deps}}" == "vcpkg" ]]; then
|
|
git clone https://github.com/Microsoft/vcpkg.git
|
|
./vcpkg/bootstrap-vcpkg.sh
|
|
./vcpkg/vcpkg install sfml tclap glm glew stb
|
|
TOOLCHAIN_ARG="-D CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake"
|
|
else
|
|
TOOLCHAIN_ARG=""
|
|
fi
|
|
if [[ "${{matrix.deps}}" == "fetch" ]]; then
|
|
sudo apt remove -y libtclap-dev libglm-dev libglew-dev libsfml-dev libstb-dev libfreetype6-dev
|
|
fi
|
|
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
|
|
brew install tclap glm glew sfml mesa-glu
|
|
git clone https://github.com/Microsoft/vcpkg.git
|
|
./vcpkg/bootstrap-vcpkg.sh
|
|
./vcpkg/vcpkg install stb
|
|
TOOLCHAIN_ARG="-D CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake"
|
|
fi
|
|
if [[ "${{ matrix.compiler }}" == "gcc" ]]; then
|
|
CC=gcc
|
|
CXX=g++
|
|
elif [[ "${{ matrix.compiler }}" == "clang" ]]; then
|
|
CC=clang
|
|
CXX=clang++
|
|
fi
|
|
cmake \
|
|
-D CMAKE_C_COMPILER=$CC \
|
|
-D CMAKE_CXX_COMPILER=$CXX \
|
|
$TOOLCHAIN_ARG \
|
|
-S . -B build
|
|
cmake \
|
|
--build ./build \
|
|
--verbose \
|
|
--parallel `numproc`
|
|
buildwin:
|
|
needs: format
|
|
name: Build Windows ${{ matrix.deps }}
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
deps: [fetch, vcpkg]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
- name: Build
|
|
shell: pwsh
|
|
run: |
|
|
if ('${{ matrix.deps }}' -eq 'vcpkg') {
|
|
Get-ChildItem Env:\
|
|
& ${env:VCPKG_INSTALLATION_ROOT}\vcpkg.exe --triplet=x64-windows install sfml tclap glm glew stb
|
|
$TOOLCHAIN_ARG="-D CMAKE_TOOLCHAIN_FILE=${env:VCPKG_INSTALLATION_ROOT}\scripts\buildsystems\vcpkg.cmake"
|
|
} else {
|
|
$TOOLCHAIN_ARG=''
|
|
}
|
|
cmake `
|
|
$TOOLCHAIN_ARG `
|
|
-S . -B build
|
|
cmake `
|
|
--build ./build `
|
|
-- `
|
|
/verbosity:minimal `
|
|
/maxCpuCount `
|
|
/noLogo
|
|
|
|
python:
|
|
name: Exercise Python examples on ${{matrix.os}}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Environment setup
|
|
run: |
|
|
MINIFORGE_INSTALL_DIR=.miniforge3
|
|
MINIFORGE_INSTALL_SH="Miniforge3-$(uname)-$(uname -m).sh"
|
|
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/$MINIFORGE_INSTALL_SH"
|
|
|
|
bash "$MINIFORGE_INSTALL_SH" -b -p "$MINIFORGE_INSTALL_DIR"
|
|
PATH="$MINIFORGE_INSTALL_DIR/bin/:$PATH" conda update conda --yes --quiet
|
|
PATH="$MINIFORGE_INSTALL_DIR/bin/:$PATH" conda update --all --yes --quiet
|
|
PATH="$MINIFORGE_INSTALL_DIR/bin:$PATH" conda env create --file python/.test-conda-env.yml --name testing --quiet
|
|
|
|
- name: Linter
|
|
run: |
|
|
|
|
source ".miniforge3/bin/activate" testing
|
|
(cd python && flake8)
|
|
|
|
- name: Run examples
|
|
run: |
|
|
|
|
source ".miniforge3/bin/activate" testing
|
|
for i in python/*.py; do
|
|
echo "-----------------------------------------------------------------------"
|
|
echo "RUNNING $i"
|
|
echo "-----------------------------------------------------------------------"
|
|
time python $i
|
|
done
|
|
|
|
checkruby:
|
|
name: Check Ruby Samples ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
- name: Install Ruby and POCL
|
|
run: sudo apt update; sudo apt install pocl-opencl-icd
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
- name: Install OpenCL Ruby Bindings and RuboCop
|
|
run: gem install --user-install opencl_ruby_ffi rubocop
|
|
- name: Check Ruby Syntax
|
|
run: |
|
|
export PATH=`ruby -r rubygems -e 'puts Gem.user_dir'`/bin:$PATH
|
|
rubocop
|
|
working-directory: ruby
|
|
- name: Run Ruby Samples
|
|
run: rake test
|
|
working-directory: ruby
|