Skip to content
TheChatArchiveThe Chat Archive
o3-mini· OpenAIHugging Face LMArena Human Preference 140K

Make workflow for github action to build Java jdk for Windows x64. After completing the…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-7-sonnet-20250219’s answer.
  1. User

    Make workflow for github action to build Java jdk for Windows x64. After completing the building, it should upload the artifact. I want to run workflow myself or when syncing with the main repo. Building should work with using cygwin. It should have input for branch name or tag or commit SHA. Checkbox for adding --disable-warnings-as-errors as configure flag, choose of what build debug level i want (release, optimized, fast debug, slowdebug, etc.), input for boot jdk provider, input for boot jdk version, optional input for extra configure flags, and input for artifact name. All should have a default: input for branch and e.g. - master Boot jdk version - 21 Boot jdk provider - Adoptium build debug level - release Optional configure flags should be empty build artifact name should have default to (repo name)-(branch name)-windows-x64

  2. Assistant

    Below is an example GitHub Actions workflow (YAML file) that meets your requirements. This workflow:

    • Triggers manually (via “workflow_dispatch” with various inputs) or on pushes to the main branch.
    • Provides inputs for branch (or tag/commit SHA), a boolean “disable warnings” flag, a choice of debug level, boot JDK provider and version, optional extra configure flags, and an artifact name (whose default is computed from the repository name and branch).
    • Checks out the requested ref, installs Cygwin on a Windows runner, computes the full configure flags (including the optional “--disable-warnings-as-errors” flag if the checkbox is checked), and then launches the build via Cygwin’s bash (invoking “./configure … && make images”).
    • Finally, it computes (if not provided by the user) the artifact name and uses the upload-artifact action to upload the build output.

    Adjust the paths (for example, where the built artifact is located) as needed for your project.

    Below is the complete workflow YAML:


    name: Build Java JDK for Windows x64
    
    on:
      workflow_dispatch:
        inputs:
          branch:
            description: 'Branch/Tag/Commit SHA to build'
            required: false
            default: 'master'
          disableWarningsAsErrors:
            description: 'Add --disable-warnings-as-errors to configure'
            required: false
            default: 'false'
          debugLevel:
            description: 'Select the build debug level'
            required: false
            default: 'release'
            options:
              - release
              - optimized
              - fastdebug
              - slowdebug
          bootJdkProvider:
            description: 'Boot JDK Provider'
            required: false
            default: 'Adoptium'
          bootJdkVersion:
            description: 'Boot JDK Version'
            required: false
            default: '21'
          extraConfigureFlags:
            description: 'Optional extra flags for configure'
            required: false
            default: ''
          artifactName:
            description: 'Artifact name. If empty, defaults to (repo name)-(branch)-windows-x64'
            required: false
            default: ''
    
      push:
        branches:
          - main
    
    jobs:
      build:
        runs-on: windows-latest
        env:
          # (You can add global environment variables here if needed.)
          # You might customize the location for your build output.
          ARTIFACT_OUTPUT_PATH: build\images
    
        steps:
          - name: Checkout code
            uses: actions/checkout@v3
            with:
              # (The ref can be overwritten by the workflow input.)
              ref: ${{ github.event.inputs.branch }}
              fetch-depth: 0
    
          - name: Install Cygwin
            run: choco install cygwin -y
            shell: cmd
    
          - name: Set up build configuration flags
            id: config
            shell: pwsh
            run: |
              # Initialize an empty string.
              $configureFlags = ""
              if ("${{ github.event.inputs.disableWarningsAsErrors }}" -eq "true") {
                $configureFlags += " --disable-warnings-as-errors"
              }
              if ("${{ github.event.inputs.extraConfigureFlags }}" -ne "") {
                $configureFlags += " ${{ github.event.inputs.extraConfigureFlags }}"
              }
              $configureFlags += " --with-debug-level=${{ github.event.inputs.debugLevel }}"
              $configureFlags += " --with-boot-jdk-provider=${{ github.event.inputs.bootJdkProvider }}"
              $configureFlags += " --with-boot-jdk-version=${{ github.event.inputs.bootJdkVersion }}"
              Write-Host "Configure flags:$configureFlags"
              # Set the output variable (note: set-output is deprecated but still works)
              echo "::set-output name=configure_flags::$configureFlags"
    
          - name: Build Java JDK using Cygwin
            # This step calls Cygwin’s bash to run the build.
            run: |
              REM Ensure we change directory to the repository root if needed.
              pushd %GITHUB_WORKSPACE%
              REM Invoke Cygwin’s bash – note that paths and commands may need adjustment
              C:\cygwin64\bin\bash.exe -login -c "./configure ${{ steps.config.outputs.configure_flags }} && make images"
              popd
            shell: cmd
    
          - name: Determine artifact name
            shell: pwsh
            run: |
              if ([string]::IsNullOrEmpty("${{ github.event.inputs.artifactName }}")) {
                # Replace the slash in the repository name with a dash.
                $repoName = "${{ github.repository }}".Replace('/', '-')
                $artifactName = "$repoName-${{ github.event.inputs.branch }}-windows-x64"
              }
              else {
                $artifactName = "${{ github.event.inputs.artifactName }}"
              }
              Write-Host "Artifact name: $artifactName"
              # Set the computed artifact name as an environment variable for subsequent steps.
              echo "ARTIFACT_NAME=$artifactName" | Out-File -FilePath $env:GITHUB_ENV -Append
    
          - name: Upload build artifact
            uses: actions/upload-artifact@v3
            with:
              name: ${{ env.ARTIFACT_NAME }}
              path: ${{ env.ARTIFACT_OUTPUT_PATH }}
    

    Explanation

    1. Triggers & Inputs
      The workflow is triggered manually via workflow_dispatch (with inputs to specify branch/tag/commit, disable-warnings flag, debug level, boot JDK provider/version, extra configure flags, and artifact name) and automatically on pushes to main.

    2. Checkout Step
      It checks out the repository using the provided branch (or default “master”) with full history.

    3. Installing Cygwin
      On a Windows runner, Chocolatey is used to install Cygwin so that the build tools needed for your build (such as bash) are available.

    4. Setting up Build Configuration
      A PowerShell step computes the configure flags based on the inputs. (If the “disableWarningsAsErrors” input is true, it adds that flag; it also appends debug level, boot JDK provider/version, and any extra flags.) This string is saved in the step’s output so that it can be passed to the build command.

    5. Building via Cygwin
      The build step “Build Java JDK using Cygwin” runs Cygwin’s bash (using the path C:\cygwin64\bin\bash.exe) with the computed configure flags, then runs make images (you should change this if your target is different).

    6. Determining the Artifact Name
      A PowerShell step checks whether an artifact name was provided. If not, it computes a default name by replacing any slash in the repository name with a dash and appending the branch and “windows-x64”.

    7. Uploading the Artifact
      Finally, the built files (adjust the path in the ARTIFACT_OUTPUT_PATH variable if needed) are uploaded using GitHub’s upload-artifact action.

    You can place this file in your repository under .github/workflows/build-windows-jdk.yml (or a name of your choosing). Adjust paths and commands as needed for your build system and project structure.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.