summaryrefslogtreecommitdiffstatshomepage
path: root/.github/actions/build-example/action.yml
blob: 7e978711b06edaeed8cda5f91b23630f10571ab2 (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
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
outputs:
  install_dir:
    description: Installation directory
    value: ${{ steps.install_dir.outputs.path }}
runs:
  using: composite
  steps:
    - id: install_dir
      env:
        ARG_SRC_DIR: ${{ inputs.src_dir }}
      run: |
        $workspace = (Get-ChildItem env:GITHUB_WORKSPACE).Value
        $src_dir = Resolve-Path (Get-ChildItem env:ARG_SRC_DIR).Value
        $project_name = Split-Path $src_dir -Leaf
        $install_dir = Join-Path (Split-Path $workspace) "install_$project_name"
        echo "path=$install_dir" >> $env:GITHUB_OUTPUT
      shell: pwsh
    - env:
        ARG_SRC_DIR: ${{ inputs.src_dir }}
        ARG_BOOST_DIR: ${{ inputs.boost_dir }}
        ARG_TOOLSET: ${{ inputs.toolset }}
        ARG_PLATFORM: ${{ inputs.platform }}
        ARG_CONFIGURATION: ${{ inputs.configuration }}
        INSTALL_DIR: ${{ steps.install_dir.outputs.path }}
      run: |
        $src_dir = (Get-ChildItem env:ARG_SRC_DIR).Value
        $boost_dir = (Get-ChildItem env:ARG_BOOST_DIR).Value
        $install_dir = (Get-ChildItem env:INSTALL_DIR).Value
        $toolset = (Get-ChildItem env:ARG_TOOLSET).Value
        $platform = (Get-ChildItem env:ARG_PLATFORM).Value
        $configuration = (Get-ChildItem env:ARG_CONFIGURATION).Value

        $args = @(
            '--install', $install_dir,
            '--toolset', $toolset,
            '--platform', $platform,
            '--configuration', $configuration
        )

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

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