-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (163 loc) · 5.38 KB
/
build.yml
File metadata and controls
181 lines (163 loc) · 5.38 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Build Niobium
run-name: 'Build Niobium...'
on:
workflow_call:
inputs:
build_tools:
description: 'Whether the build the niobium tools'
required: false
default: true
type: boolean
build_examples:
description: 'Whether the build the niobium examples'
required: false
default: true
type: boolean
build_library:
description: 'Whether the build the niobium library'
required: false
default: true
type: boolean
build_type:
description: 'The type of build to do'
required: false
type: string
default: 'debug'
target_ref:
description: 'The ref to build'
required: false
type: string
default: '${{ github.ref_name }}'
outputs:
artifact:
description: 'The artifact that was produced.'
value: ${{ jobs.build.outputs.artifact }}
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux
arch: x86_64
- os: ubuntu-24.04-arm
name: linux
arch: arm64
- os: macos-latest
name: osx
arch: universal
- os: windows-latest
name: win32
arch: x86_64
- os: windows-latest
name: win32
arch: arm64
outputs:
artifact: '${{ steps.finalize.outputs.artifact }}'
runs-on: ${{ matrix.os }}
steps:
# Checkout
- uses: actions/checkout@v4
with:
ref: '${{ inputs.target_ref }}'
# Setup D Compiler
- uses: MrcSnm/setup-dlang@v2
with:
compiler: ldc-latest
redub: 1.25.4
# Install Vulkan SDK
- name: 'Install Vulkan SDK...'
if: ${{ runner.os != 'macOS' }}
uses: humbletim/setup-vulkan-sdk@v1.2.1
with:
vulkan-query-version: 1.4.304.1
vulkan-components: Vulkan-Loader SPIRV-Tools Glslang
vulkan-use-cache: true
- name: 'Adding Vulkan SDK Libs to PATH...'
if: ${{ runner.os != 'macOS' }}
shell: bash
run: |
(
echo LD_LIBRARY_PATH=${VULKAN_SDK}/lib:$LD_LIBRARY_PATH
echo LIBRARY_PATH=${VULKAN_SDK}/lib:$LIBRARY_PATH
) | tee -a $GITHUB_ENV
echo "${VULKAN_SDK}/lib" >> "$GITHUB_PATH"
# Clone linrarues
- name: 'Cloning low-level API Bindings...'
run: |
git clone https://github.com/Inochi2D/nurt ../nurt
git clone https://github.com/Inochi2D/nuvk ../nuvk
git clone https://github.com/Inochi2D/metal-d ../metal-d
# Build Library
- name: 'Build niobium (library, ${{ runner.os }}-${{ matrix.arch }})...'
if: ${{ inputs.build_library }}
shell: bash
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
redub build-universal --config=metal-dynamic --build=${{ inputs.build_type }}
else
redub build --config=vulkan-dynamic --build=${{ inputs.build_type }}
fi
# Build Tools
- name: 'Build niobium (tools, ${{ runner.os }}-${{ matrix.arch }})...'
if: ${{ inputs.build_tools }}
shell: bash
run: |
mkdir -p out/tools
for _file in tools/*; do
if [ -d "$_file" ]; then
if [[ "${{ runner.os }}" == "macOS" ]]; then
redub build-universal --root=$_file --build=${{ inputs.build_type }} || true
else
redub build --root=$_file --build=${{ inputs.build_type }} || true
fi
cp $_file/out/* out/tools/ || true
fi
done
# Build Examples
- name: 'Build niobium (examples, ${{ runner.os }}-${{ matrix.arch }})...'
if: ${{ inputs.build_examples }}
shell: bash
run: |
for _file in examples/*; do
if [ -d "$_file" ]; then
fbname=$(basename "$_file")
if [[ "${{ runner.os }}" == "macOS" ]]; then
redub build-universal --root=$_file --build=${{ inputs.build_type }} || true
else
redub build --root=$_file --build=${{ inputs.build_type }} || true
fi
mkdir -p out/examples/$fbname/
cp $_file/out/* out/examples/$fbname/
fi
done
- name: 'Cleaning up file structure...'
shell: bash
run: |
rm -f out/*.o out/*.obj || true
rm -f out/tools/*.o out/tools/*.obj || true
cp LICENSE out/
# Delete unneccesary debug files for Windows.
if [[ "${{ inputs.build_type }}" != "debug" ]]; then
rm -f out/tools/*.lib out/tools/*.pdb out/tools/*.exp || true
rm -f out/examples/*.lib out/examples/*.pdb out/examples/*.exp || true
fi
- name: 'Archive'
id: archive
run: |
cd out/
tar -cvzf ../niobium-${{ matrix.name }}-${{ matrix.arch }}-${{ inputs.build_type }}.tar.gz ./*
# Create artifacts.
- name: 'Make Artifact'
uses: actions/upload-artifact@v4
with:
name: 'niobium-${{ matrix.name }}-${{ matrix.arch }}-${{ inputs.build_type }}'
path: |
niobium-${{ matrix.name }}-${{ matrix.arch }}-${{ inputs.build_type }}.tar.gz
- name: 'Finalize'
id: finalize
run: |
echo "artifact=niobium-${{ matrix.name }}-${{ matrix.arch }}-${{ inputs.build_type }}" >> $GITHUB_OUTPUT