From a15c6069050e32689868e81f01c032ac0baa80aa Mon Sep 17 00:00:00 2001 From: Tao He Date: Mon, 1 Jul 2024 00:36:26 +0800 Subject: [PATCH] Fixes CI for macos arm64 runner (migrate to the github M1 runner). Signed-off-by: Tao He --- .cirrus.yml | 61 ----------------- .github/workflows/libclang-linux-amd64.yml | 2 +- .github/workflows/libclang-macosx-amd64.yml | 5 +- .github/workflows/libclang-macosx-arm64.yml | 68 +++++++------------ .../workflows/libclang-windows-aarch64.yml | 2 +- .github/workflows/libclang-windows-amd64.yml | 2 +- 6 files changed, 31 insertions(+), 109 deletions(-) delete mode 100644 .cirrus.yml diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index e835333..0000000 --- a/.cirrus.yml +++ /dev/null @@ -1,61 +0,0 @@ -macos_instance: - image: ghcr.io/cirruslabs/macos-monterey-base:latest - -env: - MACOSX_DEPLOYMENT_TARGET: "10.15" - LLVM_VER: 18.1.1 - -task: - checkout_script: - - git submodule init - - git submodule update - - install_deps_script: - - brew update - - brew install gcc@11 gnu-tar - - pip3 install wheel - - download_llvm_script: | - 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 - - build_llvm_libclang_script: | - mkdir -p llvm-project-$LLVM_VER/build - 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=X86 \ - -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=10.9 - make libclang -j$(sysctl -n hw.ncpu) - - print_dependencies_script: | - 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 - - sha512sum_script: | - cd llvm-project-$LLVM_VER/build/lib - shasum -a512 libclang.dylib > libclang.dylib.$LLVM_VER.macosx-amd64.sha512sum - echo "Checksum is: " - cat libclang.dylib.$LLVM_VER.macosx-amd64.sha512sum - gtar zcvf libclang.dylib.$LLVM_VER.macosx-amd64.tar.gz libclang.dylib libclang.dylib.$LLVM_VER.macosx-amd64.sha512sum - shasum -a512 libclang.dylib.$LLVM_VER.macosx-amd64.tar.gz - - libclang_artifacts: - path: llvm-project-$LLVM_VER/build/lib/libclang.dylib.$LLVM_VER.macosx-amd64.tar.gz - - generate_wheel_package_script: | - cp llvm-project-$LLVM_VER/build/lib/libclang.dylib native/ - python3 setup_ext.py bdist_wheel --universal --plat-name=macosx_11_0_arm64 - - wheel_artifacts: - path: dist/*.whl diff --git a/.github/workflows/libclang-linux-amd64.yml b/.github/workflows/libclang-linux-amd64.yml index 4272609..c05998c 100644 --- a/.github/workflows/libclang-linux-amd64.yml +++ b/.github/workflows/libclang-linux-amd64.yml @@ -77,7 +77,7 @@ jobs: build-and-deploy-sdist: if: "!contains(github.event.head_commit.message, 'skip ci')" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-and-deploy] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/libclang-macosx-amd64.yml b/.github/workflows/libclang-macosx-amd64.yml index 3856e5f..1485c8a 100644 --- a/.github/workflows/libclang-macosx-amd64.yml +++ b/.github/workflows/libclang-macosx-amd64.yml @@ -4,6 +4,7 @@ on: [push, pull_request] env: LLVM_VER: 18.1.1 + MACOSX_DEPLOYMENT_TARGET: "10.9" concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} @@ -45,7 +46,7 @@ jobs: -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -static-libgcc -static-libstdc++" \ -DCMAKE_C_COMPILER=gcc-10 \ -DCMAKE_CXX_COMPILER=g++-10 \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 + -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 @@ -76,7 +77,7 @@ jobs: path: dist/*.whl upload-to-pypi: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-and-deploy] steps: - uses: actions/download-artifact@v4 diff --git a/.github/workflows/libclang-macosx-arm64.yml b/.github/workflows/libclang-macosx-arm64.yml index dafb25f..be791ff 100644 --- a/.github/workflows/libclang-macosx-arm64.yml +++ b/.github/workflows/libclang-macosx-arm64.yml @@ -4,7 +4,7 @@ on: [push, pull_request] env: LLVM_VER: 18.1.1 - BIN: /usr/local/opt/llvm/bin + MACOSX_DEPLOYMENT_TARGET: "10.15" concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} @@ -13,68 +13,50 @@ concurrency: jobs: build-and-deploy: if: "!contains(github.event.head_commit.message, 'skip ci')" - runs-on: macos-11 + runs-on: macos-14 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.10' - name: install wheel dependencies run: | pip3 install wheel - - name: install llvm + - name: install gnu-tar run: | - brew install llvm # assume install under /usr/local/opt/llvm + 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 - # see https://llvm.org/docs/HowToCrossCompileLLVM.html run: | - echo "BIN=$BIN" >> "$GITHUB_ENV" - echo "$BIN" >> "$GITHUB_PATH" - set echo - uname -a - cd llvm-project-$LLVM_VER - # note: LIBCXX_ENABLE_ASSERTIONS=FALSE is for the "undefined symbol: std::__1::__libcpp_verbose_abort(char const*, ...)" failure - cmake -S llvm \ - -G "Unix Makefiles" -B build \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_COMPILER=$BIN/clang++ \ - -DCMAKE_C_COMPILER=$BIN/clang \ - -DCMAKE_INSTALL_PREFIX=$HOME/.local \ - -DCMAKE_OSX_ARCHITECTURES=arm64 \ - -DCMAKE_SYSTEM_NAME=Darwin \ - -DDEFAULT_SYSROOT="$(xcrun --show-sdk-path)" \ - -DLLVM_DEFAULT_TARGET_TRIPLE=18.1.1-arm64-apple-darwin21.6 \ - -DLLVM_ENABLE_PIC=False \ + cd llvm-project-$LLVM_VER/build + cmake ../llvm \ -DLLVM_ENABLE_PROJECTS=clang \ - -DLLVM_ENABLE_TERMINFO=OFF \ - -DLLVM_ENABLE_WERROR=FALSE \ + -DBUILD_SHARED_LIBS=OFF \ -DLLVM_ENABLE_ZLIB=OFF \ -DLLVM_ENABLE_ZSTD=OFF \ - -DLLVM_NATIVE_TOOL_DIR=$BIN \ - -DLLVM_USE_LINKER=lld \ - -DLIBCXX_ENABLE_ASSERTIONS=FALSE \ - -DLLVM_TARGETS_TO_BUILD=AArch64 + -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: | - cd llvm-project-$LLVM_VER - cmake --build build --config Release --target libclang --parallel $(sysctl -n hw.ncpu) - - name: combine .a archives into dylib - run: | - cd llvm-project-$LLVM_VER/build/lib - set echo - # convert .a -> dylib - $BIN/clang -arch arm64 -fpic -shared -lstdc++ -Wl,-force_load libclang.a *.a -o libclang.dylib - strip -u libclang.dylib - lipo -info libclang.dylib - du -csh libclang.dylib - file libclang.dylib - otool -L libclang.dylib + 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: | diff --git a/.github/workflows/libclang-windows-aarch64.yml b/.github/workflows/libclang-windows-aarch64.yml index 1277a19..5f88239 100644 --- a/.github/workflows/libclang-windows-aarch64.yml +++ b/.github/workflows/libclang-windows-aarch64.yml @@ -89,7 +89,7 @@ jobs: path: dist/*.whl upload-to-pypi: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-and-deploy] steps: - uses: actions/download-artifact@v4 diff --git a/.github/workflows/libclang-windows-amd64.yml b/.github/workflows/libclang-windows-amd64.yml index dc7909b..bbb484f 100644 --- a/.github/workflows/libclang-windows-amd64.yml +++ b/.github/workflows/libclang-windows-amd64.yml @@ -65,7 +65,7 @@ jobs: path: dist/*.whl upload-to-pypi: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-and-deploy] steps: - uses: actions/download-artifact@v4