Skip to content

tmp.2

tmp.2 #24

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the OpenEXR Project.
#
name: CI-fetchcontent
#
# Test that Imath is configured properly for FetchContent.
#
# This builds a test program in share/ci/src/fetch where the CMake
# configures Imath via Fetch_Content, pulling from the job's GitHub
# repo and branch.
#
on:
push:
paths:
- '**'
- '!**.md'
- '!share/ci/**'
- '!.github/workflows/**'
- '.github/workflows/ci_fetchcontent.yml'
pull_request:
paths:
- '**'
- '!**.md'
- '!share/ci/**'
- '!.github/workflows/**'
- '.github/workflows/ci_fetchcontent.yml'
permissions:
contents: write
jobs:
build:
name: FetchContent on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Push temp ref for FetchContent
run: |
set -x
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git remote add origin-write https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push origin-write HEAD:refs/heads/temp-ci-${{ github.run_id }}
shell: bash
- name: Configure & Build
run: |
set -x
if [[ "$RUNNER_OS" == "Windows" ]]; then
WORKSPACE=$(cygpath -u "$GITHUB_WORKSPACE")
else
WORKSPACE=$GITHUB_WORKSPACE
fi
BUILD_DIR=$WORKSPACE/_build
IMATH_TAG=temp-ci-${{ github.run_id }}
IMATH_REPO=https://github.com/$GITHUB_REPOSITORY
cmake -S share/ci/src/fetch -B $BUILD_DIR \
-DIMATH_REPO=$IMATH_REPO -DIMATH_TAG=$IMATH_TAG
cmake --build $BUILD_DIR --config Release
if [[ "$RUNNER_OS" == "Windows" ]]; then
IMATH_DLL=$(find $BUILD_DIR -name "Imath*.dll")
IMATH_LIB_DIR=$(dirname $IMATH_DLL)
PATH=$IMATH_LIB_DIR:$PATH
$BUILD_DIR/Release/ImathFetchTest.exe
else
$BUILD_DIR/ImathFetchTest
fi
shell: bash
- name: Cleanup temp branch
if: always() && github.event_name == 'pull_request'
run: |
set -x
git remote add origin-write https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push origin-write --delete temp-ci-${{ github.run_id }}
shell: bash