Skip to content

Commit

Permalink
Clean up GitHub Actions workflows a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kyllingstad committed Nov 24, 2023
1 parent 5271e2d commit 5a899bd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/ci-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
name: libcosim CI without Conan
name: CI without Conan

# This workflow is triggered on pushes to the repository.
on: [push]

jobs:
cmake-on-linux:
name: CMake
linux:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Note: The all-caps prefixes are part of CMake variable names, and
# therefore must be written exactly as they are. They're included here
# to make the build matrix easier to understand when viewed in the
# GitHub web interface.
build_type: [BUILD_TYPE=Debug, BUILD_TYPE=Release]
build_type: [Debug, Release]
shared_libs: [SHARED_LIBS=ON, SHARED_LIBS=OFF]
timeout-minutes: 35

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Generate Dockerfile
run: |
mkdir /tmp/osp-builder-docker
Expand Down Expand Up @@ -49,7 +45,7 @@ jobs:
#!/bin/bash
mkdir build
cd build
cmake -DCMAKE_${{ matrix.build_type }} -DBUILD_${{ matrix.shared_libs }} /mnt/source
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_${{ matrix.shared_libs }} /mnt/source
cmake --build .
ctest --output-on-failure
EOF
Expand Down
47 changes: 26 additions & 21 deletions .github/workflows/ci-conan.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
name: libcosim CI Conan
name: CI with Conan

# This workflow is triggered on pushes to the repository.
on: [push, workflow_dispatch]

jobs:
conan-on-linux:
name: Conan
linux:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_type: [Debug, Release]
compiler_version: [9]
compiler_libcxx: [libstdc++11]
option_proxyfmu: ['proxyfmu=True', 'proxyfmu=False']
option_shared: ['shared=True', 'shared=False']
timeout-minutes: 35

steps:
- uses: actions/checkout@v3
- 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
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
ENV CONAN_USE_ALWAYS_SHORT_PATHS=1
ENV LIBCOSIM_RUN_TESTS_ON_CONAN_BUILD=1
COPY entrypoint.sh /
ENTRYPOINT /entrypoint.sh
Expand All @@ -48,28 +44,30 @@ jobs:
SHORT_REFNAME="${REFNAME:0:40}"
CHANNEL="testing-${SHORT_REFNAME//\//_}"
fi
conan create -s build_type=${{ matrix.build_type }} -s compiler.version=${{ matrix.compiler_version }} -s compiler.libcxx=${{ matrix.compiler_libcxx }} -o "libcosim/*:${{ matrix.option_proxyfmu }}" -o "libcosim/*:${{ matrix.option_shared }}" -b missing . --user=osp --channel=${CHANNEL}
conan upload --confirm --remote=osp '*'
conan create \
--settings="build_type=${{ matrix.build_type }}" \
--options="libcosim/*:${{ matrix.option_proxyfmu }}" \
--options="libcosim/*:${{ matrix.option_shared }}" \
--build=missing \
--user=osp \
--channel="${CHANNEL}" \
.
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/
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 osp-builder
conan-on-windows:
name: Conan
windows:
name: Windows
runs-on: ${{ matrix.os }}
env:
CONAN_LOGIN_USERNAME_OSP: ${{ secrets.osp_artifactory_usr }}
CONAN_PASSWORD_OSP: ${{ secrets.osp_artifactory_pwd }}
CONAN_REVISIONS_ENABLED: 1
CONAN_NON_INTERACTIVE: 1
CONAN_USE_ALWAYS_SHORT_PATHS: 1
CONAN_USER_HOME_SHORT: C:\c
LIBCOSIM_RUN_TESTS_ON_CONAN_BUILD: 1
strategy:
fail-fast: false
Expand All @@ -81,7 +79,7 @@ jobs:
timeout-minutes: 35

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
pip3 install --upgrade setuptools pip
Expand All @@ -101,6 +99,13 @@ jobs:
SHORT_REFNAME="${REFNAME:0:40}"
CHANNEL="testing-${SHORT_REFNAME//\//_}"
fi
conan create -s build_type=${{ matrix.build_type }} -o "libcosim/*:${{ matrix.option_proxyfmu }}" -o "libcosim/*:${{ matrix.option_shared }}" -b missing . --user=osp --channel=${CHANNEL}
conan create \
--settings="build_type=${{ matrix.build_type }}" \
--options="libcosim/*:${{ matrix.option_proxyfmu }}" \
--options="libcosim/*:${{ matrix.option_shared }}" \
--build=missing \
--user=osp \
--channel="${CHANNEL}" \
.
- name: Conan upload
run: conan upload --confirm --remote=osp '*'
run: conan upload --confirm --remote=osp 'libcosim/*'

0 comments on commit 5a899bd

Please sign in to comment.