aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/actions/build-example/action.yml
blob: 8d684c1e8af5b95008c5cbb277b396a04998eee3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build example project
description: Build example project
inputs:
  src-dir:
    description: Project directory
    required: true
  boost-dir:
    description: Boost directory
    required: false
  toolset:
    description: Toolset to use
    required: false
    default: auto
  platform:
    description: Target platform
    required: false
    default: x64
  configuration:
    description: Configuration to build
    required: false
    default: Debug
  cmake-args:
    description: Additional CMake arguments
    required: false
outputs:
  install-dir:
    description: Installation directory
    value: '${{ steps.install-dir.outputs.path }}'
runs:
  using: composite
  steps:
    - id: install-dir
      run: |
        $src_dir = Resolve-Path '${{ inputs.src-dir }}'
        $project_name = Split-Path $src_dir -Leaf
        $install_dir = Join-Path (Split-Path $env:GITHUB_WORKSPACE) "install_$project_name"
        echo "path=$install_dir" >> $env:GITHUB_OUTPUT
      shell: pwsh
    - run: |
        $python = 'python'
        $src_dir = '${{ inputs.src-dir }}'
        $install_dir = '${{ steps.install-dir.outputs.path }}'
        $boost_dir = '${{ inputs.boost-dir }}'

        if ($env:CI_HOST_CYGWIN) {
            $python = 'python3'
            $src_dir = cygpath.exe -ua $src_dir
            $install_dir = cygpath.exe -ua $install_dir
            if ($boost_dir) {
                $boost_dir = cygpath.exe -ua $boost_dir
            }
        }

        $args = @(
            '--install',
            $install_dir,
            '--platform',
            '${{ inputs.platform }}',
            '--configuration',
            '${{ inputs.configuration }}',
            '--toolset',
            '${{ inputs.toolset }}'
        )

        if ($boost_dir) {
            $args += '--boost',$boost_dir
        }

        $args += '--',$src_dir,'TMP'
        $env:VERBOSE = 1
        & $python -m project.build $args ${{ inputs.cmake-args }}
      shell: pwsh