Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 24 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,37 @@ jobs:
run: go tool golangci-lint run --timeout=5m
- name: Unit Tests
run: make test
- name: Install Tests
run: make test-install
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.out
fail_ci_if_error: false

install-tests:
name: Install Tests
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Tests (Unix)
if: runner.os != 'Windows'
run: make test-install
- name: Install Tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: ./scripts/install-windows-test.ps1

# Monitor code coverage and TODO/FIXME-type comments
health-score:
name: Health Score
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-windows-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function install_slack_cli {
$slack_cli_new_binary_path = "$($slack_cli_dir)\bin\${confirmed_alias}.exe"

delay 0.3 "Extracting the executable to:`n $slack_cli_new_binary_path"
Expand-Archive "$($slack_cli_dir)\slack_cli.zip" -DestinationPath "$($slack_cli_dir)" -Force
Microsoft.PowerShell.Archive\Expand-Archive "$($slack_cli_dir)\slack_cli.zip" -DestinationPath "$($slack_cli_dir)" -Force

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🌟 praise: Thanks for making this step more stable!

Move-Item -Path $slack_cli_binary_path -Destination $slack_cli_new_binary_path -Force

$User = [System.EnvironmentVariableTarget]::User
Expand Down
54 changes: 54 additions & 0 deletions scripts/install-windows-test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2022-2026 Salesforce, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

$ErrorActionPreference = "Stop"

$qualifiedCommand = "Microsoft.PowerShell.Archive\Expand-Archive" # https://github.com/slackapi/slack-cli/issues/651

$installers = @(
"install-windows.ps1",
"install-windows-dev.ps1"
)

foreach ($name in $installers) {
$installer = Join-Path $PSScriptRoot $name

$tokens = $null
$parseErrors = $null
$ast = [System.Management.Automation.Language.Parser]::ParseFile(
$installer,
[ref]$tokens,
[ref]$parseErrors
)

if ($parseErrors.Count -gt 0) {
throw "PowerShell parser errors in $installer"
}

$archiveCommands = $ast.FindAll({
param($node)
$node -is [System.Management.Automation.Language.CommandAst] -and
$node.GetCommandName() -like "*Expand-Archive"
}, $true)

if ($archiveCommands.Count -lt 1) {
throw "$installer calls no Expand-Archive; expected $qualifiedCommand (issue #651)"
}
$unqualified = $archiveCommands | Where-Object { $_.GetCommandName() -ne $qualifiedCommand }
if ($unqualified) {
throw "$installer must call $qualifiedCommand (found unqualified Expand-Archive; issue #651)"
}

Write-Host "$name calls $qualifiedCommand ($($archiveCommands.Count)x), all qualified (issue #651 guard passed)"
}
2 changes: 1 addition & 1 deletion scripts/install-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function install_slack_cli {
$slack_cli_new_binary_path = "$($slack_cli_dir)\bin\${confirmed_alias}.exe"

delay 0.3 "Extracting the executable to:`n $slack_cli_new_binary_path"
Expand-Archive "$($slack_cli_dir)\slack_cli.zip" -DestinationPath "$($slack_cli_dir)" -Force
Microsoft.PowerShell.Archive\Expand-Archive "$($slack_cli_dir)\slack_cli.zip" -DestinationPath "$($slack_cli_dir)" -Force
Move-Item -Path $slack_cli_binary_path -Destination $slack_cli_new_binary_path -Force

$User = [System.EnvironmentVariableTarget]::User
Expand Down
Loading