jdk

Форк
0
/
main.yml 
388 строк · 13.8 Кб
1
#
2
# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
name: 'OpenJDK GHA Sanity Checks'
27

28
on:
29
  push:
30
    branches-ignore:
31
      - master
32
      - pr/*
33
      - jdk*
34
  workflow_dispatch:
35
    inputs:
36
      platforms:
37
        description: 'Platform(s) to execute on (comma separated, e.g. "linux-x64, macos, aarch64")'
38
        required: true
39
        default: 'linux-x64, linux-x86, linux-x64-variants, linux-cross-compile, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs'
40
      configure-arguments:
41
        description: 'Additional configure arguments'
42
        required: false
43
      make-arguments:
44
        description: 'Additional make arguments'
45
        required: false
46

47
concurrency:
48
  group: ${{ github.workflow }}-${{ github.ref }}
49
  cancel-in-progress: true
50

51
jobs:
52

53
  ###
54
  ### Determine platforms to include
55
  ###
56

57
  select:
58
    name: 'Select platforms'
59
    runs-on: ubuntu-22.04
60
    outputs:
61
      linux-x64: ${{ steps.include.outputs.linux-x64 }}
62
      linux-x86: ${{ steps.include.outputs.linux-x86 }}
63
      linux-x64-variants: ${{ steps.include.outputs.linux-x64-variants }}
64
      linux-cross-compile: ${{ steps.include.outputs.linux-cross-compile }}
65
      macos-x64: ${{ steps.include.outputs.macos-x64 }}
66
      macos-aarch64: ${{ steps.include.outputs.macos-aarch64 }}
67
      windows-x64: ${{ steps.include.outputs.windows-x64 }}
68
      windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }}
69
      docs: ${{ steps.include.outputs.docs }}
70

71
    steps:
72
        # This function must be inlined in main.yml, or we'd be forced to checkout the repo
73
      - name: 'Check what jobs to run'
74
        id: include
75
        run: |
76
          # Determine which platform jobs to run
77

78
          # Returns 'true' if the input platform list matches any of the platform monikers given as argument,
79
          # 'false' otherwise.
80
          # arg $1: platform name or names to look for
81
          function check_platform() {
82
            if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
83
              input='${{ github.event.inputs.platforms }}'
84
            elif [[ $GITHUB_EVENT_NAME == push ]]; then
85
              if [[ '${{ !secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/') }}' == 'false' ]]; then
86
                # If JDK_SUBMIT_FILTER is set, and this is not a "submit/" branch, don't run anything
87
                >&2 echo 'JDK_SUBMIT_FILTER is set and not a "submit/" branch'
88
                echo 'false'
89
                return
90
              else
91
                input='${{ secrets.JDK_SUBMIT_PLATFORMS }}'
92
              fi
93
            fi
94

95
            normalized_input="$(echo ,$input, | tr -d ' ')"
96
            if [[ "$normalized_input" == ",," ]]; then
97
              # For an empty input, assume all platforms should run
98
              echo 'true'
99
              return
100
            else
101
              # Check for all acceptable platform names
102
              for part in $* ; do
103
                if echo "$normalized_input" | grep -q -e ",$part," ; then
104
                  echo 'true'
105
                  return
106
                fi
107
              done
108
            fi
109

110
            echo 'false'
111
          }
112

113
          echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT
114
          echo "linux-x86=$(check_platform linux-x86 linux x86)" >> $GITHUB_OUTPUT
115
          echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT
116
          echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT
117
          echo "macos-x64=$(check_platform macos-x64 macos x64)" >> $GITHUB_OUTPUT
118
          echo "macos-aarch64=$(check_platform macos-aarch64 macos aarch64)" >> $GITHUB_OUTPUT
119
          echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT
120
          echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT
121
          echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT
122

123
  ###
124
  ### Build jobs
125
  ###
126

127
  build-linux-x64:
128
    name: linux-x64
129
    needs: select
130
    uses: ./.github/workflows/build-linux.yml
131
    with:
132
      platform: linux-x64
133
      gcc-major-version: '10'
134
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
135
      make-arguments: ${{ github.event.inputs.make-arguments }}
136
    if: needs.select.outputs.linux-x64 == 'true'
137

138
  build-linux-x86:
139
    name: linux-x86
140
    needs: select
141
    uses: ./.github/workflows/build-linux.yml
142
    with:
143
      platform: linux-x86
144
      gcc-major-version: '10'
145
      gcc-package-suffix: '-multilib'
146
      apt-architecture: 'i386'
147
      # Some multilib libraries do not have proper inter-dependencies, so we have to
148
      # install their dependencies manually.
149
      apt-extra-packages: 'libfreetype-dev:i386 libtiff-dev:i386 libcupsimage2-dev:i386 libffi-dev:i386'
150
      extra-conf-options: '--with-target-bits=32 --enable-fallback-linker --enable-libffi-bundling'
151
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
152
      make-arguments: ${{ github.event.inputs.make-arguments }}
153
    if: needs.select.outputs.linux-x86 == 'true'
154

155
  build-linux-x64-hs-nopch:
156
    name: linux-x64-hs-nopch
157
    needs: select
158
    uses: ./.github/workflows/build-linux.yml
159
    with:
160
      platform: linux-x64
161
      make-target: 'hotspot'
162
      debug-levels: '[ "debug" ]'
163
      gcc-major-version: '10'
164
      extra-conf-options: '--disable-precompiled-headers'
165
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
166
      make-arguments: ${{ github.event.inputs.make-arguments }}
167
    if: needs.select.outputs.linux-x64-variants == 'true'
168

169
  build-linux-x64-hs-zero:
170
    name: linux-x64-hs-zero
171
    needs: select
172
    uses: ./.github/workflows/build-linux.yml
173
    with:
174
      platform: linux-x64
175
      make-target: 'hotspot'
176
      debug-levels: '[ "debug" ]'
177
      gcc-major-version: '10'
178
      extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
179
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
180
      make-arguments: ${{ github.event.inputs.make-arguments }}
181
    if: needs.select.outputs.linux-x64-variants == 'true'
182

183
  build-linux-x64-hs-minimal:
184
    name: linux-x64-hs-minimal
185
    needs: select
186
    uses: ./.github/workflows/build-linux.yml
187
    with:
188
      platform: linux-x64
189
      make-target: 'hotspot'
190
      debug-levels: '[ "debug" ]'
191
      gcc-major-version: '10'
192
      extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
193
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
194
      make-arguments: ${{ github.event.inputs.make-arguments }}
195
    if: needs.select.outputs.linux-x64-variants == 'true'
196

197
  build-linux-x64-hs-optimized:
198
    name: linux-x64-hs-optimized
199
    needs: select
200
    uses: ./.github/workflows/build-linux.yml
201
    with:
202
      platform: linux-x64
203
      make-target: 'hotspot'
204
      # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
205
      debug-levels: '[ "debug" ]'
206
      gcc-major-version: '10'
207
      extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
208
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
209
      make-arguments: ${{ github.event.inputs.make-arguments }}
210
    if: needs.select.outputs.linux-x64-variants == 'true'
211

212
  build-linux-cross-compile:
213
    name: linux-cross-compile
214
    needs:
215
      - select
216
    uses: ./.github/workflows/build-cross-compile.yml
217
    with:
218
      gcc-major-version: '10'
219
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
220
      make-arguments: ${{ github.event.inputs.make-arguments }}
221
    if: needs.select.outputs.linux-cross-compile == 'true'
222

223
  build-macos-x64:
224
    name: macos-x64
225
    needs: select
226
    uses: ./.github/workflows/build-macos.yml
227
    with:
228
      platform: macos-x64
229
      runs-on: 'macos-13'
230
      xcode-toolset-version: '14.3.1'
231
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
232
      make-arguments: ${{ github.event.inputs.make-arguments }}
233
    if: needs.select.outputs.macos-x64 == 'true'
234

235
  build-macos-aarch64:
236
    name: macos-aarch64
237
    needs: select
238
    uses: ./.github/workflows/build-macos.yml
239
    with:
240
      platform: macos-aarch64
241
      runs-on: 'macos-14'
242
      xcode-toolset-version: '14.3.1'
243
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
244
      make-arguments: ${{ github.event.inputs.make-arguments }}
245
    if: needs.select.outputs.macos-aarch64 == 'true'
246

247
  build-windows-x64:
248
    name: windows-x64
249
    needs: select
250
    uses: ./.github/workflows/build-windows.yml
251
    with:
252
      platform: windows-x64
253
      msvc-toolset-version: '14.29'
254
      msvc-toolset-architecture: 'x86.x64'
255
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
256
      make-arguments: ${{ github.event.inputs.make-arguments }}
257
    if: needs.select.outputs.windows-x64 == 'true'
258

259
  build-windows-aarch64:
260
    name: windows-aarch64
261
    needs: select
262
    uses: ./.github/workflows/build-windows.yml
263
    with:
264
      platform: windows-aarch64
265
      msvc-toolset-version: '14.29'
266
      msvc-toolset-architecture: 'arm64'
267
      make-target: 'hotspot'
268
      extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
269
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
270
      make-arguments: ${{ github.event.inputs.make-arguments }}
271
    if: needs.select.outputs.windows-aarch64 == 'true'
272

273
  build-docs:
274
    name: docs
275
    needs: select
276
    uses: ./.github/workflows/build-linux.yml
277
    with:
278
      platform: linux-x64
279
      debug-levels: '[ "debug" ]'
280
      make-target: 'docs-jdk-bundles'
281
      # Make sure we never try to make full docs, since that would require a
282
      # build JDK, and we do not need the additional testing of the graphs.
283
      extra-conf-options: '--disable-full-docs'
284
      gcc-major-version: '10'
285
      configure-arguments: ${{ github.event.inputs.configure-arguments }}
286
      make-arguments: ${{ github.event.inputs.make-arguments }}
287
    if: needs.select.outputs.docs == 'true'
288

289
  ###
290
  ### Test jobs
291
  ###
292

293
  test-linux-x64:
294
    name: linux-x64
295
    needs:
296
      - build-linux-x64
297
    uses: ./.github/workflows/test.yml
298
    with:
299
      platform: linux-x64
300
      bootjdk-platform: linux-x64
301
      runs-on: ubuntu-22.04
302

303
  test-linux-x86:
304
    name: linux-x86
305
    needs:
306
      - build-linux-x86
307
    uses: ./.github/workflows/test.yml
308
    with:
309
      platform: linux-x86
310
      bootjdk-platform: linux-x64
311
      runs-on: ubuntu-22.04
312

313
  test-macos-x64:
314
    name: macos-x64
315
    needs:
316
      - build-macos-x64
317
    uses: ./.github/workflows/test.yml
318
    with:
319
      platform: macos-x64
320
      bootjdk-platform: macos-x64
321
      runs-on: macos-13
322

323
  test-macos-aarch64:
324
    name: macos-aarch64
325
    needs:
326
      - build-macos-aarch64
327
    uses: ./.github/workflows/test.yml
328
    with:
329
      platform: macos-aarch64
330
      bootjdk-platform: macos-aarch64
331
      runs-on: macos-14
332

333
  test-windows-x64:
334
    name: windows-x64
335
    needs:
336
      - build-windows-x64
337
    uses: ./.github/workflows/test.yml
338
    with:
339
      platform: windows-x64
340
      bootjdk-platform: windows-x64
341
      runs-on: windows-2019
342

343
  # Remove bundles so they are not misconstrued as binary distributions from the JDK project
344
  remove-bundles:
345
    name: 'Remove bundle artifacts'
346
    runs-on: ubuntu-22.04
347
    if: always()
348
    needs:
349
      - build-linux-x64
350
      - build-linux-x86
351
      - build-linux-x64-hs-nopch
352
      - build-linux-x64-hs-zero
353
      - build-linux-x64-hs-minimal
354
      - build-linux-x64-hs-optimized
355
      - build-linux-cross-compile
356
      - build-macos-x64
357
      - build-macos-aarch64
358
      - build-windows-x64
359
      - build-windows-aarch64
360
      - test-linux-x64
361
      - test-linux-x86
362
      - test-macos-x64
363
      - test-windows-x64
364

365
    steps:
366
        # Hack to get hold of the api environment variables that are only defined for actions
367
      - name: 'Get API configuration'
368
        id: api
369
        uses: actions/github-script@v7
370
        with:
371
          script: 'return { url: process.env["ACTIONS_RUNTIME_URL"], token: process.env["ACTIONS_RUNTIME_TOKEN"] }'
372

373
      - name: 'Remove bundle artifacts'
374
        run: |
375
          # Find and remove all bundle artifacts
376
          ALL_ARTIFACT_URLS="$(curl -s \
377
              -H 'Accept: application/json;api-version=6.0-preview' \
378
              -H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
379
              '${{ fromJson(steps.api.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview')"
380
          BUNDLE_ARTIFACT_URLS="$(echo "$ALL_ARTIFACT_URLS" | jq -r -c '.value | map(select(.name|startswith("bundles-"))) | .[].url')"
381
          for url in $BUNDLE_ARTIFACT_URLS; do
382
            echo "Removing $url"
383
            curl -s \
384
                -H 'Accept: application/json;api-version=6.0-preview' \
385
                -H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
386
                -X DELETE "$url" \
387
            || echo "Failed to remove bundle"
388
          done
389

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.