Skip to content

Try to fix CMake for ZStd. #1059

Try to fix CMake for ZStd.

Try to fix CMake for ZStd. #1059

Workflow file for this run

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: 18
PYTHON_VER: 3.12
UBUNTU_CODENAME: jammy
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Install CMake, Clang, and Ninja
run: |
sudo apt remove --purge --auto-remove cmake clang
sudo apt update
sudo apt install -y software-properties-common lsb-release pixz
sudo apt clean all
curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/llvm.gpg >/dev/null
sudo apt-add-repository "deb https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${LLVM_VER} main"
curl -sSL https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
sudo apt update
sudo apt install kitware-archive-keyring
sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
sudo apt install clang-18 lld-18 cmake ninja-build
- name: Use CMake
run: cmake --version
- name: Use Clang
run: clang-${LLVM_VER} --version
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}-dev
- name: Use Python
run: python --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-${LLVM_VER})" \
-DCMAKE_CXX_COMPILER="$(which clang++-${LLVM_VER})" \
-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 \
-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 }}