-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (122 loc) · 5.08 KB
/
release.yml
File metadata and controls
139 lines (122 loc) · 5.08 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
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch: # Allow manual trigger for testing
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: latest
cache: false
locked: false
- name: Build FFI library
run: pixi run build-ffi-optimized
- name: Package Linux release
run: |
mkdir -p release/linux-x86_64
cp libmojo_audio.so release/linux-x86_64/
cp include/mojo_audio.h release/linux-x86_64/
echo "# mojo-audio FFI - Linux x86_64" > release/linux-x86_64/INSTALL.md
echo "" >> release/linux-x86_64/INSTALL.md
echo "## Installation" >> release/linux-x86_64/INSTALL.md
echo "\`\`\`bash" >> release/linux-x86_64/INSTALL.md
echo "sudo cp libmojo_audio.so /usr/local/lib/" >> release/linux-x86_64/INSTALL.md
echo "sudo cp mojo_audio.h /usr/local/include/" >> release/linux-x86_64/INSTALL.md
echo "sudo ldconfig" >> release/linux-x86_64/INSTALL.md
echo "\`\`\`" >> release/linux-x86_64/INSTALL.md
tar czf mojo-audio-${{ github.ref_name }}-linux-x86_64.tar.gz -C release/linux-x86_64 .
- name: Package FFI examples
run: |
mkdir -p release/ffi-examples
cp examples/ffi/demo_c.c release/ffi-examples/
cp examples/ffi/demo_rust.rs release/ffi-examples/
cp examples/ffi/Makefile release/ffi-examples/
tar czf mojo-audio-ffi-examples.tar.gz -C release/ffi-examples .
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-build
path: mojo-audio-${{ github.ref_name }}-linux-x86_64.tar.gz
- name: Upload FFI examples artifact
uses: actions/upload-artifact@v4
with:
name: ffi-examples
path: mojo-audio-ffi-examples.tar.gz
build-macos:
strategy:
matrix:
include:
- runner: macos-latest # Apple Silicon (M1)
arch: arm64
platform: osx-arm64
- runner: macos-12 # Intel
arch: x86_64
platform: osx-64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Configure pixi for macOS
run: |
# Update pixi.toml to use macOS platform and OpenBLAS (MKL not available on macOS)
sed -i.bak 's/platforms = \["linux-64"\]/platforms = ["${{ matrix.platform }}"]/' pixi.toml
sed -i.bak 's/default = { features = \["mkl"\]/default = { features = ["openblas"]/' pixi.toml
# Remove MKL environment (not supported on macOS)
sed -i.bak '/^mkl = { features/d' pixi.toml
# Remove MKL feature dependencies
sed -i.bak '/^\[feature\.mkl\.dependencies\]/,/^\[feature\.openblas\.dependencies\]/{/^\[feature\.mkl\.dependencies\]/d; /libblas/d;}' pixi.toml
- name: Install pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: latest
cache: false
locked: false
- name: Build FFI library
run: pixi run build-ffi-optimized
- name: Package macOS release
run: |
mkdir -p release/macos-${{ matrix.arch }}
cp libmojo_audio.dylib release/macos-${{ matrix.arch }}/
cp include/mojo_audio.h release/macos-${{ matrix.arch }}/
echo "# mojo-audio FFI - macOS ${{ matrix.arch }}" > release/macos-${{ matrix.arch }}/INSTALL.md
echo "" >> release/macos-${{ matrix.arch }}/INSTALL.md
echo "## Installation" >> release/macos-${{ matrix.arch }}/INSTALL.md
echo "\`\`\`bash" >> release/macos-${{ matrix.arch }}/INSTALL.md
echo "sudo cp libmojo_audio.dylib /usr/local/lib/" >> release/macos-${{ matrix.arch }}/INSTALL.md
echo "sudo cp mojo_audio.h /usr/local/include/" >> release/macos-${{ matrix.arch }}/INSTALL.md
echo "\`\`\`" >> release/macos-${{ matrix.arch }}/INSTALL.md
tar czf mojo-audio-${{ github.ref_name }}-macos-${{ matrix.arch }}.tar.gz -C release/macos-${{ matrix.arch }} .
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.arch }}-build
path: mojo-audio-${{ github.ref_name }}-macos-${{ matrix.arch }}.tar.gz
create-release:
needs: [build-linux, build-macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/linux-x86_64-build/*
artifacts/macos-arm64-build/*
artifacts/macos-x86_64-build/*
artifacts/ffi-examples/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}