Skip to content

github-ci.yml update #92

github-ci.yml update

github-ci.yml update #92

Workflow file for this run

name: Github CI
on:
push:
branches-ignore:
- main
- release
env:
conan_config: "https://gitlab.sintef.no/co-simulation/conan-configs.git"
jobs:
windows:
name: Windows build
runs-on: windows-2022
strategy:
matrix:
TYPE: [Release, Debug]
PROFILE: ["msvc_192"]
steps:
- uses: actions/checkout@v4
- id: cache-conan-packages
uses: actions/cache@v4
with:
path: |
~/.conan2
key: ${{ runner.os }}-${{ matrix.TYPE }}-dds-fmu
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 2.3.0
- name: Setting variables
run: |
if ("${{ matrix.TYPE }}" -like "Debug") { echo "SKIP_TEST=True" >> "$GITHUB_ENV" }
- name: Conan build
run: |
conan config install "${{ env.conan_config }}" --type git -sf profiles -tf profiles
conan config install "${{ env.conan_config }}" --type git -sf remotes_public
conan build -o "dds-fmu/*:with_doc=False" -b missing --update `
-pr:b ${{ matrix.PROFILE }} -pr:h ${{ matrix.PROFILE }} -s build_type=${{ matrix.TYPE }} `
-c tools.build:jobs=2 -c tools.build:skip_test=$SKIP_TEST .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ github.job }}-${{ matrix.TYPE }}"
path: |
build/fmus/*
public/*
testoutput/*.xml
retention-days: 1
linux:
name: Linux build
runs-on: ubuntu-22.04
strategy:
matrix:
TYPE: [Debug, Release]
PROFILE: ["gcc12"]
env:
TARGET: "${{ github.job }}-${{ matrix.TYPE }}"
steps:
- uses: actions/checkout@v4
- id: cache-conan-packages
uses: actions/cache@v4
with:
path: |
~/.conan2
key: ${{ env.TARGET }}-dds-fmu
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 2.3.0
- name: Installing pre-requisites
run: |
sudo apt update && sudo apt install -y openssh-client texlive-binaries perl
if ([[ ${{ matrix.TYPE }} == "Debug" ]]); \
then echo "SKIP_TEST=True" >> "$GITHUB_ENV"; \
else export "SKIP_TEST=False" >> "$GITHUB_ENV"; fi
- name: Conan build
run: |
conan config install $conan_config --type git -sf profiles -tf profiles
conan config install $conan_config --type git -sf remotes_public
conan build -o "dds-fmu/*:with_doc=True" -b missing --update \
-pr:b ${{ matrix.PROFILE }} -pr:h ${{ matrix.PROFILE }} -s build_type=${{ matrix.TYPE }} \
-c tools.build:jobs=2 -c tools.build:skip_test=$SKIP_TEST .
if ([[ ${{ matrix.TYPE }} == "Release" ]]); then cp -r build/Release/docs/html public/; fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ env.TARGET }}"
path: |
build/${{ matrix.TYPE }}/fmus/*
testoutput/*.xml
retention-days: 1
- name: Upload pages artifact
if: env.TARGET == 'linux-Release' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: github-pages
path: public
fmu:
needs: [linux, windows]
runs-on: ubuntu-22.04
strategy:
matrix:
TYPE: [ Release, Debug ]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: fmus/
pattern: "*-${{ matrix.TYPE }}"
- name: Build an FMU
run: |
FMU_VERSION=$(cat version.txt)
FMU_NAME=${{ github.event.repository.name }}
shopt -s globstar
mkdir tmp_${{ matrix.TYPE }} && cd tmp_${{ matrix.TYPE }}
the_fmus=(../fmus/**/*${{ matrix.TYPE }}.fmu)
fmu_count=${#the_fmus[@]}
for (( i=0; i<$fmu_count; i++ )); do
an_fmu="${the_fmus[$i]}"
cmake -E tar xf $an_fmu
done
mkdir ../combined_fmus
cmake -E tar cf ../combined_fmus/$FMU_NAME-${{ matrix.TYPE }}.fmu --format=zip .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ github.event.repository.name }}-${{ matrix.TYPE }}"
path: |
combined_fmus/${{ github.event.repository.name }}-${{ matrix.TYPE }}.fmu
release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: [fmu]
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "${{ github.event.repository.name }}-Release"
- run: |
mv "${{ github.event.repository.name }}-Release/${{ github.event.repository.name }}-Release.fmu" \
"${{ github.event.repository.name }}.fmu"
- name: Release
uses: softprops/action-gh-release@v2
with:
files: "${{ github.event.repository.name }}.fmu"
docs:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: [fmu]
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: github-pages
path: public/
- name: Publish documentation
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true