build macos all #41
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: build macos all | |
on: | |
# pull_request: | |
# branches: | |
# - main | |
workflow_dispatch: | |
workflow_call: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runner: ["macOS-12", "macOS-13", "macOS-14"] | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Check Runner | |
run: | | |
# arch | |
# echo "runner: ${{ matrix.runner }}.$(arch).$(uname -m)" | |
# mayor version: sw_vers -productVersion | cut -d '.' -f 1 | |
# Darwin : uname -s | |
echo "suffix="$(uname -s).${{ matrix.runner }}.$(arch)"" >> $GITHUB_ENV | |
brew config | |
- name: Install Dependencies | |
run: | | |
brew install gcc@12 libomp eigen boost libtiff # llvm ? | |
- name: Set Version | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
version=${{ github.sha }} | |
else | |
version=${{ github.ref_name }} | |
fi | |
echo "version: ${version}" | |
sed -i '' "s/c2fw_version.*/c2fw_version = \"${version}\";/" Cell2Fire/Cell2Fire.h | |
- name: Build | |
run: | | |
cd Cell2Fire | |
make clean | |
make -f makefile.macos | |
otool -L Cell2Fire > otool_${{ env.suffix }}.txt | |
mv Cell2Fire Cell2Fire_${{ env.suffix }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries_${{ env.suffix }} | |
path: | | |
Cell2Fire/otool_${{ env.suffix }}.txt | |
Cell2Fire/Cell2Fire_${{ env.suffix }} | |
- name: Install Static Dependencies | |
run: | | |
brew install gcc@12 libomp eigen boost libtiff jpeg-turbo xz zstd zlib | |
- name: Build Static | |
run: | | |
cd Cell2Fire | |
make clean | |
make -f makefile.macos-static | |
otool -L Cell2Fire > otool_${{ env.suffix }}-static.txt | |
mv Cell2Fire Cell2Fire_${{ env.suffix }}-static | |
- name: Upload Static | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries_${{ env.suffix }}-static | |
path: | | |
Cell2Fire/otool_${{ env.suffix }}-static.txt | |
Cell2Fire/Cell2Fire_${{ env.suffix }}-static |