Skip to content

build(deps): bump actions/setup-python from 6.2.0 to 6.3.0 in the github-actions group #95

build(deps): bump actions/setup-python from 6.2.0 to 6.3.0 in the github-actions group

build(deps): bump actions/setup-python from 6.2.0 to 6.3.0 in the github-actions group #95

Workflow file for this run

name: Test
permissions:
contents: read
on:
pull_request:
branches:
- main
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
static-validation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Validate Action Metadata and Shell
shell: bash
run: |
set -euo pipefail
python3 <<'PY'
from pathlib import Path
import subprocess
expected_checkout = "uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0"
workflows = sorted(Path(".github/workflows").glob("*.yml"))
workflows.extend(sorted(Path(".github/workflows").glob("*.yaml")))
for workflow in workflows:
workflow_text = workflow.read_text(encoding="utf-8")
for line_number, line in enumerate(workflow_text.splitlines(), start=1):
stripped = line.strip()
if stripped.startswith("uses: actions/checkout@") and expected_checkout not in stripped:
raise SystemExit(f"Unpinned or stale checkout reference at {workflow}:{line_number}: {line.strip()}")
action_text = Path("action.yml").read_text(encoding="utf-8")
disallowed_temp_paths = (
"/tmp/component_flags.env",
"/tmp/progress.sh",
"/tmp/total_ops",
"/tmp/completed_ops",
)
for token in disallowed_temp_paths:
if token in action_text:
raise SystemExit(f"Found fixed temp state path in action.yml: {token}")
def extract_run_blocks(path):
lines = path.read_text(encoding="utf-8").splitlines()
index = 0
while index < len(lines):
line = lines[index]
stripped = line.lstrip()
indent = len(line) - len(stripped)
if stripped == "run: |":
index += 1
content_indent = indent + 2
block = []
while index < len(lines):
candidate = lines[index]
if candidate.strip():
candidate_indent = len(candidate) - len(candidate.lstrip())
if candidate_indent <= indent:
break
block.append(candidate[content_indent:])
else:
block.append("")
index += 1
yield "\n".join(block) + "\n"
continue
index += 1
checked = 0
for checked, script in enumerate(extract_run_blocks(Path("action.yml")), start=1):
result = subprocess.run(["bash", "-n"], input=script, text=True, capture_output=True, check=False)
if result.returncode != 0:
raise SystemExit(f"action.yml run block {checked} failed bash -n:\n{result.stderr}")
if checked == 0:
raise SystemExit("No action.yml run blocks were found")
print(f"Validated {checked} action.yml run blocks.")
PY
default-max:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Max Profile Test
uses: ./
no-op-custom:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Capture Initial Swapfile State
shell: bash
run: |
set -euo pipefail
if [ -f "/mnt/swapfile" ]; then
echo "INITIAL_SWAPFILE_PRESENT=1" >> "$GITHUB_ENV"
echo "INITIAL_SWAPFILE_BYTES=$(stat -c %s /mnt/swapfile)" >> "$GITHUB_ENV"
else
echo "INITIAL_SWAPFILE_PRESENT=0" >> "$GITHUB_ENV"
echo "INITIAL_SWAPFILE_BYTES=0" >> "$GITHUB_ENV"
fi
if swapon --show=NAME --noheadings | awk '{print $1}' | grep -Fxq '/mnt/swapfile'; then
echo "INITIAL_SWAPFILE_ACTIVE=1" >> "$GITHUB_ENV"
else
echo "INITIAL_SWAPFILE_ACTIVE=0" >> "$GITHUB_ENV"
fi
- name: Custom Profile Test, with No Toggles
uses: ./
with:
cleanup-profile: custom
- name: Verify Swapfile Left Untouched
shell: bash
run: |
set -euo pipefail
if [ -f "/mnt/swapfile" ]; then
current_present=1
current_bytes=$(stat -c %s /mnt/swapfile)
else
current_present=0
current_bytes=0
fi
if swapon --show=NAME --noheadings | awk '{print $1}' | grep -Fxq '/mnt/swapfile'; then
current_active=1
else
current_active=0
fi
if [ "$current_present" != "$INITIAL_SWAPFILE_PRESENT" ] || \
[ "$current_bytes" != "$INITIAL_SWAPFILE_BYTES" ] || \
[ "$current_active" != "$INITIAL_SWAPFILE_ACTIVE" ]; then
echo "Expected swapfile state to remain unchanged when swapfile-size is omitted. Initial: present=${INITIAL_SWAPFILE_PRESENT}, bytes=${INITIAL_SWAPFILE_BYTES}, active=${INITIAL_SWAPFILE_ACTIVE}. Current: present=${current_present}, bytes=${current_bytes}, active=${current_active}."
exit 1
fi
max-with-skip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Capture Pre-Action State
shell: bash
run: |
set -euo pipefail
if [ -d "/usr/share/dotnet" ]; then
echo "DOTNET_PRE=1" >> "$GITHUB_ENV"
else
echo "DOTNET_PRE=0" >> "$GITHUB_ENV"
fi
if [ -d "/usr/local/lib/android" ]; then
echo "ANDROID_PRE=1" >> "$GITHUB_ENV"
else
echo "ANDROID_PRE=0" >> "$GITHUB_ENV"
fi
- name: Max Profile Test, with Skips
uses: ./
with:
cleanup-profile: " MaX "
skip-components: " DotNet , Android "
- name: Verify Post-Action State
shell: bash
run: |
set -euo pipefail
if [ "${DOTNET_PRE}" = "1" ] && [ ! -d "/usr/share/dotnet" ]; then
echo '.NET should have been skipped but is missing'
exit 1
fi
if [ "${ANDROID_PRE}" = "1" ] && [ ! -d "/usr/local/lib/android" ]; then
echo 'Android should have been skipped but is missing'
exit 1
fi
max-skip-cached-node-precedence:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Capture Pre-Action Toolcache State
shell: bash
run: |
set -euo pipefail
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
echo "TOOLS_DIR=${tools_dir}" >> "$GITHUB_ENV"
if [ -d "${tools_dir}/node" ] || [ -d "${tools_dir}/Node" ]; then
echo "NODE_CACHE_PRE=1" >> "$GITHUB_ENV"
else
echo "NODE_CACHE_PRE=0" >> "$GITHUB_ENV"
fi
if [ -d "${tools_dir}/Python" ] || [ -d "${tools_dir}/python" ]; then
echo "PYTHON_CACHE_PRE=1" >> "$GITHUB_ENV"
else
echo "PYTHON_CACHE_PRE=0" >> "$GITHUB_ENV"
fi
- name: Max Profile Skip Cached Node
uses: ./
with:
cleanup-profile: max
skip-components: " CACHED-Node "
- name: Verify Cached Node Is Kept But Cached Python Can Be Removed
shell: bash
run: |
set -euo pipefail
if [ "${NODE_CACHE_PRE}" = "1" ] && [ ! -d "${TOOLS_DIR}/node" ] && [ ! -d "${TOOLS_DIR}/Node" ]; then
echo 'Node toolcache should have been skipped but is missing'
exit 1
fi
if [ "${PYTHON_CACHE_PRE}" = "1" ] && { [ -d "${TOOLS_DIR}/Python" ] || [ -d "${TOOLS_DIR}/python" ]; }; then
echo 'Python toolcache should have been removed when only cached-node is skipped'
exit 1
fi
max-skip-firefox-precedence:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Capture Pre-Action Browser State
shell: bash
run: |
set -euo pipefail
if command -v firefox >/dev/null 2>&1; then
echo "FIREFOX_PRE=1" >> "$GITHUB_ENV"
else
echo "FIREFOX_PRE=0" >> "$GITHUB_ENV"
fi
if command -v google-chrome >/dev/null 2>&1 || command -v google-chrome-stable >/dev/null 2>&1; then
echo "CHROME_PRE=1" >> "$GITHUB_ENV"
else
echo "CHROME_PRE=0" >> "$GITHUB_ENV"
fi
- name: Max Profile Skip Firefox
uses: ./
with:
cleanup-profile: max
skip-components: " FireFox , LARGE-Packages "
- name: Verify Firefox Is Kept But Chrome Can Be Removed
shell: bash
run: |
set -euo pipefail
if [ "${FIREFOX_PRE}" = "1" ] && ! command -v firefox >/dev/null 2>&1; then
echo 'Firefox should have been skipped but is missing'
exit 1
fi
if [ "${CHROME_PRE}" = "1" ] && { command -v google-chrome >/dev/null 2>&1 || command -v google-chrome-stable >/dev/null 2>&1; }; then
echo 'Chrome should have been removed when only firefox is skipped'
exit 1
fi
custom-grouped-subgroup-precedence:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Capture Pre-Action Browser State
shell: bash
run: |
set -euo pipefail
if command -v firefox >/dev/null 2>&1; then
echo "FIREFOX_PRE=1" >> "$GITHUB_ENV"
else
echo "FIREFOX_PRE=0" >> "$GITHUB_ENV"
fi
if command -v google-chrome >/dev/null 2>&1 || command -v google-chrome-stable >/dev/null 2>&1; then
echo "CHROME_PRE=1" >> "$GITHUB_ENV"
else
echo "CHROME_PRE=0" >> "$GITHUB_ENV"
fi
- name: Custom Profile Grouped + Subgroup Browsers
uses: ./
with:
cleanup-profile: custom
remove-browsers: "true"
remove-firefox: "true"
- name: Verify Grouped Browser Removal Takes Precedence
shell: bash
run: |
set -euo pipefail
if [ "${FIREFOX_PRE}" = "1" ] && command -v firefox >/dev/null 2>&1; then
echo 'Firefox should be removed when grouped browser cleanup is enabled'
exit 1
fi
if [ "${CHROME_PRE}" = "1" ] && { command -v google-chrome >/dev/null 2>&1 || command -v google-chrome-stable >/dev/null 2>&1; }; then
echo 'Chrome should be removed when grouped browser cleanup is enabled'
exit 1
fi
invalid-input-validation:
runs-on: ubuntu-latest
strategy:
matrix:
scenario:
- name: invalid-cleanup-profile
cleanup_profile: invalid-profile
skip_components: ""
- name: invalid-skip-components
cleanup_profile: max
skip_components: not-a-real-component
- name: mixed-valid-invalid-skip-components
cleanup_profile: max
skip_components: dotnet,not-a-real-component
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Run Action with Invalid Inputs
id: invalid_input_run
continue-on-error: true
uses: ./
with:
cleanup-profile: ${{ matrix.scenario.cleanup_profile }}
skip-components: ${{ matrix.scenario.skip_components }}
- name: Verify Invalid Inputs Fail Early
shell: bash
run: |
set -euo pipefail
if [ "${{ steps.invalid_input_run.outcome }}" != "failure" ]; then
echo "Expected scenario '${{ matrix.scenario.name }}' to fail validation."
exit 1
fi
swapfile-resize:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Resize Swapfile
uses: ./
with:
cleanup-profile: custom
swapfile-size: 1.5GiB
- name: Verify Resized Swapfile
shell: bash
run: |
set -euo pipefail
if [ ! -f "/mnt/swapfile" ]; then
echo 'Expected /mnt/swapfile to be created'
exit 1
fi
swap_bytes=$(stat -c %s /mnt/swapfile)
if [ "$swap_bytes" -ne $((3 * 1024 * 1024 * 1024 / 2)) ]; then
echo "Expected /mnt/swapfile to be 1.5 GiB, got ${swap_bytes} bytes"
exit 1
fi
if ! swapon --show=NAME --noheadings | awk '{print $1}' | grep -Fxq '/mnt/swapfile'; then
echo 'Expected /mnt/swapfile to be active swap'
exit 1
fi
swapfile-remove:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Remove Swapfile via Size Input
uses: ./
with:
cleanup-profile: custom
swapfile-size: 0
- name: Verify Swapfile Removal
shell: bash
run: |
set -euo pipefail
if [ -f "/mnt/swapfile" ] || swapon --show | grep -q '/mnt/swapfile'; then
echo 'Swapfile was not removed by swapfile-size=0'
exit 1
fi
swapfile-oversize:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Capture Initial Swapfile State
shell: bash
run: |
set -euo pipefail
if [ -f "/mnt/swapfile" ]; then
echo "INITIAL_SWAPFILE_PRESENT=1" >> "$GITHUB_ENV"
echo "INITIAL_SWAPFILE_BYTES=$(stat -c %s /mnt/swapfile)" >> "$GITHUB_ENV"
else
echo "INITIAL_SWAPFILE_PRESENT=0" >> "$GITHUB_ENV"
echo "INITIAL_SWAPFILE_BYTES=0" >> "$GITHUB_ENV"
fi
if swapon --show=NAME --noheadings | awk '{print $1}' | grep -Fxq '/mnt/swapfile'; then
echo "INITIAL_SWAPFILE_ACTIVE=1" >> "$GITHUB_ENV"
else
echo "INITIAL_SWAPFILE_ACTIVE=0" >> "$GITHUB_ENV"
fi
- name: Request Oversized Swapfile
id: oversized_swap
continue-on-error: true
uses: ./
with:
cleanup-profile: custom
swapfile-size: 1000TiB
- name: Verify Oversized Request Fails And Keeps Existing Swapfile
shell: bash
run: |
set -euo pipefail
if [ "${{ steps.oversized_swap.outcome }}" != "failure" ]; then
echo 'Expected oversized swapfile request to fail'
exit 1
fi
if [ -f "/mnt/swapfile" ]; then
current_present=1
current_bytes=$(stat -c %s /mnt/swapfile)
else
current_present=0
current_bytes=0
fi
if swapon --show=NAME --noheadings | awk '{print $1}' | grep -Fxq '/mnt/swapfile'; then
current_active=1
else
current_active=0
fi
if [ "$current_present" != "$INITIAL_SWAPFILE_PRESENT" ] || \
[ "$current_bytes" != "$INITIAL_SWAPFILE_BYTES" ] || \
[ "$current_active" != "$INITIAL_SWAPFILE_ACTIVE" ]; then
echo "Expected oversized swapfile request to keep the initial swap state. Initial: present=${INITIAL_SWAPFILE_PRESENT}, bytes=${INITIAL_SWAPFILE_BYTES}, active=${INITIAL_SWAPFILE_ACTIVE}. Current: present=${current_present}, bytes=${current_bytes}, active=${current_active}."
exit 1
fi
test:
runs-on: ubuntu-latest
strategy:
matrix:
option:
- remove-dotnet
- remove-android
- remove-haskell
- remove-codeql
- remove-docker-images
- remove-large-packages
- remove-cached-tools
- remove-cached-go
- remove-cached-node
- remove-cached-python
- remove-cached-pypy
- remove-cached-ruby
- remove-swift
- remove-julia
- remove-java
- remove-browsers
- remove-chrome
- remove-chromium
- remove-edge
- remove-firefox
- remove-webdrivers
- remove-selenium
- remove-powershell
- remove-miniconda
- remove-homebrew
- remove-vcpkg
- remove-aws-cli
- remove-aws-sam-cli
- remove-azure-cli
- remove-gh-cli
- remove-gcloud-cli
- remove-azcopy
- remove-kubectl
- remove-helm
- remove-kind
- remove-minikube
- remove-kustomize
- remove-docker-engine
- remove-buildah
- remove-podman
- remove-maven
- remove-gradle
- remove-ant
- remove-php
- remove-rust
- remove-postgresql
- remove-mysql
- remove-apache
- remove-nginx
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Custom Profile Test, with Various Toggles
uses: ./
with:
cleanup-profile: custom
remove-dotnet: ${{ matrix.option == 'remove-dotnet' && 'true' || 'false' }}
remove-android: ${{ matrix.option == 'remove-android' && 'true' || 'false' }}
remove-haskell: ${{ matrix.option == 'remove-haskell' && 'true' || 'false' }}
remove-codeql: ${{ matrix.option == 'remove-codeql' && 'true' || 'false' }}
remove-docker-images: ${{ matrix.option == 'remove-docker-images' && 'true' || 'false' }}
remove-large-packages: ${{ matrix.option == 'remove-large-packages' && 'true' || 'false' }}
remove-cached-tools: ${{ matrix.option == 'remove-cached-tools' && 'true' || 'false' }}
remove-cached-go: ${{ matrix.option == 'remove-cached-go' && 'true' || 'false' }}
remove-cached-node: ${{ matrix.option == 'remove-cached-node' && 'true' || 'false' }}
remove-cached-python: ${{ matrix.option == 'remove-cached-python' && 'true' || 'false' }}
remove-cached-pypy: ${{ matrix.option == 'remove-cached-pypy' && 'true' || 'false' }}
remove-cached-ruby: ${{ matrix.option == 'remove-cached-ruby' && 'true' || 'false' }}
remove-swift: ${{ matrix.option == 'remove-swift' && 'true' || 'false' }}
remove-julia: ${{ matrix.option == 'remove-julia' && 'true' || 'false' }}
remove-java: ${{ matrix.option == 'remove-java' && 'true' || 'false' }}
remove-browsers: ${{ matrix.option == 'remove-browsers' && 'true' || 'false' }}
remove-chrome: ${{ matrix.option == 'remove-chrome' && 'true' || 'false' }}
remove-chromium: ${{ matrix.option == 'remove-chromium' && 'true' || 'false' }}
remove-edge: ${{ matrix.option == 'remove-edge' && 'true' || 'false' }}
remove-firefox: ${{ matrix.option == 'remove-firefox' && 'true' || 'false' }}
remove-webdrivers: ${{ matrix.option == 'remove-webdrivers' && 'true' || 'false' }}
remove-selenium: ${{ matrix.option == 'remove-selenium' && 'true' || 'false' }}
remove-powershell: ${{ matrix.option == 'remove-powershell' && 'true' || 'false' }}
remove-miniconda: ${{ matrix.option == 'remove-miniconda' && 'true' || 'false' }}
remove-homebrew: ${{ matrix.option == 'remove-homebrew' && 'true' || 'false' }}
remove-vcpkg: ${{ matrix.option == 'remove-vcpkg' && 'true' || 'false' }}
remove-aws-cli: ${{ matrix.option == 'remove-aws-cli' && 'true' || 'false' }}
remove-aws-sam-cli: ${{ matrix.option == 'remove-aws-sam-cli' && 'true' || 'false' }}
remove-azure-cli: ${{ matrix.option == 'remove-azure-cli' && 'true' || 'false' }}
remove-gh-cli: ${{ matrix.option == 'remove-gh-cli' && 'true' || 'false' }}
remove-gcloud-cli: ${{ matrix.option == 'remove-gcloud-cli' && 'true' || 'false' }}
remove-azcopy: ${{ matrix.option == 'remove-azcopy' && 'true' || 'false' }}
remove-kubectl: ${{ matrix.option == 'remove-kubectl' && 'true' || 'false' }}
remove-helm: ${{ matrix.option == 'remove-helm' && 'true' || 'false' }}
remove-kind: ${{ matrix.option == 'remove-kind' && 'true' || 'false' }}
remove-minikube: ${{ matrix.option == 'remove-minikube' && 'true' || 'false' }}
remove-kustomize: ${{ matrix.option == 'remove-kustomize' && 'true' || 'false' }}
remove-docker-engine: ${{ matrix.option == 'remove-docker-engine' && 'true' || 'false' }}
remove-buildah: ${{ matrix.option == 'remove-buildah' && 'true' || 'false' }}
remove-podman: ${{ matrix.option == 'remove-podman' && 'true' || 'false' }}
remove-maven: ${{ matrix.option == 'remove-maven' && 'true' || 'false' }}
remove-gradle: ${{ matrix.option == 'remove-gradle' && 'true' || 'false' }}
remove-ant: ${{ matrix.option == 'remove-ant' && 'true' || 'false' }}
remove-php: ${{ matrix.option == 'remove-php' && 'true' || 'false' }}
remove-rust: ${{ matrix.option == 'remove-rust' && 'true' || 'false' }}
remove-postgresql: ${{ matrix.option == 'remove-postgresql' && 'true' || 'false' }}
remove-mysql: ${{ matrix.option == 'remove-mysql' && 'true' || 'false' }}
remove-apache: ${{ matrix.option == 'remove-apache' && 'true' || 'false' }}
remove-nginx: ${{ matrix.option == 'remove-nginx' && 'true' || 'false' }}
- name: Verify Post-Action State
shell: bash
run: |
set -euo pipefail
case "${{ matrix.option }}" in
remove-dotnet)
if [ -d "/usr/share/dotnet" ]; then
echo '.NET was not removed'
exit 1
fi
;;
remove-android)
if [ -d "/usr/local/lib/android" ]; then
echo 'Android SDKs were not removed'
exit 1
fi
;;
remove-haskell)
if [ -d "/opt/ghc" ] || \
[ -d "/usr/local/.ghcup" ] || \
[ -d "/home/runner/.ghcup" ] || \
[ -d "/home/runner/.cabal" ] || \
[ -d "/home/runner/.stack" ] || \
command -v ghc >/dev/null 2>&1 || \
command -v ghcup >/dev/null 2>&1 || \
command -v cabal >/dev/null 2>&1 || \
command -v stack >/dev/null 2>&1; then
echo 'Haskell artifacts were not removed'
exit 1
fi
;;
remove-codeql)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir/CodeQL" ]; then
echo 'CodeQL bundles were not removed'
exit 1
fi
;;
remove-docker-images)
if [ "$(docker image ls -q | wc -l)" -gt 0 ]; then
echo 'Docker images were not removed'
exit 1
fi
;;
remove-large-packages)
if dpkg -l | grep -E 'azure-cli|google-cloud-sdk|google-cloud-cli|google-chrome-stable|microsoft-edge-stable|chromium|firefox|powershell'; then
echo 'Large packages were not removed'
exit 1
fi
;;
remove-cached-tools)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir" ] && [ "$(ls -A "$tools_dir")" != "" ]; then
echo 'Cached tools were not removed'
exit 1
fi
;;
remove-swift)
if [ -d "/usr/share/swift" ] || command -v swift >/dev/null 2>&1; then
echo 'Swift was not removed'
exit 1
fi
;;
remove-julia)
if [ -e "/usr/local/bin/julia" ] || command -v julia >/dev/null 2>&1; then
echo 'Julia was not removed'
exit 1
fi
;;
remove-java)
if command -v javac >/dev/null 2>&1; then
echo 'Java was not removed'
exit 1
fi
;;
remove-browsers)
if command -v google-chrome >/dev/null 2>&1 || \
command -v google-chrome-stable >/dev/null 2>&1 || \
command -v chromium >/dev/null 2>&1 || \
command -v chromium-browser >/dev/null 2>&1 || \
command -v microsoft-edge >/dev/null 2>&1 || \
command -v microsoft-edge-stable >/dev/null 2>&1 || \
command -v firefox >/dev/null 2>&1 || \
command -v chromedriver >/dev/null 2>&1 || \
command -v geckodriver >/dev/null 2>&1 || \
command -v msedgedriver >/dev/null 2>&1; then
echo 'Browsers were not removed'
exit 1
fi
;;
remove-powershell)
if command -v pwsh >/dev/null 2>&1; then
echo 'PowerShell was not removed'
exit 1
fi
;;
remove-miniconda)
conda_root="${CONDA:-/usr/share/miniconda}"
if [ -d "$conda_root" ]; then
echo 'Miniconda was not removed'
exit 1
fi
;;
remove-homebrew)
if [ -d "/home/linuxbrew" ]; then
echo 'Homebrew was not removed'
exit 1
fi
;;
remove-vcpkg)
if [ -d "/usr/local/share/vcpkg" ] || \
[ -d "/home/runner/.cache/vcpkg" ] || \
[ -d "/home/runner/.vcpkg" ] || \
command -v vcpkg >/dev/null 2>&1; then
echo 'vcpkg was not removed'
exit 1
fi
;;
remove-cached-go)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir/Go" ] || [ -d "$tools_dir/go" ]; then
echo 'Go toolcache was not removed'
exit 1
fi
;;
remove-cached-node)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir/node" ] || [ -d "$tools_dir/Node" ]; then
echo 'Node.js toolcache was not removed'
exit 1
fi
;;
remove-cached-python)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir/Python" ] || [ -d "$tools_dir/python" ]; then
echo 'Python toolcache was not removed'
exit 1
fi
;;
remove-cached-pypy)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir/PyPy" ] || [ -d "$tools_dir/pypy" ]; then
echo 'PyPy toolcache was not removed'
exit 1
fi
;;
remove-cached-ruby)
tools_dir="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
if [ -d "$tools_dir/Ruby" ] || [ -d "$tools_dir/ruby" ]; then
echo 'Ruby toolcache was not removed'
exit 1
fi
;;
remove-chrome)
if command -v google-chrome >/dev/null 2>&1 || \
command -v google-chrome-stable >/dev/null 2>&1; then
echo 'Chrome was not removed'
exit 1
fi
;;
remove-chromium)
if command -v chromium >/dev/null 2>&1 || \
command -v chromium-browser >/dev/null 2>&1 || \
{ dpkg-query -W -f='${Package} ${Status}\n' \
chromium chromium-browser chromium-codecs-ffmpeg-extra 2>/dev/null || true; } | \
grep -q 'install ok installed'; then
echo 'Chromium was not removed'
exit 1
fi
;;
remove-edge)
if command -v microsoft-edge >/dev/null 2>&1 || \
command -v microsoft-edge-stable >/dev/null 2>&1; then
echo 'Edge was not removed'
exit 1
fi
;;
remove-firefox)
if command -v firefox >/dev/null 2>&1; then
echo 'Firefox was not removed'
exit 1
fi
;;
remove-webdrivers)
if command -v chromedriver >/dev/null 2>&1 || \
command -v geckodriver >/dev/null 2>&1 || \
command -v msedgedriver >/dev/null 2>&1; then
echo 'Webdrivers were not removed'
exit 1
fi
;;
remove-selenium)
if [ -e "/usr/share/java/selenium-server.jar" ]; then
echo 'Selenium server was not removed'
exit 1
fi
;;
remove-aws-cli)
if command -v aws >/dev/null 2>&1 || \
command -v session-manager-plugin >/dev/null 2>&1 || \
[ -d "/usr/local/sessionmanagerplugin" ]; then
echo 'AWS CLI was not removed'
exit 1
fi
;;
remove-aws-sam-cli)
if command -v sam >/dev/null 2>&1; then
echo 'AWS SAM CLI was not removed'
exit 1
fi
;;
remove-azure-cli)
if command -v az >/dev/null 2>&1; then
echo 'Azure CLI was not removed'
exit 1
fi
;;
remove-gh-cli)
if command -v gh >/dev/null 2>&1; then
echo 'GitHub CLI was not removed'
exit 1
fi
;;
remove-gcloud-cli)
if command -v gcloud >/dev/null 2>&1 || \
command -v gsutil >/dev/null 2>&1 || \
command -v bq >/dev/null 2>&1; then
echo 'Google Cloud CLI was not removed'
exit 1
fi
;;
remove-azcopy)
if command -v azcopy >/dev/null 2>&1 || command -v azcopy10 >/dev/null 2>&1; then
echo 'AzCopy was not removed'
exit 1
fi
;;
remove-kubectl)
if command -v kubectl >/dev/null 2>&1; then
echo 'kubectl was not removed'
exit 1
fi
;;
remove-helm)
if command -v helm >/dev/null 2>&1; then
echo 'Helm was not removed'
exit 1
fi
;;
remove-kind)
if command -v kind >/dev/null 2>&1; then
echo 'kind was not removed'
exit 1
fi
;;
remove-minikube)
if command -v minikube >/dev/null 2>&1; then
echo 'Minikube was not removed'
exit 1
fi
;;
remove-kustomize)
if command -v kustomize >/dev/null 2>&1; then
echo 'Kustomize was not removed'
exit 1
fi
;;
remove-docker-engine)
if command -v docker >/dev/null 2>&1 || \
command -v docker-compose >/dev/null 2>&1 || \
command -v docker-buildx >/dev/null 2>&1 || \
command -v docker-credential-ecr-login >/dev/null 2>&1 || \
[ -d "/var/lib/docker" ] || \
[ -d "/var/lib/containerd" ] || \
[ -d "/etc/docker" ]; then
echo 'Docker Engine was not removed'
exit 1
fi
;;
remove-buildah)
if command -v buildah >/dev/null 2>&1; then
echo 'Buildah was not removed'
exit 1
fi
;;
remove-podman)
if command -v podman >/dev/null 2>&1; then
echo 'Podman was not removed'
exit 1
fi
;;
remove-maven)
if command -v mvn >/dev/null 2>&1; then
echo 'Maven was not removed'
exit 1
fi
;;
remove-gradle)
if command -v gradle >/dev/null 2>&1; then
echo 'Gradle was not removed'
exit 1
fi
;;
remove-ant)
if command -v ant >/dev/null 2>&1; then
echo 'Ant was not removed'
exit 1
fi
;;
remove-php)
if command -v php >/dev/null 2>&1 || command -v composer >/dev/null 2>&1; then
echo 'PHP tooling was not removed'
exit 1
fi
;;
remove-rust)
if command -v rustc >/dev/null 2>&1 || \
command -v cargo >/dev/null 2>&1 || \
command -v rustup >/dev/null 2>&1 || \
command -v rustdoc >/dev/null 2>&1 || \
command -v rustfmt >/dev/null 2>&1 || \
command -v cargo-clippy >/dev/null 2>&1 || \
command -v clippy-driver >/dev/null 2>&1; then
echo 'Rust toolchain was not removed'
exit 1
fi
;;
remove-postgresql)
if command -v psql >/dev/null 2>&1 || \
command -v pg_config >/dev/null 2>&1 || \
[ -d "/var/lib/postgresql" ] || \
[ -d "/etc/postgresql" ] || \
[ -d "/usr/lib/postgresql" ]; then
echo 'PostgreSQL was not removed'
exit 1
fi
;;
remove-mysql)
if command -v mysql >/dev/null 2>&1 || \
command -v mysqld >/dev/null 2>&1 || \
command -v mariadb >/dev/null 2>&1 || \
[ -d "/var/lib/mysql" ] || \
[ -d "/etc/mysql" ]; then
echo 'MySQL/MariaDB was not removed'
exit 1
fi
;;
remove-apache)
if command -v apache2 >/dev/null 2>&1 || [ -d "/etc/apache2" ]; then
echo 'Apache was not removed'
exit 1
fi
;;
remove-nginx)
if command -v nginx >/dev/null 2>&1 || [ -d "/etc/nginx" ]; then
echo 'Nginx was not removed'
exit 1
fi
;;
esac