build: NIF binary targeting CUDA #73
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: NIF binaries | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "native/**" | |
- ".github/workflows/binaries.yml" | |
tags: | |
- "*" | |
pull_request: | |
paths: | |
- ".github/workflows/binaries.yml" | |
workflow_dispatch: | |
env: | |
PROJECT_NAME: "candlex" | |
PROJECT_DIR: "native/candlex" | |
PROJECT_VERSION: "0.1.2" | |
NIF_VERSION: "2.16" | |
jobs: | |
build_cpu: | |
name: cpu / ${{ matrix.target }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: aarch64-apple-darwin | |
os: macos-12 | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
use-cross: true | |
- target: x86_64-apple-darwin | |
os: macos-12 | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup target add ${{ matrix.target }} | |
- uses: mimiquate/rustler-precompiled-action@fix-build-sh-with-container | |
id: precompile | |
with: | |
project-dir: ${{ env.PROJECT_DIR }} | |
project-name: ${{ env.PROJECT_NAME }} | |
project-version: ${{ env.PROJECT_VERSION }} | |
target: ${{ matrix.target }} | |
use-cross: ${{ matrix.use-cross }} | |
nif-version: ${{ env.NIF_VERSION }} | |
- uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: ${{ steps.precompile.outputs.file-path }} | |
if: startsWith(github.ref, 'refs/tags/') | |
build_cuda: | |
name: cuda / ${{ matrix.target }} / ${{ matrix.os }} | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
container: | |
image: nvidia/cuda:12.2.2-devel-ubuntu22.04 | |
env: | |
CUDA_COMPUTE_CAP: "70" | |
steps: | |
- run: apt update && apt install -y curl git | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: rustup target add ${{ matrix.target }} | |
- uses: philss/rustler-precompiled-action@main | |
id: precompile | |
env: | |
CUDA_COMPUTE_CAP: "70" | |
with: | |
project-dir: ${{ env.PROJECT_DIR }} | |
project-name: ${{ env.PROJECT_NAME }} | |
project-version: ${{ env.PROJECT_VERSION }} | |
target: ${{ matrix.target }} | |
use-cross: null | |
nif-version: ${{ env.NIF_VERSION }} | |
variant: cuda | |
cargo-args: "--features cuda" | |
- uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: ${{ steps.precompile.outputs.file-path }} | |
if: startsWith(github.ref, 'refs/tags/') |