Skip to content

sili v0.2.0-dev-1

sili v0.2.0-dev-1 #116

Workflow file for this run

name: MacOS
on:
workflow_dispatch:
push:
paths:
- '**'
- 'examples/**'
- '.github/workflows/macos.yml'
branches: [ "main", "dev" ]
pull_request:
paths:
- '**'
- 'examples/**'
- '.github/workflows/macos.yml'
branches: [ "main", "dev" ]
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: macos-latest
env:
RELEASE_NAME: sili-dev_macos
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "RELEASE_NAME=sili-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../..
- name: Tests
run: |
make compile_tests CC=clang
- name: Examples
run: |
make compile_examples CC=clang
- name: Build Library
run: |
clang --version
# Extract version numbers from Makefile
brew install grep
# Build sili x86_64 & arm64 static
make static CC=clang OUTPUT="/tmp" EXTRA_FLAGS="-target x86_64-apple-macos10.12" NAME="sili_x86_64"
make static CC=clang OUTPUT="/tmp" EXTRA_FLAGS="-target arm64-apple-macos11" NAME="sili_arm64"
# Join x86_64 and arm64 static
lipo -create -output build/${{ env.RELEASE_NAME }}/lib/libsili.a /tmp/libsili_x86_64.a /tmp/libsili_arm64.a
# Build sili x86_64 & arm64 dynamic
make dynamic CC=clang OUTPUT="/tmp" EXTRA_FLAGS="-fPIC -target x86_64-apple-macos10.12" NAME="sili_x86_64"
make dynamic CC=clang OUTPUT="/tmp" EXTRA_FLAGS="-fPIC -target arm64-apple-macos11" NAME="sili_arm64"
# Join sili and arm64 dynamic
rm -f ./build/lib/*
lipo -create -output libsili.so /tmp/libsili_x86_64.so /tmp/libsili_arm64.so
ln -sv libsili.so build/${{ env.RELEASE_NAME }}/lib/libsili.so
- name: Generate Artifacts
run: |
mkdir -p build
mkdir -p build/include
mkdir -p build/lib
cp -v ./sili.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
with:
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'release' && github.event.action == 'published'