Skip to content

Allow build artifacts to be extracted from container #177

Allow build artifacts to be extracted from container

Allow build artifacts to be extracted from container #177

Workflow file for this run

name: CI
# This workflow is triggered on pushes to the repository.
on: [push, workflow_dispatch]
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_type: [Debug, Release]
compiler_version: [11]
option_proxyfmu: ['proxyfmu=True', 'proxyfmu=False']
steps:
- uses: actions/checkout@v4
- name: Generate Dockerfile
run: |
mkdir /tmp/osp-builder-docker
cat <<'EOF' >/tmp/osp-builder-docker/Dockerfile
FROM conanio/gcc${{ matrix.compiler_version }}-ubuntu16.04
COPY entrypoint.sh /
ENTRYPOINT /entrypoint.sh
EOF
- name: Generate entrypoint.sh
run: |
cat <<'EOF' >/tmp/osp-builder-docker/entrypoint.sh
#!/bin/bash -v
set -eu
conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local --force
cd /mnt/source
conan install . --output-folder=build -s build_type=${{ matrix.build_type }} -o "libcosim/*:${{ matrix.option_proxyfmu }}" --build=missing
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build build
cmake --build build --target install
EOF
chmod 0777 /tmp/osp-builder-docker/entrypoint.sh
- name: Build Docker image
run: docker build -t osp-builder /tmp/osp-builder-docker/
- name: Build cosim
run: |
mkdir -m 0777 -p build/dist
docker run --rm --env GITHUB_REF="$GITHUB_REF" -v $(pwd):/mnt/source osp-builder
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: cosim-${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.compiler_version }}-${{ matrix.option_proxyfmu }}
path: build/dist
windows:
name: Windows
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
build_type: [Debug, Release]
option_proxyfmu: ['proxyfmu=True', 'proxyfmu=False']
steps:
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
pip3 install --upgrade setuptools pip
pip3 install conan
- name: Configure Conan
run: |
conan profile detect
conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local --force
- name: Build
run: |
conan install . --output-folder=build -s build_type=${{ matrix.build_type }} -o "libcosim/*:${{ matrix.option_proxyfmu }}" --build=missing
cmake -A x64 -B build -S . "-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake"
cmake --build build --config ${{ matrix.build_type }}
cmake --build build --config ${{ matrix.build_type }} --target install
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: cosim-${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.option_proxyfmu }}
path: build/dist