Updating actions #705
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 with Conan | |
# 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'] | |
option_shared: ['shared=True', 'shared=False'] | |
timeout-minutes: 35 | |
env: | |
DOCKER_CONAN_HOME: /tmp/conan2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create a conan lock file | |
run: conan lock create -u . | |
- name: Cache conan packages | |
id: cache-conan | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-conan-packages | |
with: | |
path: ~/.conan2 | |
key: ${{ runner.os }}-${{ matrix.build_type }}-${{ env.cache-name }}-${{ hashFiles('**/conan.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.build_type }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ matrix.build_type }}- | |
${{ runner.os }}- | |
- name: Generate Dockerfile | |
run: | | |
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 LIBCOSIM_RUN_TESTS_ON_CONAN_BUILD=1 | |
ENV CONAN_HOME=${{ env.DOCKER_CONAN_HOME }} | |
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 profile detect -f | |
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 \ | |
--settings="build_type=${{ matrix.build_type }}" \ | |
--options="libcosim/*:${{ matrix.option_proxyfmu }}" \ | |
--options="libcosim/*:${{ matrix.option_shared }}" \ | |
--build=missing \ | |
--user=osp \ | |
--channel="${CHANNEL}" \ | |
--lockfile-out ${{ env.DOCKER_CONAN_HOME }}/conan.lock \ | |
. | |
conan upload --confirm --remote=osp 'libcosim/*' | |
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 cosim | |
run: | | |
docker run --rm --env GITHUB_REF="$GITHUB_REF" -v $(pwd):/mnt/source:ro -v ~/.conan2:${{ env.DOCKER_CONAN_HOME }} -u root osp-builder | |
- name: Save cache | |
id: cache-conan-save | |
uses: actions/cache/save@v3 | |
with: | |
path: ~/.conan2 | |
key: ${{ runner.os }}-${{ matrix.build_type }}-${{ env.cache-name }}-${{ hashFiles('**/conan.lock') }} | |
windows: | |
name: Windows | |
runs-on: ${{ matrix.os }} | |
env: | |
CONAN_LOGIN_USERNAME_OSP: ${{ secrets.osp_artifactory_usr }} | |
CONAN_PASSWORD_OSP: ${{ secrets.osp_artifactory_pwd }} | |
LIBCOSIM_RUN_TESTS_ON_CONAN_BUILD: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019] | |
build_type: [Debug, Release] | |
option_proxyfmu: ['proxyfmu=True', 'proxyfmu=False'] | |
option_shared: ['shared=True', 'shared=False'] | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create a conan lock file | |
run: conan lock create -u . | |
- name: Cache conan packages | |
id: cache-conan | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-conan-packages | |
with: | |
path: ~/.conan2 | |
key: ${{ runner.os }}-${{ matrix.build_type }}-${{ env.cache-name }}-${{ hashFiles('**/conan.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.build_type }}-${{ env.cache-name }}- | |
${{ runner.os }}-${{ matrix.build_type }}- | |
${{ runner.os }}- | |
- name: Install prerequisites | |
run: | | |
pip3 install --upgrade setuptools pip | |
pip3 install conan | |
- name: Configure Conan | |
run: | | |
conan profile detect -f | |
conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local --force | |
- name: Conan create | |
shell: bash | |
run: | | |
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 \ | |
--settings="build_type=${{ matrix.build_type }}" \ | |
--options="libcosim/*:${{ matrix.option_proxyfmu }}" \ | |
--options="libcosim/*:${{ matrix.option_shared }}" \ | |
--build=missing \ | |
--user=osp \ | |
--channel="${CHANNEL}" \ | |
--lockfile-out ~/.conan2/conan.lock \ | |
. | |
- name: Conan upload | |
run: conan upload --confirm --remote=osp 'libcosim/*' |