-
Notifications
You must be signed in to change notification settings - Fork 5
175 lines (156 loc) · 5.69 KB
/
buildcommit.yml
File metadata and controls
175 lines (156 loc) · 5.69 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
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]
include:
- name: i386
platformflags: -m32
- name: arm
platformtools: arm-linux-gnueabi
emulator: qemu-arm
- name: aarch64
platformtools: aarch64-linux-gnu
emulator: qemu-aarch64
# 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-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-windows]
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }}
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-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 all libraries to release/lib maintaining directory structure
cp -r artifacts/sysv_amd64/* release/lib/ 2>/dev/null || true
cp -r artifacts/sysv_i386/* release/lib/ 2>/dev/null || true
cp -r artifacts/arm32/* release/lib/ 2>/dev/null || true
cp -r artifacts/aarch64/* release/lib/ 2>/dev/null || true
cp -r artifacts/win_x86/* release/lib/ 2>/dev/null || true
cp -r artifacts/win_x64/* release/lib/ 2>/dev/null || true
cp -r artifacts/win_arm64/* release/lib/ 2>/dev/null || true
# Copy headers and documentation
cp -r stackman release/
cp README.md LICENSE CHANGELOG.md release/
# Create version-specific archive
VERSION=${GITHUB_REF#refs/tags/v}
cd release
tar -czf ../stackman-${VERSION}-all-platforms.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 }}-all-platforms.tar.gz
artifacts/sysv_amd64/libstackman.a
artifacts/sysv_i386/libstackman.a
artifacts/arm32/libstackman.a
artifacts/aarch64/libstackman.a
artifacts/win_x86/stackman.lib
artifacts/win_x64/stackman.lib
artifacts/win_arm64/stackman.lib
body: |
See [CHANGELOG.md](https://github.com/stackless-dev/stackman/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
## Pre-built Libraries
Download individual platform libraries or the combined archive containing all platforms.
**Platforms:**
- Linux: sysv_amd64, sysv_i386, arm32 (AAPCS), aarch64 (AAPCS64)
- Windows: win_x86, win_x64, win_arm64
**Usage:**
1. Download the library for your platform
2. Include `stackman/stackman.h` in your code
3. Link with the downloaded library