|
| 1 | +# Test FetchContent of UMF on Linux and Windows (on Windows with the 'Ninja' and 'NMake Makefiles' generators) |
| 2 | +name: FetchContent |
| 3 | + |
| 4 | +on: workflow_call |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + packages: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + Linux-FetchContent: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + container: |
| 14 | + image: ghcr.io/bb-ur/umf-${{ matrix.os }}:latest |
| 15 | + options: --user test_user --cap-add=SYS_NICE --cap-add=SYS_PTRACE |
| 16 | + volumes: |
| 17 | + - ${{ github.workspace }}:${{ github.workspace }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: ['ubuntu-24.04'] |
| 22 | + build_type: [Debug] |
| 23 | + name: FetchContent-Linux (${{matrix.os}}, build_type=${{matrix.build_type}}) |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Configure the fetch_content example |
| 32 | + working-directory: ${{github.workspace}}/examples/fetch_content |
| 33 | + # Fetch_Content the UMF code from the current repository (-DUMF_REPO="${{github.workspace}}") |
| 34 | + run: > |
| 35 | + cmake |
| 36 | + -B ${{github.workspace}}/examples/fetch_content/build |
| 37 | + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} |
| 38 | + -DUMF_REPO="${{github.workspace}}" |
| 39 | +
|
| 40 | + - name: Build the fetch_content example |
| 41 | + working-directory: ${{github.workspace}}/examples/fetch_content |
| 42 | + run: cmake --build ${{github.workspace}}/examples/fetch_content/build --config ${{matrix.build_type}} -j $(nproc) |
| 43 | + |
| 44 | + - name: Run the fetch_content example |
| 45 | + working-directory: ${{github.workspace}}/examples/fetch_content/build |
| 46 | + run: ./umf_example_fetch_content |
| 47 | + |
| 48 | + # Build and test the fetch_content example with different CMake generators on Windows |
| 49 | + Windows-FetchContent: |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + build_type: [Debug] |
| 54 | + generator: ['Ninja', 'NMake Makefiles'] |
| 55 | + name: FetchContent-Windows (generator=${{matrix.generator}}, build_type=${{matrix.build_type}}) |
| 56 | + runs-on: windows-latest |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout |
| 60 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 61 | + with: |
| 62 | + fetch-depth: 0 |
| 63 | + |
| 64 | + - name: Set VCPKG_PATH |
| 65 | + run: echo "VCPKG_PATH=${{github.workspace}}/examples/fetch_content/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/examples/fetch_content/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/examples/fetch_content/build/vcpkg/packages/jemalloc_x64-windows" >> $env:GITHUB_ENV |
| 66 | + |
| 67 | + - name: Initialize vcpkg |
| 68 | + uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 |
| 69 | + env: |
| 70 | + VCPKG_PATH: ${{env.VCPKG_PATH}} |
| 71 | + with: |
| 72 | + vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 |
| 73 | + vcpkgDirectory: ${{github.workspace}}/examples/fetch_content/build/vcpkg |
| 74 | + vcpkgJsonGlob: '**/vcpkg.json' |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: vcpkg install --triplet x64-windows |
| 78 | + |
| 79 | + - name: Install Ninja |
| 80 | + if: matrix.generator == 'Ninja' |
| 81 | + uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 |
| 82 | + |
| 83 | + - name: Configure MSVC environment |
| 84 | + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 |
| 85 | + |
| 86 | + - name: Configure the fetch_content example |
| 87 | + working-directory: ${{github.workspace}}/examples/fetch_content |
| 88 | + # Fetch_Content the UMF code from the current repository (-DUMF_REPO="${{github.workspace}}") |
| 89 | + run: > |
| 90 | + cmake |
| 91 | + -B ${{github.workspace}}/examples/fetch_content/build |
| 92 | + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} |
| 93 | + -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}" |
| 94 | + -DUMF_REPO="${{github.workspace}}" |
| 95 | + -DCMAKE_C_COMPILER=cl |
| 96 | + -DCMAKE_CXX_COMPILER=cl |
| 97 | + -G "${{matrix.generator}}" |
| 98 | +
|
| 99 | + - name: Build the fetch_content example |
| 100 | + working-directory: ${{github.workspace}}/examples/fetch_content |
| 101 | + shell: cmd |
| 102 | + run: cmake --build ${{github.workspace}}/examples/fetch_content/build --config ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS% |
| 103 | + |
| 104 | + - name: Run the fetch_content example |
| 105 | + shell: cmd |
| 106 | + working-directory: ${{github.workspace}}/examples/fetch_content/build |
| 107 | + run: dir .\umf_example_fetch_content.exe |
0 commit comments