-
Notifications
You must be signed in to change notification settings - Fork 121
163 lines (155 loc) · 5.61 KB
/
presubmit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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 libxcursor-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]
os: [ubuntu-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]
os: [ubuntu-latest, macos-13]
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