1 #
  2 # Copyright (c) 2022, 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: 'Get bundles'
 27 description: 'Download resulting JDK bundles'
 28 inputs:
 29   platform:
 30     description: 'Platform name'
 31     required: true
 32   debug-suffix:
 33     description: 'File name suffix denoting debug level, possibly empty'
 34     required: false
 35 outputs:
 36   jdk-path:
 37     description: 'Path to the installed JDK bundle'
 38     value: ${{ steps.path-name.outputs.jdk }}
 39   symbols-path:
 40     description: 'Path to the installed symbols bundle'
 41     value: ${{ steps.path-name.outputs.symbols }}
 42   tests-path:
 43     description: 'Path to the installed tests bundle'
 44     value: ${{ steps.path-name.outputs.tests }}
 45 
 46 runs:
 47   using: composite
 48   steps:
 49     - name: 'Download bundles artifact'
 50       id: download-bundles
 51       uses: actions/download-artifact@v3
 52       with:
 53         name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }}
 54         path: bundles
 55       continue-on-error: true
 56 
 57     - name: 'Download bundles artifact (retry)'
 58       uses: actions/download-artifact@v3
 59       with:
 60         name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }}
 61         path: bundles
 62       if: steps.download-bundles.outcome == 'failure'
 63 
 64     - name: 'Unpack bundles'
 65       run: |
 66         if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip ]]; then
 67           echo 'Unpacking jdk bundle...'
 68           mkdir -p bundles/jdk
 69           unzip -q bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip -d bundles/jdk
 70         fi
 71 
 72         if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then
 73           echo 'Unpacking jdk bundle...'
 74           mkdir -p bundles/jdk
 75           tar -xf bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/jdk
 76         fi
 77 
 78         if [[ -e bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then
 79           echo 'Unpacking symbols bundle...'
 80           mkdir -p bundles/symbols
 81           tar -xf bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/symbols
 82         fi
 83 
 84         if [[ -e bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz ]]; then
 85           echo 'Unpacking tests bundle...'
 86           mkdir -p bundles/tests
 87           tar -xf bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz -C bundles/tests
 88         fi
 89       shell: bash
 90 
 91     - name: 'Export paths to where bundles are installed'
 92       id: path-name
 93       run: |
 94         # Export the paths
 95 
 96         jdk_dir="$GITHUB_WORKSPACE/$(dirname $(find bundles/jdk -name bin -type d))"
 97         symbols_dir="$GITHUB_WORKSPACE/$(dirname $(find bundles/symbols -name bin -type d))"
 98         tests_dir="$GITHUB_WORKSPACE/bundles/tests"
 99 
100         if [[ '${{ runner.os }}' == 'Windows' ]]; then
101           jdk_dir="$(cygpath $jdk_dir)"
102           symbols_dir="$(cygpath $symbols_dir)"
103           tests_dir="$(cygpath $tests_dir)"
104         fi
105 
106         echo "jdk=$jdk_dir" >> $GITHUB_OUTPUT
107         echo "symbols=$symbols_dir" >> $GITHUB_OUTPUT
108         echo "tests=$tests_dir" >> $GITHUB_OUTPUT
109       shell: bash