Skip to content

save

save #89

Workflow file for this run

name: SQUINT CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test-linux:
name: Build and Test (Linux)
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc, clang]
version: [12, 17]
blas: [MKL, OpenBLAS, NONE]
include:
- compiler: gcc
version: 12
dockerfile: Dockerfile.gcc-dev
- compiler: clang
version: 17
dockerfile: Dockerfile.llvm-dev
exclude:
- compiler: gcc
version: 17
- compiler: clang
version: 12
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.compiler }}-${{ matrix.version }}-${{ hashFiles(format('{0}/{1}', github.workspace, matrix.dockerfile)) }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.compiler }}-${{ matrix.version }}-
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ github.workspace }}/${{ matrix.dockerfile }}
build-args: |
COMPILER_VERSION=${{ matrix.version }}
tags: ${{ matrix.compiler }}-${{ matrix.version }}:latest
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build and Test in Docker
run: |
docker run --rm -v ${{ github.workspace }}:/src ${{ matrix.compiler }}-${{ matrix.version }}:latest bash -c "
cd /src &&
mkdir build &&
cd build &&
source /opt/intel/oneapi/setvars.sh &&
cmake .. -G Ninja \
-DSQUINT_BUILD_TESTS=ON \
-DBLAS_BACKEND=${{ matrix.blas }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}-${{ matrix.version }} &&
cmake --build . &&
ctest -L SQUINT --output-on-failure
"
build-and-test-windows:
name: Build and Test (Windows)
runs-on: windows-2022
strategy:
matrix:
compiler: [msvc]
version: [2022]
blas: [MKL, OpenBLAS, NONE]
include:
- compiler: msvc
version: 2022
dockerfile: Dockerfile.msvc-dev
steps:
- uses: actions/checkout@v4
- name: Cache Docker image
uses: actions/cache@v4
with:
path: ${{ github.workspace }}\docker-image.tar
key: ${{ runner.os }}-docker-${{ matrix.compiler }}-${{ matrix.version }}-${{ hashFiles(format('{0}\{1}', github.workspace, matrix.dockerfile)) }}
- name: Load cached Docker image
if: steps.cache-docker-image.outputs.cache-hit == 'true'
run: |
docker load -i ${{ github.workspace }}\docker-image.tar
shell: pwsh
- name: Build Docker image
if: steps.cache-docker-image.outputs.cache-hit != 'true'
run: |
docker build -t ${{ matrix.compiler }}-${{ matrix.version }}:latest `
--build-arg COMPILER_VERSION=${{ matrix.version }} `
-f ${{ github.workspace }}\${{ matrix.dockerfile }} .
docker save -o ${{ github.workspace }}\docker-image.tar ${{ matrix.compiler }}-${{ matrix.version }}:latest
shell: pwsh
- name: Build and Test in Docker
run: |
docker run --rm -v ${PWD}:C:\src ${{ matrix.compiler }}-${{ matrix.version }}:latest powershell -Command "
cd C:\src;
mkdir build;
cd build;
cmake .. -G Ninja `
-DSQUINT_BUILD_TESTS=ON `
-DBLAS_BACKEND=${{ matrix.blas }};
cmake --build .;
ctest -L SQUINT --output-on-failure
"
shell: pwsh
clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-llvm-dev-${{ hashFiles('**/Dockerfile.llvm-dev') }}
restore-keys: |
${{ runner.os }}-buildx-llvm-dev-
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ github.workspace }}/Dockerfile.llvm-dev
build-args: |
COMPILER_VERSION=17
tags: llvm-dev:latest
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Run Clang-Tidy in Docker
run: |
docker run --rm -v ${{ github.workspace }}:/src llvm-dev:latest bash -c "
cd /src &&
mkdir build &&
cd build &&
cmake -G Ninja -DSQUINT_BUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBLAS_BACKEND=NONE .. &&
cd .. &&
find ./include -name '*.cpp' -or -name '*.hpp' |
xargs -P $(nproc) clang-tidy -p build
"
- name: Check Clang-Tidy result
run: |
if [ $? -ne 0 ]; then
echo "Clang-Tidy found issues. Please fix them before merging."
exit 1
fi