Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/scripts/setup+build-linux-container-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -ex

# [Setup] Install dependencies inside the container.
if command -v apt-get >/dev/null 2>&1; then
apt-get update -y
apt-get install -y \
build-essential \
cmake \
ninja-build \
libblas-dev \
liblapacke-dev \
libopenblas-dev

elif command -v dnf >/dev/null 2>&1; then
dnf update -y
dnf install -y \
blas-devel \
lapack-devel \
openblas-devel \
make \
cmake \
clang \
ninja-build

else
echo "No supported package manager found (apt-get, dnf)"
exit 1
fi

# [CMake] CI Build Sanity Check: Verifies code compilation, not for release.
export CMAKE_ARGS="-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
export DEBUG=1
export CMAKE_C_COMPILER=/usr/bin/clang
export CMAKE_CXX_COMPILER=/usr/bin/clang++

rm -rf build
mkdir -p build
pushd build
cmake -DMLX_BUILD_METAL=OFF .. -G Ninja
ninja
./example1
./tutorial
popd
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,33 @@ jobs:
cmake .. -G Ninja
ninja

linux_build_cmake_container:
name: Linux Container CMake Swift Build (${{ matrix.container }} ${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
# See https://github.com/swiftlang/swift-docker/tree/main/
- host: ubuntu-22.04
arch: x86_64
container: swift:bookworm
- host: ubuntu-22.04
arch: x86_64
container: swift:fedora39
- host: ubuntu-22.04-arm
arch: aarch64
container: swift:bookworm
- host: ubuntu-22.04-arm
arch: aarch64
container: swift:fedora39

runs-on: ${{ matrix.host }}
container:
image: ${{ matrix.container }}
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Linux Container CMake Swift Build - No Release
run: |
bash .github/scripts/setup+build-linux-container-cmake.sh