Skip to content

Commit 1b049d0

Browse files
committed
action for releasing the oxcaml binary
1 parent 000d4b0 commit 1b049d0

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build OxCaml LLVM Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
include:
13+
- os: ubuntu-latest
14+
arch: x86_64
15+
artifact_name: llvm-linux-x86_64
16+
- os: ubuntu-24.04-arm
17+
arch: aarch64
18+
artifact_name: llvm-linux-aarch64
19+
# - os: macos-latest
20+
# arch: arm64
21+
# artifact_name: llvm-macos-arm64
22+
permissions:
23+
contents: write
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Get branch name from release
28+
id: branch
29+
run: |
30+
BRANCH="${{ github.event.release.target_commitish }}"
31+
if [[ -z "$BRANCH" ]]; then
32+
echo "Cannot determine the name of the release branch"
33+
exit 1
34+
fi
35+
echo "name=${BRANCH}" >> $GITHUB_OUTPUT
36+
echo "Building from branch: ${BRANCH}"
37+
38+
- name: Install dependencies (Ubuntu)
39+
if: startsWith(matrix.os, 'ubuntu')
40+
run: |
41+
sudo apt-get update
42+
sudo apt-get install -y cmake ninja-build python3 build-essential clang
43+
44+
- name: Install dependencies (macOS)
45+
if: matrix.os == 'macos-latest'
46+
run: |
47+
brew install cmake ninja python3
48+
49+
- name: Build LLVM
50+
env:
51+
CC: clang
52+
CXX: clang++
53+
run: |
54+
mkdir build
55+
cd build
56+
cmake -G Ninja \
57+
-DCMAKE_BUILD_TYPE=Release \
58+
-DCMAKE_C_COMPILER=clang \
59+
-DCMAKE_CXX_COMPILER=clang++ \
60+
-DLLVM_ENABLE_PROJECTS="clang;lld;lldb;mlir" \
61+
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
62+
-DCMAKE_INSTALL_PREFIX=../install \
63+
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
64+
../llvm
65+
ninja install
66+
67+
- name: Package binaries
68+
run: |
69+
cd install
70+
tar -czf ../${{ matrix.artifact_name }}-${{ steps.branch.outputs.name }}.tar.gz .
71+
72+
- name: Upload to release using GitHub CLI
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
run: |
76+
gh release upload ${{ github.event.release.tag_name }} \
77+
${{ matrix.artifact_name }}-${{ steps.branch.outputs.name }}.tar.gz \
78+
--clobber

0 commit comments

Comments
 (0)