-
Notifications
You must be signed in to change notification settings - Fork 111
142 lines (124 loc) · 3.8 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
132
133
134
135
136
137
138
139
140
141
142
name: Build Codegen
on:
pull_request:
push:
branches:
- '**'
jobs:
filter:
runs-on: ubuntu-latest
name: Filter
outputs:
should-run: ${{ steps.changed.outputs.any_changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files in the codegen folder
id: changed
uses: tj-actions/changed-files@v42
with:
files: |
.github/workflows/build.yml
codegen/**
build:
needs: filter
if: needs.filter.outputs.should-run == 'true'
strategy:
fail-fast: false
matrix:
config:
- name: Windows
os: windows-latest
id: win
extra_flags: ''
- name: macOS
os: macos-latest
id: mac
extra_flags: >
-DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'
-DCMAKE_AR='/usr/bin/ar'
-DCMAKE_RANLIB='/usr/bin/ranlib'
- name: Linux
os: ubuntu-22.04
id: linux
extra_flags: ''
name: Build ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup CPM Cache
uses: actions/cache@v4
with:
path: cpm-cache
key: cpm-${{ matrix.config.id }}-v1-${{ hashFiles('codegen/CMakeLists.txt') }}
restore-keys: |
cpm-${{ matrix.config.id }}-v1-
- name: Install Ninja
shell: bash
run: |
curl -L https://github.com/ninja-build/ninja/releases/latest/download/ninja-${{ matrix.config.id }}.zip -o ninja.zip
7z x ninja.zip -o"$GITHUB_WORKSPACE/ninja"
echo "$GITHUB_WORKSPACE/ninja" >> $GITHUB_PATH
- name: Update LLVM (Windows)
shell: bash
run: |
curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/LLVM-17.0.6-win64.exe -o llvm-inst.exe
7z x llvm-inst.exe -ollvm bin/clang.exe bin/clang++.exe bin/lld-link.exe bin/llvm-rc.exe bin/*.dll lib/clang/*/include/*
echo "$GITHUB_WORKSPACE/llvm/bin" >> $GITHUB_PATH
if: matrix.config.id == 'win'
- name: Configure
run: >
cmake codegen -B codegen/build
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-G Ninja
${{ matrix.config.extra_flags }}
- name: Build
run: cmake --build codegen/build --config Release --parallel
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: geode-codegen-${{ matrix.config.id }}
path: |
codegen/build/Codegen
codegen/build/Codegen.exe
if-no-files-found: ignore
publish:
name: Publish
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Move Binaries
run: |
mv geode-codegen-win/Codegen.exe geode-codegen-win.exe
mv geode-codegen-mac/Codegen geode-codegen-mac-temp
mv geode-codegen-linux/Codegen geode-codegen-linux-temp
rmdir geode-codegen-mac
rmdir geode-codegen-linux
mv geode-codegen-mac-temp geode-codegen-mac
mv geode-codegen-linux-temp geode-codegen-linux
- name: Update Codegen Release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: codegen
name: 'Codegen Release'
body: Geode codegen release for commit ${{ github.sha }}.
files: |
./geode-codegen-win.exe
./geode-codegen-mac
./geode-codegen-linux