Skip to content

Expose a static only Go modules tactic. (#1486) #5055

Expose a static only Go modules tactic. (#1486)

Expose a static only Go modules tactic. (#1486) #5055

name: Test Installation Scripts
on: push
jobs:
test-nix:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12]
steps:
- uses: actions/checkout@v4
- name: install script performs installation
shell: bash
run: |
./install.sh -b .
./fossa --version
rm fossa
- name: install latest script performs installation
shell: bash
run: |
./install-latest.sh -b .
./fossa --version
rm fossa
- name: install latest script can install a specific version
shell: bash
run: |
# 3.4.7 is the first version with linux tarballs
./install-latest.sh -b . v3.4.7
./fossa --version | grep -q "3.4.7"
rm fossa
- name: install latest script can install version before linux was distributed with tarballs
shell: bash
run: |
./install-latest.sh -b . v3.1.1
./fossa --version | grep -q "3.1.1"
rm fossa
- name: install-v1 script does not install v2 or greater version
shell: bash
run: |
./install-v1.sh -b .
./fossa --version | cut -d " " -f 3 | head -c 1 | grep -q '1' || exit 1
# Refer to: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/f/fossa.rb
- name: brew install and uninstall
shell: bash
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew update
brew install --cask fossa
fossa --version
brew uninstall fossa
# These are run separately from the Matrix above because:
# 1. There is no Mac ARM fossa v1.
# 2. Earlier versions of cli v3 did not have ARM releases.
test-macos-arm:
runs-on: "macos-latest"
steps:
- uses: actions/checkout@v4
- name: install latest script can install a specific version
shell: bash
run: |
# 3.9.19 is the first version with native Mac ARM builds.
./install-latest.sh -b . v3.9.19
./fossa --version | grep -q "3.9.19"
rm fossa
- name: install latest script performs installation
shell: bash
run: |
./install-latest.sh -b .
./fossa --version
rm fossa
test-windows:
runs-on: "windows-latest"
steps:
- uses: actions/checkout@v4
- name: get latest release version from github
shell: pwsh
run: |
Write-Host $Env:GITHUB_REF
$headers = @{
'Accept' = 'application/json';
'Cache-Control' = 'no-cache'
}
$release = Invoke-RestMethod -Uri "https://github.com/fossas/fossa-cli/releases/latest" -Method Get -Headers $headers
$releaseVersion = $release.tag_name;
$releaseVersionSemver = $releaseVersion.TrimStart("v");
echo "LATEST_RELEASE_VERSION=$releaseVersionSemver" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: install script performs installation for v1
shell: pwsh
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
.\install.ps1
$cliVersionCmdOutput = cmd /c 'C:\ProgramData\fossa-cli\fossa.exe' '--version'
$cliVersion = $cliVersionCmdOutput.Split(" ")[2]
$cliVersionMajor = $cliVersion.Split(".")[0]
if (-Not $cliVersionMajor -eq "1") {
Write-Output "Got: $cliVersionMajor instead!"
exit 1
}
- name: install latest script performs installation
shell: pwsh
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
.\install-latest.ps1
$cliVersionCmdOutput = cmd /c 'fossa.exe' '--version'
$cliVersion = $cliVersionCmdOutput.Split(" ")[2]
$cliVersionMajor = $cliVersion.Split(".")[0]
if ($cliVersionMajor -eq "1") {
Write-Output "Got: $cliVersionMajor instead!"
exit 1
}
# Remove fossa.exe
Remove-Item -Path (Get-Command "fossa.exe").Path
- name: scoop installs latest version
shell: pwsh
run: |
# Get Scoop
# We are installing scoop as admin for workaround, to:
# https://github.com/fossas/fossa-cli/runs/5503534701?check_suite_focus=true
#
# Error:
# Running the installer as administrator is disabled by default, use -RunAsAdmin parameter if you know what you are doing.
#
# Note, github's windows hosted runners by default use admin user without UAC.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
iwr -useb 'https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1' -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
# Use Scoop to install fossa
# Reference: https://github.com/ScoopInstaller/Main/pull/2778/files
scoop install fossa
# Scoop does not update it's registry at once
# Sometimes latest release are not picked by scoop!
# ------------------------------------------------
#
# $cliVersionCmdOutput = cmd /c 'fossa.exe' '--version'
# $cliVersion = $cliVersionCmdOutput.Split(" ")[2]
# if ($cliVersion -ne $env:LATEST_RELEASE_VERSION) {
# Write-Output "Latest version is $env:LATEST_RELEASE_VERSION but installed $cliVersion instead!"
# exit 1
# }
- name: install-v1 script does not install v2 or greater version
shell: pwsh
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
.\install-v1.ps1
$cliVersionCmdOutput = cmd /c 'C:\ProgramData\fossa-cli\fossa.exe' '--version'
$cliVersion = $cliVersionCmdOutput.Split(" ")[2]
$cliVersionMajor = $cliVersion.Split(".")[0]
if (-Not $cliVersionMajor -eq "1") {
Write-Output "Got: $cliVersionMajor instead!"
exit 1
}