Skip to content

Rename target

Rename target #242

Workflow file for this run

name: Build precompiled NIFs
on:
push:
branches:
- master
tags:
- '*'
jobs:
build_release:
name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
nif: ["2.16", "2.15"]
job:
# - { target: arm-unknown-linux-gnueabihf, os: self-hosted, use-cross: false, docker-image: 'Dockerfile.arm-unknown-linux-gnueabihf' }
# - { target: aarch64-unknown-linux-gnu, os: self-hosted, use-cross: false, docker-image: 'Dockerfile.aarch64-unknown-linux-gnu' }
# - { target: aarch64-unknown-linux-musl, os: self-hosted, use-cross: false, docker-image: 'Dockerfile.aarch64-unknown-linux-musl' }
- { target: x86_64-apple-darwin, os: macos-13, use-cross: false }
- { target: aarch64-apple-darwin, os: self-hosted, use-cross: false } # since ARM apple uses different homebrew path, the linking from a plain macos-13 will not work, fallback to a real machine
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, use-cross: false }
- { target: x86_64-unknown-linux-musl, os: ubuntu-22.04, use-cross: false }
env:
RUSTLER_NIF_VERSION: ${{ matrix.nif }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Extract project version
shell: bash
id: extract-version
run: |
# Get the project version from mix.exs
echo $(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)
echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_OUTPUT
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.job.target }}
- name: Install MacOS deps
shell: bash
if: contains( matrix.job.target, 'apple-darwin')
run: |
brew install vips || echo 1
brew install pkg-config || echo 1
- name: Install Linux deps
shell: bash
if: contains( matrix.job.target, 'linux')
run: |
sudo apt-get install libvips-dev || echo 1
pkg-config --cflags --libs vips glib-2.0
- name: Build the project
id: build-crate
uses: dpostolachi/rustler-precompiled-action@main
with:
project-name: lvips
cross-version: "v0.2.5"
project-version: ${{ steps.extract-version.outputs.PROJECT_VERSION }}
target: ${{ matrix.job.target }}
nif-version: ${{ matrix.nif }}
use-cross: matrix.job.use-cross
project-dir: "native/lvips"
docker-image: ${{ matrix.job.docker-image }}
- name: Artifact upload
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build-crate.outputs.file-name }}
path: ${{ steps.build-crate.outputs.file-path }}
- name: Publish archives and packages
uses: softprops/action-gh-release@v1
with:
files: |
${{ steps.build-crate.outputs.file-path }}
if: startsWith(github.ref, 'refs/tags/')