Skip to content

Fixes CI for macos arm64 runner (migrate to the github M1 runner). (#72) #27

Fixes CI for macos arm64 runner (migrate to the github M1 runner). (#72)

Fixes CI for macos arm64 runner (migrate to the github M1 runner). (#72) #27

name: libclang-macosx-arm64
on: [push, pull_request]
env:
LLVM_VER: 18.1.1
MACOSX_DEPLOYMENT_TARGET: "10.15"
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build-and-deploy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install wheel dependencies
run: |
pip3 install wheel
- name: install gnu-tar
run: |
brew install gnu-tar
- name: install gcc@11
run: |
brew install gcc@11
- name: get llvm-project
run: |
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VER/llvm-project-$LLVM_VER.src.tar.xz
tar xf llvm-project-$LLVM_VER.src.tar.xz
mv llvm-project-$LLVM_VER.src llvm-project-$LLVM_VER
- name: make build directory
run: mkdir -p llvm-project-$LLVM_VER/build
- name: cmake
run: |
cd llvm-project-$LLVM_VER/build
cmake ../llvm \
-DLLVM_ENABLE_PROJECTS=clang \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD=AArch64 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -static-libgcc -static-libstdc++" \
-DCMAKE_C_COMPILER=$(brew --prefix gcc@11)/bin/gcc-11 \
-DCMAKE_CXX_COMPILER=$(brew --prefix gcc@11)/bin/g++-11 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
- name: build
run: cd llvm-project-$LLVM_VER/build && make libclang -j$(sysctl -n hw.ncpu)
- name: print dependencies
run: |
du -csh llvm-project-$LLVM_VER/build/lib/libclang.dylib
file llvm-project-$LLVM_VER/build/lib/libclang.dylib
otool -L llvm-project-$LLVM_VER/build/lib/libclang.dylib
dyldinfo -platform -dependents libclang.dylib || true
- name: create and print sha512sum
run: |
cd llvm-project-$LLVM_VER/build/lib
shasum -a512 libclang.dylib > libclang.dylib.$LLVM_VER.macosx-arm64.sha512sum
echo "Checksum is: "
cat libclang.dylib.$LLVM_VER.macosx-arm64.sha512sum
gtar zcvf libclang.dylib.$LLVM_VER.macosx-arm64.tar.gz libclang.dylib libclang.dylib.$LLVM_VER.macosx-arm64.sha512sum
shasum -a512 libclang.dylib.$LLVM_VER.macosx-arm64.tar.gz
- uses: actions/upload-artifact@v4
with:
name: libclang.dylib.${{env.LLVM_VER}}.macosx-arm64.tar.gz
path: llvm-project-${{env.LLVM_VER}}/build/lib/libclang.dylib.${{env.LLVM_VER}}.macosx-arm64.tar.gz
- name: generate wheel package
run: |
cp llvm-project-$LLVM_VER/build/lib/libclang.dylib native/
python3 setup_ext.py bdist_wheel --universal --plat-name=macosx_11_0_arm64
- uses: actions/upload-artifact@v4
with:
name: wheel-${{env.LLVM_VER}}-macosx_11_0_arm64
path: dist/*.whl
upload-to-pypi:
runs-on: ubuntu-latest
needs: [build-and-deploy]
steps:
- uses: actions/download-artifact@v4
with:
name: wheel-${{env.LLVM_VER}}-macosx_11_0_arm64
path: dist/
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: dist/
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
print_hash: true