From 6471b3f8d4299a0a3b0b700ab9e6727219114697 Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Mon, 1 Feb 2021 13:55:01 +1000 Subject: [PATCH] Address PR comments Also changed the format of the install command. Piping the command to pwsh disables all interactivity which triggers crashes when interactive prompts occur (e.g. for when previous install overwrites happen) --- .github/workflows/docs.yml | 4 +-- .github/workflows/installer.yml | 46 ++++++++++++++++++++++----------- build/ci.ps1 | 2 +- build/log.ps1 | 6 ++--- build/publish_docs.ps1 | 2 +- docs/basics/installing.md | 25 +++++++++--------- 6 files changed, 50 insertions(+), 35 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 39c7fd5aa..3eb17f04c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -33,8 +33,8 @@ jobs: # fetch more tag info so git_version.ps1 works properly - name: Ensure tags are fetched - run: | - git fetch --tags --force # Retrieve annotated tags. + # Retrieve annotated tags. + run: git fetch --tags --force # disabled due to bug in docfx that leads to a stack overflow # also disabled in generate_docs.ps1 diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index a09fb5194..35c49952a 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -35,17 +35,26 @@ jobs: fail-fast: false matrix: os: + # https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources - windows-latest - - ubuntu-latest - - macos-latest + - ubuntu-18.04 + - ubuntu-20.04 + - macos-11.0 + - macos-10.15 include: - os: windows-latest alias_name: "AP.exe" bin_dir: "~\\AP" - - os: ubuntu-latest + - os: ubuntu-18.04 alias_name: "AP" bin_dir: "~/.local/bin" - - os: macos-latest + - os: ubuntu-20.04 + alias_name: "AP" + bin_dir: "~/.local/bin" + - os: macos-11.0 + alias_name: "AP" + bin_dir: "~/.local/bin" + - os: macos-10.15 alias_name: "AP" bin_dir: "~/.local/bin" # https://raw.githubusercontent.com/QutEcoacoustics/audio-analysis/5f08faa96d8f044fb278b68f1c7d577fe218e8a1/build/download_ap.ps1 @@ -62,26 +71,30 @@ jobs: # https://github.com/PowerShell/PowerShell/issues/3337 steps: - name: Get info about action runner - run: | - $PSVersionTable + run: $PSVersionTable + + # must use -Force on CI to suppress interactive steps + # otherwise interactive steps will crash (e.g. when warning on install overwrite) - name: Test installer (remote download) uses: knicknic/os-specific-run@v1.0.3 with: macos: > - echo '$function:i=irm "$env:SCRIPT_URL";i -Force' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "$env:SCRIPT_URL";i -Force' linux: > - echo '$function:i=irm "$env:SCRIPT_URL";i -Force' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "$env:SCRIPT_URL";i -Force' windows: > - '$function:i=irm "$env:SCRIPT_URL";i -Force' | pwsh -nop -ex B -c - + pwsh -nop -ex B -c '$function:i=irm "$env:SCRIPT_URL";i -Force' + - name: Test installer (upgrade) uses: knicknic/os-specific-run@v1.0.3 with: macos: > - echo '$function:i=irm "$env:SCRIPT_URL";i -Force -Prerelease' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "$env:SCRIPT_URL";i -Force -Prerelease' linux: > - echo '$function:i=irm "$env:SCRIPT_URL";i -Force -Prerelease' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "$env:SCRIPT_URL";i -Force -Prerelease' windows: > - '$function:i=irm "$env:SCRIPT_URL";i -Force -Prerelease' | pwsh -nop -ex B -c - + pwsh -nop -ex B -c '$function:i=irm "$env:SCRIPT_URL";i -Force -Prerelease' + - name: Update PATH # Github actions doesn't persist changes to PATH during steps # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path @@ -89,6 +102,7 @@ jobs: echo "$env:AP_PATH" | Resolve-Path | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append env: AP_PATH: ${{ matrix.bin_dir }} + - name: Check alias works run: | Get-ChildItem "$env:AP_PATH/$env:ALIAS_NAME" @@ -96,15 +110,17 @@ jobs: env: AP_PATH: ${{ matrix.bin_dir }} ALIAS_NAME: ${{ matrix.alias_name }} + - name: Test installer (uninstall) uses: knicknic/os-specific-run@v1.0.3 with: macos: > - echo '$function:i=irm "$env:SCRIPT_URL";i -Force -Uninstall' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "$env:SCRIPT_URL";i -Force -Uninstall' linux: > - echo '$function:i=irm "$env:SCRIPT_URL";i -Force -Uninstall' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "$env:SCRIPT_URL";i -Force -Uninstall' windows: > - '$function:i=irm "$env:SCRIPT_URL";i -Force -Uninstall' | pwsh -nop -ex B -c - + pwsh -nop -ex B -c '$function:i=irm "$env:SCRIPT_URL";i -Force -Uninstall' + - name: Check alias no longer works run: | Get-Command AP -ErrorAction 'Continue' diff --git a/build/ci.ps1 b/build/ci.ps1 index 16e5c4c6b..58ac65ef2 100644 --- a/build/ci.ps1 +++ b/build/ci.ps1 @@ -1,6 +1,6 @@ -function is_CI() { +function Test-CI() { $env:CI -eq "true" } diff --git a/build/log.ps1 b/build/log.ps1 index b20f4533b..9f5a893a1 100644 --- a/build/log.ps1 +++ b/build/log.ps1 @@ -18,7 +18,7 @@ function script:log { # * - anything else, new group if ($section -ne "") { # reset group - if ((is_CI) -and $null -ne $script:current_section) { + if ((Test-CI) -and $null -ne $script:current_section) { Write-Output "::endgroup::" } @@ -26,7 +26,7 @@ function script:log { $script:current_section = $section # if starting a new group - if ($null -ne $section -and (is_CI)) { + if ($null -ne $section -and (Test-CI)) { # emit new section Write-Output "::group::$script:current_section" } @@ -41,7 +41,7 @@ function script:finish_log { param() $script:current_section = $null - if ((is_CI)) { + if ((Test-CI)) { Write-Output "::endgroup::" } } \ No newline at end of file diff --git a/build/publish_docs.ps1 b/build/publish_docs.ps1 index dc366e4d1..1ea9d8ab0 100644 --- a/build/publish_docs.ps1 +++ b/build/publish_docs.ps1 @@ -23,7 +23,7 @@ if ($l -eq 0) { } $commit_hash = git show -s --format="%H" -log "Sstart deploy" "Deploy" +log "Start deploy" "Deploy" try { Push-Location Set-Location "$PSScriptRoot/../_site" diff --git a/docs/basics/installing.md b/docs/basics/installing.md index 9a18df1b9..d0f7fb080 100644 --- a/docs/basics/installing.md +++ b/docs/basics/installing.md @@ -35,13 +35,13 @@ The automatic install will download AP.exe and may install required perquisites. Run the following command in an elevated (_Run as Administrator_) prompt: ```powershell -'$function:i=irm "https://git.io/JtOo3";i' | pwsh -nop -ex B -c - + pwsh -nop -ex B -c '$function:i=irm "https://git.io/JtOo3";i' ``` Or, to install the prerelease version: ```powershell -'$function:i=irm "https://git.io/JtOo3";i -Pre' | pwsh -nop -ex B -c - + pwsh -nop -ex B -c '$function:i=irm "https://git.io/JtOo3";i -Pre' ``` ### [Linux install](#tab/linux) @@ -49,13 +49,13 @@ Or, to install the prerelease version: Run the following command: ```bash -echo '$function:i=irm "https://git.io/JtOo3";i' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "https://git.io/JtOo3";i' ``` Or, to install the prerelease version: ```bash -echo '$function:i=irm "https://git.io/JtOo3";i -Pre' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "https://git.io/JtOo3";i -Pre' ``` ### [MacOSX install](#tab/osx) @@ -63,19 +63,19 @@ echo '$function:i=irm "https://git.io/JtOo3";i -Pre' | pwsh -nop -c - Run the following command in _Terminal_: ```bash -echo '$function:i=irm "https://git.io/JtOo3";i' | sudo pwsh -nop -c - + pwsh -nop -c '$function:i=irm "https://git.io/JtOo3";i' ``` Or, to install the prerelease version: ```bash -echo '$function:i=irm "https://git.io/JtOo3";i -Pre' | sudo pwsh -nop -c - + pwsh -nop -c '$function:i=irm "https://git.io/JtOo3";i -Pre' ``` *** > [!NOTE] -> Please inspect which should point to +> Please inspect which should point to > > prior to running these commands. > @@ -96,7 +96,7 @@ If you used our automatic install you can use the same script to uninstall: Run the following command in an elevated (_Run as Administrator_) prompt: ```powershell -'$function:i=irm "https://git.io/JtOo3";i -Un' | pwsh -nop -ex B -c - + pwsh -nop -ex B -c '$function:i=irm "https://git.io/JtOo3";i -Un' ``` ### [Linux uninstall](#tab/linux) @@ -104,7 +104,7 @@ Run the following command in an elevated (_Run as Administrator_) prompt: Run the following command: ```bash -echo '$function:i=irm "https://git.io/JtOo3";i -Un' | pwsh -nop -c - + pwsh -nop -c '$function:i=irm "https://git.io/JtOo3";i -Un' ``` ### [MacOSX uninstall](#tab/osx) @@ -112,7 +112,7 @@ echo '$function:i=irm "https://git.io/JtOo3";i -Un' | pwsh -nop -c - Run the following command in _Terminal_: ```bash -echo '$function:i=irm "https://git.io/JtOo3";i -Un' | sudo pwsh -nop -c - + pwsh -nop -c '$function:i=irm "https://git.io/JtOo3";i -Un' ``` ## Manual Install @@ -176,7 +176,6 @@ The following additional dependencies may be required for Linux/Unix machines: - libsox-fmt-all, sox - libav-tools (on some distros only, not needed in Ubuntu 18) - ## Build Packages There are two variants of AP.exe: @@ -187,5 +186,5 @@ There are two variants of AP.exe: features and bug fixes than the stable release but it also could have more bugs. -You should use the **Stable** release unless there is a specific feature or bug -you need. +You should use the **Stable** release unless there is a recent +feature implemented or bug fix in the prerelease version that you need.