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: 'Build (macos)'
 27 
 28 on:
 29   workflow_call:
 30     inputs:
 31       platform:
 32         required: true
 33         type: string
 34       runs-on:
 35         required: true
 36         type: string
 37       extra-conf-options:
 38         required: false
 39         type: string
 40       make-target:
 41         required: false
 42         type: string
 43         default: 'product-bundles test-bundles'
 44       debug-levels:
 45         required: false
 46         type: string
 47         default: '[ "debug", "release" ]'
 48       xcode-toolset-version:
 49         required: true
 50         type: string
 51       configure-arguments:
 52         required: false
 53         type: string
 54       make-arguments:
 55         required: false
 56         type: string
 57       dry-run:
 58         required: false
 59         type: boolean
 60         default: false
 61 
 62 jobs:
 63   build-macos:
 64     name: build
 65     runs-on: ${{ inputs.runs-on }}
 66 
 67     strategy:
 68       fail-fast: false
 69       matrix:
 70         debug-level: ${{ fromJSON(inputs.debug-levels) }}
 71         include:
 72           - debug-level: debug
 73             flags: --with-debug-level=fastdebug
 74             suffix: -debug
 75 
 76     steps:
 77       - name: 'Checkout the JDK source'
 78         uses: actions/checkout@v4
 79 
 80       - name: 'Get the BootJDK'
 81         id: bootjdk
 82         uses: ./.github/actions/get-bootjdk
 83         with:
 84           platform: ${{ inputs.platform }}
 85 
 86       - name: 'Get JTReg'
 87         id: jtreg
 88         uses: ./.github/actions/get-jtreg
 89 
 90       - name: 'Get GTest'
 91         id: gtest
 92         uses: ./.github/actions/get-gtest
 93 
 94       - name: 'Install toolchain and dependencies'
 95         run: |
 96           # Run Homebrew installation and xcode-select
 97           brew install autoconf make
 98           sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-toolset-version }}.app/Contents/Developer
 99           # This will make GNU make available as 'make' and not only as 'gmake'
100           echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH
101 
102       - name: 'Configure'
103         run: >
104           bash configure
105           --with-conf-name=${{ inputs.platform }}
106           ${{ matrix.flags }}
107           --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
108           --with-boot-jdk=${{ steps.bootjdk.outputs.path }}
109           --with-jtreg=${{ steps.jtreg.outputs.path }}
110           --with-gtest=${{ steps.gtest.outputs.path }}
111           --with-zlib=system
112           --with-jmod-compress=zip-1
113           ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
114           echo "Dumping config.log:" &&
115           cat config.log &&
116           exit 1)
117 
118       - name: 'Build'
119         id: build
120         uses: ./.github/actions/do-build
121         with:
122           make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
123           platform: ${{ inputs.platform }}
124           debug-suffix: '${{ matrix.suffix }}'
125         if: ${{ inputs.dry-run == false }}
126 
127       - name: 'Upload bundles'
128         uses: ./.github/actions/upload-bundles
129         with:
130           platform: ${{ inputs.platform }}
131           debug-suffix: '${{ matrix.suffix }}'
132         if: ${{ inputs.dry-run == false }}