Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 47 additions & 6 deletions .github/workflows/install-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ jobs:

- name: verify binary
run: |
# GitHub's runner images also ship Apache Ant, which is called `ant` too, so first check
# that `ant` resolves to npm's install.
npm_ant="$(npm prefix -g)/bin/ant"
if [ "$(command -v ant)" != "$npm_ant" ]; then
echo "ERROR: ant resolves to $(command -v ant), not npm's $npm_ant"
exit 1
fi
ant --help
echo "Binary runs successfully"

Expand All @@ -126,8 +133,10 @@ jobs:
- name: verify uninstall leaves the config directory
run: |
npm uninstall -g @withautonomi/ant
if command -v ant >/dev/null 2>&1; then
echo "ERROR: ant is still on PATH after uninstall"
# Only npm's own ant has to be gone: the runner image's Apache Ant is still on PATH.
npm_ant="$(npm prefix -g)/bin/ant"
if [ -e "$npm_ant" ] || [ -L "$npm_ant" ]; then
echo "ERROR: $npm_ant is still there after uninstall"
exit 1
fi
config_file="${XDG_CONFIG_HOME:-$HOME/.config}/ant/bootstrap_peers.toml"
Expand All @@ -150,6 +159,13 @@ jobs:

- name: verify binary
run: |
# GitHub's runner images also ship Apache Ant, which is called `ant` too, so first check
# that `ant` resolves to npm's install.
npm_ant="$(npm prefix -g)/bin/ant"
if [ "$(command -v ant)" != "$npm_ant" ]; then
echo "ERROR: ant resolves to $(command -v ant), not npm's $npm_ant"
exit 1
fi
ant --help
echo "Binary runs successfully"

Expand All @@ -166,6 +182,12 @@ jobs:
- name: verify uninstall leaves the config directory
run: |
npm uninstall -g @withautonomi/ant
# Only npm's own ant has to be gone: the runner image's Apache Ant is still on PATH.
npm_ant="$(npm prefix -g)/bin/ant"
if [ -e "$npm_ant" ] || [ -L "$npm_ant" ]; then
echo "ERROR: $npm_ant is still there after uninstall"
exit 1
fi
config_file="$HOME/Library/Application Support/ant/bootstrap_peers.toml"
if [ ! -f "$config_file" ]; then
echo "ERROR: uninstall removed $config_file, which it must leave alone"
Expand All @@ -188,6 +210,13 @@ jobs:
- name: verify binary
shell: pwsh
run: |
# Check that `ant` resolves to npm's install before running it (see the Linux job).
$npmPrefix = (npm prefix -g).Trim()
$antPath = (Get-Command ant).Source
if ((Split-Path $antPath) -ne $npmPrefix) {
Write-Error "ant resolves to $antPath, not npm's install in $npmPrefix"
exit 1
}
ant --help
Write-Host "Binary runs successfully"

Expand All @@ -206,6 +235,11 @@ jobs:
shell: pwsh
run: |
npm uninstall -g @withautonomi/ant
$npmPrefix = (npm prefix -g).Trim()
if (Test-Path (Join-Path $npmPrefix "ant.cmd")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ P2 — Windows uninstall check misses the PowerShell shim. This checks only ant.cmd. npm also installs ant.ps1, and PowerShell prioritizes that wrapper. If uninstall leaves ant.ps1 but removes ant.cmd, this test passes although the npm-installed ant command remains callable. Check that ant.ps1 is absent too (and any other shims produced by the supported npm version) before reporting the npm binary removed.

Write-Error "npm's ant.cmd is still in $npmPrefix after uninstall"
exit 1
}
$configFile = Join-Path $env:APPDATA "ant\bootstrap_peers.toml"
if (-not (Test-Path $configFile)) {
Write-Error "uninstall removed $configFile, which it must leave alone"
Expand All @@ -230,6 +264,13 @@ jobs:

- name: verify binary still runs
run: |
# GitHub's runner images also ship Apache Ant, which is called `ant` too, so first check
# that `ant` resolves to npm's install.
npm_ant="$(npm prefix -g)/bin/ant"
if [ "$(command -v ant)" != "$npm_ant" ]; then
echo "ERROR: ant resolves to $(command -v ant), not npm's $npm_ant"
exit 1
fi
ant --help
ant --version
echo "Binary runs successfully without postinstall"
Expand All @@ -249,12 +290,12 @@ jobs:
if echo "$output" | grep -qi "No bootstrap peers available"; then
echo "$output"
echo "ERROR: ant could not resolve bootstrap peers without a config file."
echo "The embedded fallback in ant-core/src/config.rs is not working."
echo "The bundled fallback in ant-core/src/config.rs is not working."
exit 1
fi
if ! echo "$output" | grep -q "embedded bootstrap peer"; then
if ! echo "$output" | grep -q "bundled bootstrap seed"; then
echo "$output"
echo "ERROR: expected ant to report using its embedded bootstrap peers."
echo "ERROR: expected ant to report using its bundled bootstrap seeds."
exit 1
fi
echo "Bootstrap peers resolved from the embedded list, with no config file present"
echo "Bootstrap peers resolved from the bundled seeds, with no config file present"
Loading