name: "Build mode manual"
description: "An end-to-end integration test of a Java repository built using 'build-mode: manual'"
versions: ["nightly-latest"]
installGo: true
installDotNet: true
steps:
  - uses: ./../action/init
    id: init
    with:
      build-mode: manual
      db-location: "${{ runner.temp }}/customDbLocation"
      languages: java
      tools: ${{ steps.prepare-test.outputs.tools-url }}

  - name: Validate database build mode
    run: |
      metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
      build_mode=$(yq eval '.buildMode' "$metadata_path")
      if [[ "$build_mode" != "manual" ]]; then
        echo "Expected build mode to be 'manual' but was $build_mode"
        exit 1
      fi

  - name: Build code
    run: ./build.sh

  - uses: ./../action/analyze
