-
Notifications
You must be signed in to change notification settings - Fork 5
230 lines (200 loc) · 7.06 KB
/
buildcommit.yml
File metadata and controls
230 lines (200 loc) · 7.06 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: build test and commit
on:
push:
branches: [ master, dev ]
tags:
- 'v*.*.*'
pull_request:
branches: [ master ]
jobs:
build-linux-gnu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name: [AMD64, i386, arm, aarch64, riscv64]
include:
- name: i386
platformflags: -m32
- name: arm
platformtools: arm-linux-gnueabi
emulator: qemu-arm
- name: aarch64
platformtools: aarch64-linux-gnu
emulator: qemu-aarch64
- name: riscv64
platformtools: riscv64-linux-gnu
emulator: qemu-riscv64
# name: build-linux-gnu (${{matrix.name}})
env:
PLATFORMFLAGS: ${{matrix.platformflags}}
PLATFORM_PREFIX: ${{matrix.platformtools}}
EMULATOR: ${{matrix.emulator}}
steps:
- uses: actions/checkout@v4
- name: install multilib
run: sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib
if: ${{ matrix.name == 'i386' }}
- name: install qemu
if: matrix.emulator
run: sudo apt-get install --no-install-recommends -y qemu-user
- name: install abi lib
if: matrix.platformtools
run: sudo apt-get install --no-install-recommends -y gcc-${{matrix.platformtools}} g++-${{matrix.platformtools}}
- name: make
run: make all
- name: test
run: make test
- name: set abi name
run: echo abiname=$(make abiname) >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.abiname }}
path: lib/${{ env.abiname }}/libstackman.a
build-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, macos-latest]
include:
- os: macos-15-intel
abi: darwin_x86_64
- os: macos-latest
abi: darwin_arm64
steps:
- uses: actions/checkout@v4
- name: Build library
run: make all
- name: Run tests
run: make test
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.abi }}
path: lib/${{ matrix.abi }}/libstackman.a
build-windows:
runs-on: windows-latest
strategy:
matrix:
platform: [x86, x64, arm64]
include:
- platform: x86
folder: Win32
native: yes
- platform: x64
folder: x64
native: yes
- platform: arm64
folder: arm64
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: build
run: msbuild.exe vs2022\stackman.sln /p:Platform=${{matrix.platform}}
- name: strip timestamps from lib
run: python tools/strip-lib.py lib/win_${{matrix.platform}}/stackman.lib
- name: rebuild after stripping
run: msbuild.exe vs2022\stackman.sln /p:Platform=${{matrix.platform}}
- name: test
if: ${{ matrix.native == 'yes' }}
run: vs2022\${{matrix.folder}}\Debug\test.exe
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: win_${{ matrix.platform }}
path: lib/win_${{matrix.platform}}/stackman.lib
commit-artifacts:
runs-on: ubuntu-latest
needs: [build-linux-gnu, build-macos, build-windows]
if: false # Disabled - libraries no longer committed to repository
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: lib
- name: Commit changes
run: |
git config --global user.name 'Automation tool'
git config --global user.email 'automation-tool@users.noreply.github.com'
git add lib/*.a lib/*.lib
git status
git diff-index --quiet HEAD || git commit -m "Automated build"
git push
create-release:
runs-on: ubuntu-latest
needs: [build-linux-gnu, build-macos, build-windows]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release archive
run: |
mkdir -p release/lib
# Copy libraries maintaining the lib/{abi}/ structure
cp -r artifacts/sysv_amd64 release/lib/
cp -r artifacts/sysv_i386 release/lib/
cp -r artifacts/arm32 release/lib/
cp -r artifacts/aarch64 release/lib/
cp -r artifacts/riscv64 release/lib/
cp -r artifacts/darwin_x86_64 release/lib/
cp -r artifacts/darwin_arm64 release/lib/
cp -r artifacts/win_x86 release/lib/
cp -r artifacts/win_x64 release/lib/
cp -r artifacts/win_arm64 release/lib/
# Copy headers, tools, and documentation
cp -r stackman release/
cp -r tools release/
cp Makefile README.md LICENSE CHANGELOG.md release/
# Create version-specific archive
VERSION=${GITHUB_REF#refs/tags/v}
cd release
tar -czf ../stackman-${VERSION}.tar.gz .
cd ..
- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: stackman-${{ steps.get_version.outputs.VERSION }}.tar.gz
body: |
See [CHANGELOG.md](https://github.com/stackless-dev/stackman/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
## Download
Download `stackman-${{ steps.get_version.outputs.VERSION }}.tar.gz` containing pre-built libraries for all platforms.
## Contents
```
stackman/ - Header files
lib/
sysv_amd64/ - Linux x86_64
sysv_i386/ - Linux x86 (32-bit)
arm32/ - Linux ARM (32-bit, AAPCS)
aarch64/ - Linux ARM64 (AAPCS64)
riscv64/ - Linux RISC-V 64-bit (LP64D)
darwin_x86_64/ - macOS x86_64 (Intel)
darwin_arm64/ - macOS ARM64 (Apple Silicon)
win_x86/ - Windows x86 (32-bit)
win_x64/ - Windows x64
win_arm64/ - Windows ARM64
README.md
LICENSE
CHANGELOG.md
```
## Usage
```bash
# Extract
tar -xzf stackman-${{ steps.get_version.outputs.VERSION }}.tar.gz
# Build detects platform automatically
make abiname # Shows detected ABI (e.g., sysv_amd64)
# Link with your project
gcc -Istackman mycode.c -Llib/sysv_amd64 -lstackman
# Or let Makefile auto-detect
ABI=$(shell make -C stackman-${{ steps.get_version.outputs.VERSION }} abiname)
gcc -Istackman mycode.c -Llib/$(ABI) -lstackman
```