File: _build.yaml

package info (click to toggle)
ada-url 3.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,320 kB
  • sloc: cpp: 24,281; ansic: 4,553; python: 573; sh: 193; makefile: 17
file content (220 lines) | stat: -rw-r--r-- 6,578 bytes parent folder | download
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: 'Build'

on:
  workflow_call:
    inputs:
      # Runner configuration
      runner:
        type: string
        required: true

      # Build configuration
      cxx:
        type: string
        required: false
        default: ''
      cxxflags:
        type: string
        required: false
        default: ''
      shared:
        type: string
        required: false
        default: 'OFF'
      simdutf:
        type: string
        required: false
        default: 'OFF'
      build_type:
        type: string
        required: false
        default: ''

      # CMake options
      cmake_args:
        type: string
        required: false
        default: ''
      testing:
        type: string
        required: false
        default: 'ON'
      benchmarks:
        type: string
        required: false
        default: 'OFF'

      # Windows-specific
      generator:
        type: string
        required: false
        default: 'Ninja'
      arch:
        type: string
        required: false
        default: ''
      toolset:
        type: string
        required: false
        default: ''

      # Post-build actions
      run_tests:
        type: boolean
        required: false
        default: true
      run_benchmarks:
        type: boolean
        required: false
        default: false
      run_install:
        type: boolean
        required: false
        default: false

      # Cross-compilation
      toolchain_file:
        type: string
        required: false
        default: ''
      qemu_cpu:
        type: string
        required: false
        default: ''
      qemu_ld_prefix:
        type: string
        required: false
        default: ''
      setup_script:
        type: string
        required: false
        default: ''

      # run-on-arch-action (for s390x, etc.)
      use_run_on_arch:
        type: boolean
        required: false
        default: false
      run_on_arch_arch:
        type: string
        required: false
        default: ''
      run_on_arch_distro:
        type: string
        required: false
        default: ''
      run_on_arch_install:
        type: string
        required: false
        default: ''
      run_on_arch_run:
        type: string
        required: false
        default: ''

permissions:
  contents: read

jobs:
  build:
    runs-on: ${{ inputs.runner }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Setup Runner
        if: ${{ !inputs.use_run_on_arch }}
        uses: ./.github/actions/setup-runner

      - name: Setup environment
        if: ${{ !inputs.use_run_on_arch && inputs.setup_script != '' }}
        shell: bash
        run: ${{ inputs.setup_script }}

      - name: Configure
        if: ${{ !inputs.use_run_on_arch }}
        shell: bash
        run: |
          CMAKE_ARGS="-G \"${{ inputs.generator }}\" -B build"
          CMAKE_ARGS="$CMAKE_ARGS -DADA_TESTING=${{ inputs.testing }}"
          CMAKE_ARGS="$CMAKE_ARGS -DADA_BENCHMARKS=${{ inputs.benchmarks }}"
          CMAKE_ARGS="$CMAKE_ARGS -DBUILD_SHARED_LIBS=${{ inputs.shared }}"
          CMAKE_ARGS="$CMAKE_ARGS -DADA_USE_SIMDUTF=${{ inputs.simdutf }}"
          # For multi-config generators (Visual Studio), don't set CMAKE_BUILD_TYPE
          # For single-config generators (Ninja, Make), set it
          if [[ "${{ inputs.generator }}" != *"Visual Studio"* ]] && [ -n "${{ inputs.build_type }}" ]; then
            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=${{ inputs.build_type }}"
          fi
          # Visual Studio generator: add architecture
          if [ -n "${{ inputs.arch }}" ]; then
            CMAKE_ARGS="$CMAKE_ARGS -A ${{ inputs.arch }}"
          fi
          if [ -n "${{ inputs.toolchain_file }}" ]; then
            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${{ inputs.toolchain_file }}"
          fi
          if [ -n "${{ inputs.cmake_args }}" ]; then
            CMAKE_ARGS="$CMAKE_ARGS ${{ inputs.cmake_args }}"
          fi
          if [ -n "${{ inputs.qemu_ld_prefix }}" ]; then
            export QEMU_LD_PREFIX="${{ inputs.qemu_ld_prefix }}"
          fi
          if [ -n "${{ inputs.qemu_cpu }}" ]; then
            export QEMU_CPU="${{ inputs.qemu_cpu }}"
          fi
          echo "Running: cmake $CMAKE_ARGS"
          eval cmake $CMAKE_ARGS
        env:
          CXX: ${{ inputs.cxx }}
          CXXFLAGS: ${{ inputs.cxxflags }}

      - name: Build
        if: ${{ !inputs.use_run_on_arch }}
        shell: bash
        run: |
          BUILD_ARGS="--build build -j=4"
          # For multi-config generators (Visual Studio), specify config at build time
          if [[ "${{ inputs.generator }}" == *"Visual Studio"* ]] && [ -n "${{ inputs.build_type }}" ]; then
            BUILD_ARGS="$BUILD_ARGS --config ${{ inputs.build_type }}"
          fi
          cmake $BUILD_ARGS

      - name: Test
        if: ${{ !inputs.use_run_on_arch && inputs.run_tests }}
        shell: bash
        run: |
          if [ -n "${{ inputs.qemu_ld_prefix }}" ]; then
            export QEMU_LD_PREFIX="${{ inputs.qemu_ld_prefix }}"
          fi
          if [ -n "${{ inputs.qemu_cpu }}" ]; then
            export QEMU_CPU="${{ inputs.qemu_cpu }}"
          fi
          TEST_ARGS="--output-on-failure --test-dir build"
          # For multi-config generators (Visual Studio), specify config at test time
          if [[ "${{ inputs.generator }}" == *"Visual Studio"* ]] && [ -n "${{ inputs.build_type }}" ]; then
            TEST_ARGS="$TEST_ARGS -C ${{ inputs.build_type }}"
          fi
          ctest $TEST_ARGS

      - name: Run benchmarks
        if: ${{ !inputs.use_run_on_arch && inputs.run_benchmarks }}
        shell: bash
        run: cd build && benchmarks/bench

      - name: Install and test
        if: ${{ !inputs.use_run_on_arch && inputs.run_install }}
        shell: bash
        run: |
          cmake --install build
          cmake -DCMAKE_INSTALL_PREFIX:PATH=../../destination -S tests/installation -B build_install_test
          cmake --build build_install_test
          ./build_install_test/main

      # run-on-arch path (for s390x and similar architectures)
      - uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1
        if: ${{ inputs.use_run_on_arch }}
        name: Build and Test
        with:
          arch: ${{ inputs.run_on_arch_arch }}
          distro: ${{ inputs.run_on_arch_distro }}
          githubToken: ${{ github.token }}
          install: ${{ inputs.run_on_arch_install }}
          run: ${{ inputs.run_on_arch_run }}