Skip to content

Commit

Permalink
Use an official Conan Docker image to build on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kyllingstad committed Nov 8, 2023
1 parent 95929da commit a2051b0
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions .github/workflows/ci-conan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,53 @@ env:
jobs:
conan-on-linux:
name: Conan
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
env:
CC: gcc-${{ matrix.compiler_version }}
CXX: g++-${{ matrix.compiler_version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build_type: [Debug, Release]
compiler_version: [9]
compiler_libcxx: [libstdc++11]
option_shared: ['True', 'False']
option_shared: ['shared=True', 'shared=False']
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
- uses: actions/checkout@v3
- name: Generate Dockerfile
run: |
sudo apt-get install -y --no-install-recommends g++-11
sudo pip3 install --upgrade setuptools pip
sudo pip3 install conan
- run: conan profile detect
- run: conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local --force
- run: conan create -s build_type=${{ matrix.build_type }} -s compiler.version=${{ matrix.compiler_version }} -s compiler.libcxx=${{ matrix.compiler_libcxx }} -o fmilibrary/*:shared=${{ matrix.option_shared }} .
- run: conan upload -c -r osp 'fmilibrary*'
mkdir /tmp/osp-builder-docker
cat <<'EOF' >/tmp/osp-builder-docker/Dockerfile
FROM conanio/gcc${{ matrix.compiler_version }}-ubuntu16.04
ENV CONAN_LOGIN_USERNAME_OSP=${{ secrets.osp_artifactory_usr }}
ENV CONAN_PASSWORD_OSP=${{ secrets.osp_artifactory_pwd }}
ENV CONAN_REVISIONS_ENABLED=1
ENV CONAN_NON_INTERACTIVE=1
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
cd /mnt/source
conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local --force
REFNAME="${GITHUB_REF#refs/*/}"
VERSION="v$(<version.txt)"
if [[ $GITHUB_REF == refs/tags/* ]] && [[ $REFNAME == $VERSION ]]; then CHANNEL="stable"
elif [[ $REFNAME == master ]]; then CHANNEL="testing"
else
SHORT_REFNAME="${REFNAME:0:40}"
CHANNEL="testing-${SHORT_REFNAME//\//_}"
fi
conan create -s build_type=${{ matrix.build_type }} -s compiler.libcxx=libstdc++11 -o "libcosim/*:${{ matrix.option_shared }}" -b missing . --user=osp --channel=${CHANNEL}
conan upload --confirm --remote=osp 'fmilibrary*'
EOF
chmod 0755 /tmp/osp-builder-docker/entrypoint.sh
- name: Build Docker image
run: docker build -t osp-builder /tmp/osp-builder-docker/
- name: Build FMI Library
run: docker run --rm --env GITHUB_REF="$GITHUB_REF" -v $(pwd):/mnt/source:ro osp-builder

conan-on-windows:
name: Conan
Expand All @@ -47,7 +71,7 @@ jobs:
matrix:
os: [windows-2019, windows-2022]
build_type: [Debug, Release]
option_shared: ['True', 'False']
option_shared: ['shared=True', 'shared=False']
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
Expand All @@ -56,5 +80,5 @@ jobs:
pip3 install conan
- run: conan profile detect
- run: conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local --force
- run: conan create -s build_type=${{ matrix.build_type }} -o fmilibrary/*:shared=${{ matrix.option_shared }} .
- run: conan create -s build_type=${{ matrix.build_type }} -o fmilibrary/*:${{ matrix.option_shared }} .
- run: conan upload -c -r osp 'fmilibrary*'

0 comments on commit a2051b0

Please sign in to comment.