Try to fix libidn issue with CMake. #1021
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 | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "*" | ||
# Cancel in progress runs for PRs but not main | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
env: | ||
LLVM_PASTA_VER: b9e223f | ||
LLVM_VER: 17 | ||
PYTHON_VER: 3.12 | ||
UBUNTU_CODENAME: jammy | ||
CMAKE_VER: 3.30 | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VER }}-dev | ||
- name: Use Python | ||
run: python --version | ||
- name: Install LLVM | ||
uses: trail-of-forks/install-llvm-action@master | ||
with: | ||
version: ${{ env.LLVM_VER }} | ||
- name: Use LLVM | ||
run: clang --version | ||
- name: Install ninja-build tool | ||
run: sudo apt-get install -y ninja-build | ||
- name: Install CMake | ||
uses: trail-of-forks/actions-setup-cmake@master | ||
with: | ||
cmake-version: ${{ env.CMAKE_VER }}.x | ||
- name: Use CMake | ||
run: sudo ln -s /usr/lib/x86_64-linux-gnu/libidn.so.12.x /usr/lib/x86_64-linux-gnu/libidn.so.11 | ||
run: cmake --version | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
- run: git config --global --add safe.directory '*' | ||
- name: Set up variables | ||
run: | | ||
echo "RELEASE_DIR=${RUNNER_TEMP}/release" >> $GITHUB_ENV | ||
echo "LLVM_PREFIX_DIR=${RUNNER_TEMP}/llvm" >> $GITHUB_ENV | ||
echo "VERSION=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | ||
echo "ARTIFACT_NAME=multiplier-$(git rev-parse --short=7 HEAD).tar.xz" >> $GITHUB_ENV | ||
- name: Install llvm-pasta | ||
run: | | ||
mkdir -p ${RELEASE_DIR} | ||
mkdir -p ${LLVM_PREFIX_DIR} | ||
gh release download ${LLVM_PASTA_VER} --repo trail-of-forks/llvm-project --pattern 'llvm-*' | ||
tar -xvJf llvm-pasta-*.tar.xz -C ${LLVM_PREFIX_DIR} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build | ||
run: | | ||
CXXFLAGS="-g0" \ | ||
CCFLAGS="-g0" \ | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=${RELEASE_DIR} \ | ||
-DCMAKE_LINKER_TYPE=LLD \ | ||
-DCMAKE_C_COMPILER="$(which clang)" \ | ||
-DCMAKE_CXX_COMPILER="$(which clang++)" \ | ||
-DClang_DIR=${LLVM_PREFIX_DIR}/lib/cmake/clang \ | ||
-DLLVM_DIR=${LLVM_PREFIX_DIR}/lib/cmake/llvm \ | ||
-DMLIR_DIR=${LLVM_PREFIX_DIR}/lib/cmake/mlir \ | ||
-DMX_USE_VENDORED_CLANG=OFF \ | ||
-DLLVM_ENABLE_LLD:BOOL=TRUE \ | ||
-GNinja \ | ||
./ | ||
ninja install | ||
# Release on merge to main | ||
- name: Package Release | ||
if: github.ref == 'refs/heads/main' | ||
working-directory: ${{ env.RELEASE_DIR }} | ||
run: tar --use-compress-program pixz -cf "${ARTIFACT_NAME}" * | ||
- name: Create Release | ||
if: github.ref == 'refs/heads/main' | ||
run: gh release create ${VERSION} --generate-notes ${{ env.RELEASE_DIR }}/${{ env.ARTIFACT_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |