Test conan packages #877
This file contains hidden or 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: Test conan packages | |
| on: | |
| # Runs for PRs that directly change conan code, and weekdays at 11:15pm UTC. | |
| # Additional logic in the prepare job below makes it so scheduled builds only run | |
| # on new commits. | |
| schedule: | |
| - cron: '0 10 * * *' # 10 AM UTC daily (6 AM EDT / 5 AM EST) | |
| - cron: '0 10 * * 0' # 10 AM UTC every Sunday (weekly unconditional run) | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - conanfile.py | |
| - test_package/conanfile.py | |
| - etc/conan/conan.lock | |
| - .github/workflows/conan.yml | |
| jobs: | |
| prepare: | |
| if: github.repository_owner == 'viamrobotics' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Get current git info | |
| if: github.event_name == 'schedule' | |
| id: git_info | |
| run: | | |
| echo "current_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| echo "current_branch=$(git branch --show-current)" >> $GITHUB_OUTPUT | |
| - name: Get last successful commit | |
| if: github.event_name == 'schedule' | |
| id: last_successful_commit | |
| uses: tylermilner/last-successful-commit-hash-action@v1 | |
| with: | |
| branch: main | |
| workflow-id: conan.yml | |
| github-token: ${{ github.token }} | |
| - name: Cancel scheduled build with no new commits | |
| uses: andymckay/cancel-action@0.2 | |
| if: | | |
| github.event_name == 'schedule' && | |
| steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash && | |
| github.event.schedule != '0 10 * * 0' | |
| build_macos: | |
| if: github.repository_owner == 'viamrobotics' | |
| needs: [prepare] | |
| runs-on: macos-26 | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| cmake --version | |
| python --version | |
| ninja --version | |
| brew install buf | |
| python -m pip install conan | |
| - name: Create package | |
| run: | | |
| export BUF_CONFIG_DIR=$(mktemp -d) | |
| conan profile detect | |
| conan remote add viamconan "$CONAN_REMOTE_URL" | |
| conan create . --build=missing -pr:a etc/conan/macos.profile \ | |
| --lockfile etc/conan/conan.lock --lockfile-partial | |
| env: | |
| CONAN_REMOTE_URL: ${{ secrets.conanRemote }} | |
| build_linux_ubuntu_jammy: | |
| if: github.repository_owner == 'viamrobotics' | |
| needs: [prepare] | |
| runs-on: ${{ matrix.runs_on }} | |
| container: | |
| image: ${{ matrix.image }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-ubuntu-jammy-gnu | |
| platform: linux_aarch64-ubuntu-jammy | |
| image: ghcr.io/viamrobotics/cpp-sdk-conan-ubuntu:jammy | |
| runs_on: github-linux-arm64-8core | |
| - target: x86_64-ubuntu-jammy-gnu | |
| platform: linux_x86_64-ubuntu-jammy | |
| image: ghcr.io/viamrobotics/cpp-sdk-conan-ubuntu:jammy | |
| runs_on: ubuntu-large | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Create package | |
| run: | | |
| conan create . --build=missing -pr:a default \ | |
| --lockfile etc/conan/conan.lock --lockfile-partial | |
| build_linux_debian: | |
| if: github.repository_owner == 'viamrobotics' | |
| needs: [prepare] | |
| runs-on: ${{ matrix.runs_on }} | |
| container: | |
| image: ${{ matrix.image }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-debian-bullseye | |
| platform: linux_aarch64-debian-bullseye | |
| image: ghcr.io/viamrobotics/cpp-sdk-conan-debian:bullseye | |
| runs_on: github-linux-arm64-8core | |
| - target: x86_64-debian-bullseye | |
| platform: linux_x86_64-debian-bullseye | |
| image: ghcr.io/viamrobotics/cpp-sdk-conan-debian:bullseye | |
| runs_on: ubuntu-large | |
| - target: aarch64-debian-bookworm | |
| platform: linux_aarch64-debian-bookworm | |
| image: ghcr.io/viamrobotics/cpp-sdk-conan-debian:bookworm | |
| runs_on: github-linux-arm64-8core | |
| - target: x86_64-debian-bookworm | |
| platform: linux_x86_64-debian-bookworm | |
| image: ghcr.io/viamrobotics/cpp-sdk-conan-debian:bookworm | |
| runs_on: ubuntu-large | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| # Force a local b2 build; the cached conancenter binary links a glibc newer than bullseye's. | |
| - name: Pre-install b2 (bullseye) | |
| if: matrix.image == 'ghcr.io/viamrobotics/cpp-sdk-conan-debian:bullseye' | |
| run: | | |
| conan install -r conancenter --update \ | |
| --tool-requires=b2/5.4.2 --build=b2/5.4.2 -pr:a default | |
| - name: Create package | |
| run: | | |
| conan create . --build=missing -pr:a default \ | |
| --lockfile etc/conan/conan.lock --lockfile-partial | |
| build_windows: | |
| if: github.repository_owner == 'viamrobotics' | |
| needs: [prepare] | |
| runs-on: windows-2022 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-windows | |
| platform: windows_x86_64 | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.prepare.outputs.sha }} | |
| - name: Install dependencies | |
| run: choco install -y conan git | |
| - name: Create package | |
| shell: powershell | |
| run: | | |
| Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | |
| refreshenv | |
| conan profile detect | |
| conan remote add viamconan $env:CONAN_REMOTE_URL | |
| conan create . --build=missing -s:a compiler.cppstd=17 --lockfile etc/conan/conan.lock --lockfile-partial | |
| env: | |
| CONAN_USER_HOME: c:/cache | |
| CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths | |
| CONAN_REMOTE_URL: ${{ secrets.conanRemote }} | |