-
Notifications
You must be signed in to change notification settings - Fork 106
195 lines (188 loc) · 5.57 KB
/
build.yaml
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: "Build"
on:
push:
branches:
- '**'
pull_request:
release:
types:
- published
workflow_dispatch:
jobs:
source:
name: Source
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Gen Source
run: |
REV_ID=$(git tag --points-at HEAD)
if [ -z "${REV_ID}" ]; then
REV_ID=$(git rev-parse --short HEAD)
fi
mkdir -p natmap-${{ github.ref_name }}
git ls-files --recurse-submodules | tar c -O -T- | tar x -C natmap-${{ github.ref_name }}
echo ${REV_ID} > natmap-${{ github.ref_name }}/.version
tar cJf natmap-${{ github.ref_name }}.tar.xz natmap-${{ github.ref_name }}
- name: Upload source
uses: actions/upload-artifact@v4
with:
name: natmap-${{ github.ref_name }}.tar.xz
path: natmap-${{ github.ref_name }}.tar.xz
if-no-files-found: error
retention-days: 1
linux:
name: Linux
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- name: arm64
tool: aarch64-unknown-linux-musl
- name: arm32
tool: arm-unknown-linux-musleabi
- name: arm32hf
tool: arm-unknown-linux-musleabihf
- name: arm32v7
tool: armv7-unknown-linux-musleabi
- name: arm32v7hf
tool: armv7-unknown-linux-musleabihf
- name: i586
tool: i586-unknown-linux-musl
- name: i686
tool: i686-unknown-linux-musl
- name: loong64
tool: loongarch64-unknown-linux-musl
- name: m68k
tool: m68k-unknown-linux-musl
- name: microblazeel
tool: microblazeel-xilinx-linux-musl
- name: microblaze
tool: microblaze-xilinx-linux-musl
- name: mips64el
tool: mips64el-unknown-linux-musl
- name: mips64
tool: mips64-unknown-linux-musl
- name: mips32el
tool: mipsel-unknown-linux-musl
- name: mips32elsf
tool: mipsel-unknown-linux-muslsf
- name: mips32
tool: mips-unknown-linux-musl
- name: mips32sf
tool: mips-unknown-linux-muslsf
- name: powerpc64
tool: powerpc64-unknown-linux-musl
- name: powerpc
tool: powerpc-unknown-linux-musl
- name: riscv32
tool: riscv32-unknown-linux-musl
- name: riscv64
tool: riscv64-unknown-linux-musl
- name: s390x
tool: s390x-ibm-linux-musl
- name: sh
tool: sh-multilib-linux-musl
- name: sheb
tool: sh-multilib-linux-musl
env:
CFLAGS: "-mb"
- name: x86_64
tool: x86_64-unknown-linux-musl
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Build ${{ matrix.name }}
run: |
sudo mkdir -p /opt/x-tools
wget https://github.com/musl-cross/musl-cross/releases/download/20241103/${{ matrix.tool }}.tar.xz
sudo tar xf ${{ matrix.tool }}.tar.xz -C /opt/x-tools
make CROSS_PREFIX=/opt/x-tools/${{ matrix.tool }}/bin/${{ matrix.tool }}- CFLAGS=${{ matrix.env.CFLAGS }} ENABLE_STATIC=1 -j`nproc`
- name: Upload ${{ matrix.name }}
uses: actions/upload-artifact@v4
with:
name: natmap-linux-${{ matrix.name }}
path: bin/natmap
if-no-files-found: error
retention-days: 1
release:
name: Release
runs-on: ubuntu-22.04
needs:
- source
- linux
if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: "natmap-*"
merge-multiple: true
- name: Upload artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for i in release/natmap-*; do
gh release upload ${{ github.event.release.tag_name }} $i
done
macos:
name: macOS
runs-on: macos-14
if: github.event_name != 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Build
run: |
make
android:
name: Android
runs-on: ubuntu-22.04
if: github.event_name != 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Prepare
run: |
wget https://dl.google.com/android/repository/android-ndk-r27b-linux.zip
unzip android-ndk-r27b-linux.zip
ln -sf . jni
- name: Build
run: |
./android-ndk-r27b/ndk-build
llvm:
name: LLVM
runs-on: ubuntu-22.04
if: github.event_name != 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Prepare
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository -y 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main'
sudo apt install -y clang
- name: Build
run: |
make CC=clang ENABLE_STATIC=1 -j`nproc`