Skip to content

CI

CI #919

Workflow file for this run

name: CI
on:
schedule:
- cron: "20 3 * * 2"
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
push:
branches:
- 'main'
tags:
- v*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["ubuntu-latest", "ubuntu-22.04", "windows-2022", "windows-latest"]
exclude:
- os: windows-2022
config: Debug
- os: windows-latest
config: Debug
runs-on: ${{ matrix.os }}
steps:
# On the Github-hosted runner, git checks out text files with \r\n (I think)
# which messes up some unit tests, specifically UtilsTest.loadFileToString,
# which expects TestData/minimal.xml not to have any carriage returns \r.
# So we have to overwrite this checkout policy here:
- name: Set git to use LF instead of CRLF
if: startsWith(matrix.os, 'windows')
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Install Matlab libs
if: startsWith(matrix.os, 'windows')
run: |
md c:\tixi-3rdparty -Force | Out-Null
If (!(Test-Path -Path "c:\tixi-3rdparty\matlab-libs-win")) {
Write-Output "Downloading matlab libraries"
Invoke-WebRequest -UserAgent "Wget" -Uri "https://sourceforge.net/projects/tixi/files/dev-tools/matlab-libs-win.zip" -OutFile "c:\matlab-libs-win.zip"
Write-Output "Extract matlab libraries"
& 7z x -y "c:\matlab-libs-win.zip" -oC:\tixi-3rdparty\ > null
}
- name: Set up Visual Studio shell
if: startsWith(matrix.os, 'windows')
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Configure TiXI (MacOS, Linux)
if: startsWith(matrix.os, 'windows') == false
run: |
pixi r configure ${{ matrix.config }}
- name: Configure TiXI (Windows)
if: startsWith(matrix.os, 'windows')
run: |
pixi r configure ${{ matrix.config }} -DMATLAB_DIR=c:\tixi-3rdparty\matlab-libs-win
- name: Build TiXI
run: |
pixi r doc
pixi r install
- name: Upload build directory
uses: actions/upload-artifact@v6
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
retention-days: 1
- name: Build conan package
if: ${{ github.event_name == 'schedule' && matrix.os == 'ubuntu-latest' && matrix.config == 'Release' }}
run: pixi r conan
test:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["ubuntu-latest", "ubuntu-22.04", "windows-2022", "windows-latest"]
exclude:
- os: windows-2022
config: Debug
- os: windows-latest
config: Debug
runs-on: ${{ matrix.os }}
needs: build
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Download build directory
uses: actions/download-artifact@v7
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
- name: chmod unittests
if: startsWith(matrix.os, 'windows') == false
run:
chmod a+x build/tests/TIXI-unittests
- name: Run unit tests
run: |
pixi r test
deploy:
runs-on: "windows-2022"
needs: test
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Download build directory
uses: actions/download-artifact@v7
with:
name: build-windows-2022-Release
path: build
- name: Artifact installer and zip
run: |
pixi r cpack
- name: Upload installer as artifact
uses: actions/upload-artifact@v6
with:
name: win64-installer
path: build/*.exe
- name: Upload package as artifact
uses: actions/upload-artifact@v6
with:
name: win64-package
path: build/*.zip
- name: Upload documentation as artifact
uses: actions/upload-artifact@v6
with:
name: html-documentation
path: build/doc/html/*