-
-
Notifications
You must be signed in to change notification settings - Fork 32
131 lines (113 loc) · 4.72 KB
/
build.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
name: Build CF
# This workflow will work for pushes, pull requests, or a manual trigger (workflow_dispatch).
on: [push, pull_request, workflow_dispatch]
env:
CMAKE_BUILD_PARALLEL_LEVEL: 6
jobs:
build:
# Matrix feature for cross-platform coverage. Names the build "Build X"
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
name: "Build ${{ matrix.platform.name }}"
runs-on: ${{ matrix.platform.os }}
timeout-minutes: 20
defaults:
run:
shell: bash
strategy:
# Don't cancel other in-progress jobs if one fails.
fail-fast: false
matrix:
platform:
# Diabled MinGW as it was having trouble with DX12 headers being out of date.
# - { name: "Windows (MinGW-w64)", os: windows-latest, artifact: 'mingw-w64', generate: '-G "MinGW Makefiles"' }
- { name: "Windows (MSCV 17 2022)", os: windows-latest, artifact: 'mscv17', generate: '-G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release' }
- { name: "MacOS", os: macos-latest, artifact: 'macos', generate: '-G "Unix Makefiles"' }
- { name: "Linux", os: ubuntu-latest, artifact: 'linux', generate: '-G "Unix Makefiles"' }
# TODO - Add iOS and Android platforms. Waiting on better support from GitHub.
steps:
- uses: actions/checkout@master
# Linux needs to install various dependencies.
# This could potentially be removed by using SOKOL_EXTERNAL_GL_LOADER.
- name: Install OpenGL + Audio
run: |
sudo apt-get update -qq
sudo apt-get install gcc-multilib
sudo apt-get install libasound2-dev libpulse-dev
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
if: matrix.platform.name == 'Linux'
- name: Create build folder with CMake
run: |
cmake ${{ matrix.platform.generate }} -B build_folder
- name: Build project binary (non-MSVC)
run: |
cmake --build build_folder
if: matrix.platform.name != 'Windows (MSCV 17 2022)'
# Default for MSVC is to build with Debug, so a special case is needed to produce
# Release binaries.
- name: Build project binary (MSVC)
run: |
cmake --build build_folder --config Release
if: matrix.platform.name == 'Windows (MSCV 17 2022)'
# Run tests for MSVC 17
- name: Run Tests for MSVC 17
shell: cmd
run: |
cd build_folder\Release
tests.exe
cd ..\..
if: matrix.platform.name == 'Windows (MSCV 17 2022)'
# Run tests for MinGW (no Release folder)
- name: Run Tests for MinGW
shell: cmd
run: |
cd build_folder
tests.exe
docsparser.exe
cd ..
if: matrix.platform.name == 'Windows (MinGW)'
- name: Run Tests for Apple
run: |
cd build_folder
./tests
./docsparser
cd ..
if: runner.os == 'macOS'
- name: Run Tests for Linux
run: |
cd build_folder
./tests
./docsparser
cd ..
if: runner.os == 'Linux'
# Just call robocopy twice, one looking for libcute.a for MinGW, and one
# looking for cute.lib for MSCV. robocopy doesn't trigger a build failure for
# not finding a file.
- name: Generate artifacts for Windows
shell: cmd
run: |
robocopy include dist *.h
robocopy build_folder\Release dist cute.lib
robocopy build_folder dist libcute.a
7z a ${{ matrix.platform.artifact }}.zip .\dist\*
if: runner.os == 'Windows'
- name: Generate artifacts for MacOS
run: |
mkdir -p ./dist
cp -v ./include/*.h ./dist
cp -R -v ./build_folder/libcute.a ./dist
tar -czvf ${{ matrix.platform.artifact }}.tar.gz -C dist .
if: runner.os == 'macOS'
- name: Generate artifacts for Linux
run: |
mkdir -p ./dist
cp -v ./include/*.h ./dist
cp -v ./build_folder/libcute.a ./dist
tar -czvf ${{ matrix.platform.artifact }}.tar.gz -C dist .
if: runner.os == 'Linux'
# Uploads the zip archives onto the workflow. They can be downloaded for 90 days (by default).
# Find them here: https://github.com/RandyGaul/cute_framework/actions
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: ./dist/