Skip to content

Commit d3e627c

Browse files
authored
Merge pull request #333 from hubblo-org/311-github-workflow-to-build-and-publish-a-exemsi-file-including-signed-rapl-driver-at-each-tagrelease
chore: new iss file to build exe package
2 parents 454fd3e + 23af286 commit d3e627c

14 files changed

+380
-122
lines changed

.github/bloat-test.yml

-31
This file was deleted.

.github/workflows/codesee-arch-diagram.yml

-87
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build exe installer for windows for prometheus-push only version
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs_src/**'
7+
- 'README.md'
8+
- 'CITATION'
9+
- 'book.toml'
10+
- 'CONTRIBUTING.md'
11+
tags: [ 'v*.*.*', 'dev*.*.*' ]
12+
branches: [ '311-github-workflow-to-build-and-publish-a-exemsi-file-including-signed-rapl-driver-at-each-tagrelease' ]
13+
14+
env:
15+
WRD_VERSION: v0.0.2
16+
WRD_BASE_URL: https://github.com/hubblo-org/windows-rapl-driver/releases/download
17+
18+
jobs:
19+
build_exe_win1011:
20+
name: Build exe installer for windows 10/11/server 2016/server 2019/server 2022
21+
runs-on: "windows-latest"
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
- name: Install Innosoft
26+
run: |
27+
$url = "https://jrsoftware.org/download.php/is.exe"
28+
$dest = "is.exe"
29+
Invoke-WebRequest -Uri $url -OutFile $dest
30+
ls
31+
& "D:\a\scaphandre\scaphandre\$dest" /verysilent /suppressmsgbox
32+
ls "C:\Program Files (x86)\Inno Setup 6\"
33+
- name: Get windows-rapl-driver
34+
run: |
35+
$dest = "DriverLoader.exe"
36+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/DriverLoader.exe"
37+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
38+
$dest = "ScaphandreDrv.cat"
39+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/ScaphandreDrv.cat"
40+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
41+
$dest = "ScaphandreDrv.sys"
42+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/ScaphandreDrv.sys"
43+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
44+
$dest = "ScaphandreDrv.inf"
45+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/ScaphandreDrv.inf"
46+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
47+
$dest = "ScaphandreDrvTest.cer"
48+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/ScaphandreDrvTest.cer"
49+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
50+
$dest = "devcon.exe"
51+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/devcon.exe"
52+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
53+
$dest = "certmgr.exe"
54+
$url = "${{ env.WRD_BASE_URL }}/${{ env.WRD_VERSION }}/certmgr.exe"
55+
Invoke-WebRequest -Uri ($url -replace '"', "") -OutFile $dest
56+
ls
57+
- name: Install Rustup
58+
uses: crazy-max/ghaction-chocolatey@v2
59+
with:
60+
args: install rustup.install --ignore-checksums
61+
- name: Install Rust toolchain
62+
run: |
63+
rustup toolchain install stable-x86_64-pc-windows-msvc
64+
- name: Build Scaphandre
65+
run: |
66+
cargo build --release --no-default-features --features "prometheuspush json"
67+
- name: Build package
68+
run: |
69+
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" packaging/windows/installer.iss
70+
- name: Upload artifact #Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
71+
run: |
72+
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
73+
Install-Module -Confirm:$False -Name AWS.Tools.Installer
74+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
75+
Import-Module AWS.Tools.Installer
76+
Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp -Confirm:$False
77+
Set-AWSCredential -AccessKey ${{ secrets.S3_ACCESS_KEY_ID }} -SecretKey ${{ secrets.S3_SECRET_ACCESS_KEY }} -StoreAs default
78+
mv packaging/windows/Output/scaphandre_installer.exe scaphandre_${GITHUB_REF_NAME}_installer.exe
79+
$clientconfig=@{
80+
SignatureVersion="s3v4"
81+
ServiceUrl="https://s3.fr-par.scw.cloud"
82+
}
83+
Write-S3Object -EndpointUrl "https://s3.fr-par.scw.cloud" -Region "fr-par" -BucketName "scaphandre" -File scaphandre_${GITHUB_REF_NAME}_installer.exe -key "x86_64/scaphandre_${GITHUB_REF_NAME}_installer.exe" -PublicReadOnly -ClientConfig $clientconfig

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by Cargo
22
# will have compiled files and executables
33
/target/
4+
**/Output/
45

56
# These are backup files generated by rustfmt
67
**/*.rs.bk

Cargo.lock

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ procfs = { version = "0.15.0" }
3939

4040
[target.'cfg(target_os="windows")'.dependencies]
4141
windows = { version = "0.27.0", features = ["alloc","Win32_Storage_FileSystem","Win32_Foundation","Win32_Security","Win32_System_IO","Win32_System_Ioctl"]}
42+
windows-service = { version = "0.6.0" }
4243

4344
[features]
4445
default = ["prometheus", "riemann", "warpten", "json", "containers", "prometheuspush"]

docs_src/scaphandre.ico

15.2 KB
Binary file not shown.
+35-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
1-
# Install Scaphandre on Windows (experimental)
1+
# Install Scaphandre on Windows
22

3-
A better procedure and packaging should come soon.
3+
**!! Warning: This is a first testing version of the package and installation procedure.**
4+
**!! A new version is on its way with proper driver signature and Windows service proper management.**
45

5-
The release 0.5.0 of Scaphandre can be tested on windows by compiling both the kernel driver and Scaphandre. See [Compilation for Windows (experimental)](compilation-windows.md)
6+
## Using the installer
7+
8+
In this first itration of the package, you'll need to enable Test Mode on Windows prior to proceed to this installation, then reboot. (Next version will have an officially signed version of the driver, so this won't be ncessaerry anymore.)
9+
10+
bcdedit.exe -set TESTSIGNING ON
11+
bcdedit.exe -set nointegritychecks on
12+
13+
The installer will ensure that test mode is enabled and fail otherwise, but activation of test mode **and a reboot** is needed before anyway.
14+
15+
Then download the [package](https://scaphandre.s3.fr-par.scw.cloud/x86_64/scaphandre_0.5.0_installer.exe) and install it **as an administrator**.
16+
17+
Once installed, you should be able to run scaphandre from Powershell, by running :
18+
19+
& 'C:\Program Files (x86)\scaphandre\scaphandre.exe' stdout
20+
21+
## Troubleshooting
22+
23+
An error such as
24+
25+
scaphandre::sensors::msr_rapl: Failed to open device : HANDLE(-1)
26+
27+
means that the driver is not properly setup. Check it's state by running:
28+
29+
driverquery /v | findstr capha
30+
31+
If there is not item returned, the installation of the driver encountered an issue.
32+
33+
If the service is STOPPED, there is also something wrong.
34+
35+
## Compilation
36+
37+
If you look for compiling Scaphandre and its driver yourself, see [Compilation for Windows](compilation-windows.md)

packaging/windows/dev_installer.iss

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
; Script generated by the Inno Setup Script Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+
#define MyAppName "scaphandre"
5+
#define MyAppVersion "0.5.0"
6+
#define MyAppPublisher "Hubblo"
7+
#define MyAppURL "https://hubblo-org.github.io/scaphandre-documentation"
8+
#define MyAppExeName "scaphandre.exe"
9+
#define MyAppSourceFolder "C:\Users\bpeti\Documents\GitHub\scaphandre"
10+
#define RaplDriverSourceFolder "C:\Users\bpeti\Documents\GitHub\windows-rapl-driver"
11+
#define SystemFolder "C:\Windows\System32"
12+
#define System64Folder "C:\Windows\SysWOW64"
13+
14+
[Setup]
15+
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
16+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
17+
AppId={{7DB7B851-1DD2-4FF5-BFC7-282FEBA3B28D}
18+
AppName={#MyAppName}
19+
AppVersion={#MyAppVersion}
20+
;AppVerName={#MyAppName} {#MyAppVersion}
21+
AppPublisher={#MyAppPublisher}
22+
AppPublisherURL={#MyAppURL}
23+
AppSupportURL={#MyAppURL}
24+
AppUpdatesURL={#MyAppURL}
25+
DefaultDirName={autopf}\{#MyAppName}
26+
DefaultGroupName={#MyAppName}
27+
LicenseFile=C:\Users\bpeti\Documents\GitHub\scaphandre\LICENSE
28+
; Uncomment the following line to run in non administrative install mode (install for current user only.)
29+
;PrivilegesRequired=lowest
30+
OutputBaseFilename={#MyAppName}_{#MyAppVersion}_installer
31+
Compression=lzma
32+
SolidCompression=yes
33+
WizardStyle=modern
34+
Uninstallable=yes
35+
SetupIconFile=C:\Users\bpeti\Documents\GitHub\scaphandre\docs_src\scaphandre.ico
36+
37+
[Languages]
38+
Name: "english"; MessagesFile: "compiler:Default.isl"
39+
40+
[Files]
41+
Source: "{#MyAppSourceFolder}\target\release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
42+
Source: "{#RaplDriverSourceFolder}\x64\Release\DriverLoader.exe"; DestDir: "{app}"; Flags: ignoreversion
43+
Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.inf"; DestDir: "{app}"; Flags: ignoreversion
44+
; Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.sys"; DestDir: "{#SystemFolder}";
45+
; Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.sys"; DestDir: "{#System64Folder}";
46+
Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.sys"; DestDir: "{app}";
47+
Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.cat"; DestDir: "{app}";
48+
; Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.cat"; DestDir: "{#SystemFolder}";
49+
; Source: "{#RaplDriverSourceFolder}\ScaphandreDrv\ScaphandreDrv.cat"; DestDir: "{#System64Folder}";
50+
Source: "C:\Program Files (x86)\Windows Kits\10\Tools\10.0.22621.0\x64\devcon.exe"; DestDir: "{app}"; Flags: ignoreversion
51+
Source: "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\certmgr.exe"; DestDir: "{app}"; Flags: ignoreversion
52+
Source: "{#MyAppSourceFolder}\README.md"; DestDir: "{app}"; Flags: ignoreversion
53+
Source: "{#MyAppSourceFolder}\CHANGELOG.md"; DestDir: "{app}"; Flags: ignoreversion
54+
Source: "{#RaplDriverSourceFolder}\ScaphandreDrvTest.cer"; DestDir: "{app}"; Flags: ignoreversion
55+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
56+
57+
[Icons]
58+
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
59+
60+
[Run]
61+
Filename: "C:\windows\System32\WindowsPowershell\v1.0\powershell.exe"; Parameters: "Import-Certificate -FilePath {app}\ScaphandreDrvTest.cer -CertStoreLocation Cert:\LocalMachine\Root"; Description: "Register test certificate"; Flags: waituntilidle shellexec
62+
Filename: "{app}/devcon.exe"; Parameters: "install {app}\ScaphandreDrv.inf root\SCAPHANDREDRV"; Description: "Install Driver"; Flags: waituntilidle
63+
Filename: "{app}/devcon.exe"; Parameters: "enable {app}\ScaphandreDrv.inf root\SCAPHANDREDRV"; Description: "Enable Driver"; Flags: waituntilidle
64+
Filename: "{app}/DriverLoader.exe"; Parameters: "install"; WorkingDir: "{app}"; Description: "Install Driver Service";
65+
Filename: "{app}/DriverLoader.exe"; Parameters: "start"; WorkingDir: "{app}"; Description: "Start Driver Service";
66+
; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}";
67+
; Filename: "schtasks.exe"; Parameters: "/Create /SC ONSTART {app}\scaphandre.exe prometheus-push "
68+
69+
[UninstallRun]
70+
Filename: "{app}/DriverLoader.exe"; Parameters: "stop"; WorkingDir: "{app}"; RunOnceId: "StopService";
71+
Filename: "{app}/DriverLoader.exe"; Parameters: "remove"; WorkingDir: "{app}"; RunOnceId: "RemoveService";
72+
Filename: "{app}/devcon.exe"; Parameters: "disable ScaphandreDrv"; RunOnceId: "DisableDrier";
73+
Filename: "{app}/devcon.exe"; Parameters: "remove ScaphandreDrv"; RunOnceId: "RemoveService";
74+
75+

0 commit comments

Comments
 (0)