Update ci.yml #997
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: 18 | |
PYTHON_VER: 3.11 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-v2:22.04 | |
options: --user 1001 | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- run: git config --global --add safe.directory '*' | |
- name: Install prereqs | |
run: | | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | |
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - | |
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VER} main" | tee -a /etc/apt/sources.list > /dev/null | |
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VER} main" | tee -a /etc/apt/sources.list > /dev/null | |
apt-get update; apt-get install gh clang-${LLVM_VER} lld-${LLVM_VER} python${PYTHON_VER} python${PYTHON_VER}-dev -y | |
- name: Setup cmake | |
uses: trail-of-forks/actions-setup-cmake@master | |
with: | |
cmake-version: '3.26.x' | |
- name: Use cmake | |
run: cmake --version | |
- 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_EXE_LINKER_FLAGS="--ld-path=$(which ld.lld-${LLVM_VER})" \ | |
-DCMAKE_MODULE_LINKER_FLAGS="--ld-path=$(which ld.lld-${LLVM_VER})" \ | |
-DCMAKE_SHARED_LINKER_FLAGS="--ld-path=$(which ld.lld-${LLVM_VER})" \ | |
-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 \ | |
-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 }} |