Fix CMake commands in GitHub Actions workflow #185
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [9] | |
option_proxyfmu: ['proxyfmu=True', 'proxyfmu=False'] | |
steps: | |
- id: build_type_string | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ matrix.build_type }} | |
- 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 . -s build_type=${{ matrix.build_type }} -o "libcosim/*:${{ matrix.option_proxyfmu }}" --build=missing | |
cmake --preset=conan-${{ steps.build_type_string.outputs.lowercase }} | |
cmake --build --preset=conan-${{ steps.build_type_string.outputs.lowercase }} | |
cmake --build --preset=conan-${{ steps.build_type_string.outputs.lowercase }} --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 build | |
docker run --rm -v $(pwd):/mnt/source osp-builder | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cosim-${{ runner.os }}-${{ steps.build_type_string.outputs.lowercase }}-${{ matrix.compiler_version }}-${{ matrix.option_proxyfmu }} | |
path: build/${{ matrix.build_type }}/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: | |
- id: build_type_string | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ matrix.build_type }} | |
- 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 . -s build_type=${{ matrix.build_type }} -o "libcosim/*:${{ matrix.option_proxyfmu }}" --build=missing | |
cmake --preset=conan-default | |
cmake --build --preset=conan-${{ steps.build_type_string.outputs.lowercase }} | |
cmake --build --preset=conan-${{ steps.build_type_string.outputs.lowercase }} --target install | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cosim-${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.option_proxyfmu }} | |
path: build/${{ matrix.build_type }}/dist |