-
Notifications
You must be signed in to change notification settings - Fork 173
174 lines (150 loc) · 6 KB
/
install-script-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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
}