# build artifacts not automatically cleaned up
# force cleanup, always
# also display installed components and packages
steps:
- task: Bash@3
  displayName: OS Version
  inputs:
    targetType: inline
    script: cat /etc/os-release
- task: Bash@3
  displayName: List installed packages (apt, dnf, or yum)
  inputs:
    targetType: inline
    script: |
      if command -v apt >/dev/null 2>&1; then
        echo "Listing installed packages with apt:"
        apt list --installed
      elif command -v dnf >/dev/null 2>&1; then
        echo "Listing installed packages with dnf:"
        dnf list installed
      elif command -v yum >/dev/null 2>&1; then
        echo "Listing installed packages with yum:"
        yum list installed
      else
        echo "No supported package manager found (apt, dnf, yum)."
      fi
- task: Bash@3
  displayName: Print Python version
  inputs:
    targetType: inline
    script: python3 --version
- task: Bash@3
  displayName: List Python packages
  inputs:
    targetType: inline
    script: python3 -m pip list -v
# The "Azure Pipelines" agents install CMake in multiple ways, including a standalone install into /usr/local/bin:
# https://github.com/actions/runner-images/blob/6d939a3ab352a54a021dd67b071577287b6f14a5/images/ubuntu/scripts/build/install-cmake.sh#L27
# This standalone CMake does not have a fixed version, and is not the same version as the one installed by the package manager
# We want to use the CMake installed by the package manager, so just remove any bins from the standalone install
- task: Bash@3
  displayName: Remove CMake binaries from /usr/local/bin
  inputs:
    targetType: inline
    script: |
      sudo rm -f /usr/local/bin/ccmake
      sudo rm -f /usr/local/bin/cmake
      sudo rm -f /usr/local/bin/cmake-gui
- task: Bash@3
  displayName: Print CMake info
  inputs:
    targetType: inline
    script: |
      cmake --version
      which cmake
- task: DeleteFiles@1
  displayName: 'Cleanup checkout space'
  inputs:
    SourceFolder: '$(Agent.BuildDirectory)/s'
    Contents: '**/*'
- task: DeleteFiles@1
  displayName: 'Cleanup Staging Area'
  inputs:
    SourceFolder: '$(Build.ArtifactStagingDirectory)'
    Contents: '/**/*'
    RemoveDotFiles: true
