Skip to content

Commit a843962

Browse files
committed
feat: add linux build
1 parent ee6800d commit a843962

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/precompiled_nif.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,69 @@ jobs:
7878
with:
7979
files: |
8080
./*.tar.gz
81+
precompile_nif_linux_x86_64:
82+
runs-on: ubuntu-22.04
83+
env:
84+
MIX_ENV: prod
85+
NX_IREE_PREFER_PRECOMPILED: false
86+
NX_IREE_SOURCE_DIR: ./build-cache/iree
87+
IREE_GIT_REV: candidate-20240604.914
88+
strategy:
89+
fail-fast: false
90+
matrix:
91+
nif_version: [2.16, 2.17]
92+
steps:
93+
- name: checkout
94+
uses: actions/checkout@v4
95+
96+
- name: Install asdf and tools
97+
uses: asdf-vm/actions/install@v3
98+
99+
- name: cuda-toolkit
100+
uses: Jimver/cuda-toolkit@v0.2.16
101+
102+
- name: Setup Ninja
103+
uses: ashutoshvarma/setup-ninja@master
104+
with:
105+
version: 1.10.0
106+
107+
- name: Setup dependencies and env
108+
run: |
109+
mix local.hex --force
110+
mix local.rebar --force
111+
echo "NX_IREE_SOURCE_DIR=$(elixir -e 'IO.puts(Path.absname(~s(${{env.NX_IREE_SOURCE_DIR}})))')" > $GITHUB_ENV
112+
echo "PKG_NAME=libnx_iree-linux-x86_64-nif-${{matrix.nif_version}}" >> $GITHUB_ENV
113+
114+
- name: Cache mix dependencies
115+
id: cache-mix-deps
116+
uses: actions/cache@v4
117+
with:
118+
key: deps-${{ hashFiles('mix.lock') }}
119+
path: |
120+
./deps
121+
- name: Get mix deps
122+
if: steps.cache-mix-deps.outputs.cache-hit != 'true'
123+
run: mix deps.get
124+
- name: Cache IREE dir
125+
id: cache-iree-dir
126+
uses: actions/cache@v4
127+
with:
128+
key: iree-dir-${{ env.IREE_GIT_REV }}
129+
path: |
130+
${{ env.NX_IREE_SOURCE_DIR }}
131+
- name: Clone IREE
132+
if: steps.cache-iree-dir.outputs.cache-hit != 'true'
133+
run: make clone_iree
134+
- name: Compile NIF
135+
run: |
136+
mix compile
137+
mkdir ${{ env.PKG_NAME }}
138+
cp ./cache/libnx_iree.so ./${{ env.PKG_NAME }}/libnx_iree.so
139+
cp -r ./cache/iree-runtime ./${{ env.PKG_NAME }}/iree-runtime
140+
tar -czf ${{ env.PKG_NAME }}.tar.gz ${{ env.PKG_NAME }}
141+
- name: Release Artifacts
142+
uses: softprops/action-gh-release@v2
143+
if: startsWith(github.ref, 'refs/tags/')
144+
with:
145+
files: |
146+
./*.tar.gz

0 commit comments

Comments
 (0)