Skip to content

Commit

Permalink
Merge pull request #25 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Update master
  • Loading branch information
MeSophie authored Dec 2, 2022
2 parents 2bcd5ce + c0d691f commit ae02a5c
Show file tree
Hide file tree
Showing 25 changed files with 2,085 additions and 704 deletions.
193 changes: 193 additions & 0 deletions .github/workflows/CreateInstaller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@

name: Create 32 bit and 64 bit Installers



on:
workflow_dispatch:
inputs:
major_version:
description: 'Major Version'
required: true
minor_version:
description: 'Minor Version'
required: true
build_no:
description: 'Build No'
required: true

jobs:

build:

strategy:
matrix:
configuration: [Release]

# running on 2019 so that .NET version 4.5 and lower can be used
runs-on: windows-2019

# set variables
env:
Solution_Name: Instat.sln # Replace with your solution name, i.e. MyWpfApp.sln.
Test_Project_Path: instat\instat.vbproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.

# check out r-instat
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# set up and restore NuGet packages
- name: Setup NuGet
uses: NuGet/[email protected]

- name: Restore NuGet
run: nuget restore $env:Solution_Name


# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# increment revision number
- name: Generate revision number
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}

#update version numbers in assembley
- name: set-version-assemblyinfo
uses: dannevesdantas/[email protected]
with:
# Folder location to search for AssemblyInfo.cs/.vb files
path: instat\My Project\AssemblyInfo.vb
# optional, default is ${{ github.workspace }}
# Version number to set on [AssemblyVersion] and [AssemblyFileVersion] attributes of AssemblyInfo.cs/.vb files
version: "${{ inputs.major_version }}.${{ inputs.minor_version }}.${{ inputs.build_no }}" #.${env:BUILD_NUMBER}"

# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: msbuild $env:Test_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
env:
Appx_Bundle: Always
Appx_Bundle_Platforms: x86|x64
Appx_Package_Build_Mode: StoreUpload
Configuration: ${{ matrix.configuration }}

# Build 32 bit installer without R
- name: Building the installer 32bit - No R
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "inno_install_script_32bit.iss"
shell: cmd

# upload 32 bit installer without R
- name: Upload the 32 bit installer as an artifact
uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'pull_request' }}
with:
path: "Output/R-Instat_0.7.4_Installer_32.exe"
name: rinstat32NoR-innosetup

# Build 64 bit installer without R
- name: Building the installer 64bit - No R
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "inno_install_script_64bit.iss"
shell: cmd

# Upload 64 bit installer without R
- name: Upload the 64 bit installer as an artifact
uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'pull_request' }}
with:
path: "Output/R-Instat_Installer_64.exe"
name: rinstat64NoR-innosetup

# check out R-Instat Data
- name: Checkout Instat Data
uses: actions/checkout@v2
with:
repository: ' africanmathsinitiative/R-Instat-Data'
fetch-depth: 0
path: 'InstatData'

# Create directory and copy over InstatData (64bit)
- name: Make Library directory 64 bit
run: |
MKDIR instat\bin\Release\static\Library\
- name: Copy R-Instat Data 64 bit
run: |
ROBOCOPY InstatData\data\ instat\bin\Release\static\Library\ /E
continue-on-error: true

# Create directory and copy over InstatData (32bit)
- name: Make Library directory 32 bit
run: |
MKDIR instat\bin\x64\Release\static\Library\
- name: Copy R-Instat Data 32 bit
run: |
ROBOCOPY InstatData\data\*.* instat\bin\x64\Release\static\Library\ /E
continue-on-error: true

# check out R for R-Instat
- name: Checkout R for R-Instat
uses: actions/checkout@v2
with:
repository: 'ChrisMarsh82/R-RInstat'
fetch-depth: 0
path: 'R-RInstat'

- name: Copy R 64 bit
run: |
ROBOCOPY R-RInstat\64Bit\ instat\bin\Release\static\ /E
continue-on-error: true

- name: Copy R 32 bit
run: |
ROBOCOPY R-RInstat\32Bit\ instat\bin\x64\Release\static\ /E
continue-on-error: true

- name: Install R packages (64 bit)
run: |
"instat\bin\Release\static\R\bin\Rscript.exe" "instat\static\InstatObject\R\InstallPackages.R"
shell: cmd

- name: Install R packages (32 bit)
run: |
"instat\bin\x64\Release\static\R\bin\Rscript.exe" "instat\static\InstatObject\R\InstallPackages.R"
shell: cmd

- name: Building the installer 64bit - With R
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "inno_install_script_64bit.iss"
shell: cmd

- name: Building the installer 32bit - With R
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "inno_install_script_32bit.iss"
shell: cmd

- name: Upload the 64 bit installer with R as an artifact
uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'pull_request' }}
with:
path: "Output/R-Instat_Installer_64.exe"
name: rinstat64WithR-innosetup

- name: Upload the 32 bit installer with R as an artifact
uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'pull_request' }}
with:
path: "Output/R-Instat_Installer_32.exe"
name: rinstat64WithR-innosetup


42 changes: 42 additions & 0 deletions inno_install_script_32bit.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppVersion= {#GetStringFileInfo("instat\bin\Release\instat.exe", "FileVersion")}
AppId={{979E51D8-9BC4-418F-8D4D-9B44FEA869A6-{#SetupSetting("AppVersion")}}
AppName=R-Instat

AppPublisher=African Maths Initiative
AppPublisherURL=http://r-instat.org/
AppSupportURL=http://r-instat.org/
AppUpdatesURL=http://r-instat.org/
DefaultDirName={autopf}\R-Instat\
DefaultGroupName=R-Instat
AllowNoIcons=yes
OutputBaseFilename=R-Instat_Installer_32
SetupIconFile=.\instat\Resources\rinstat_icon_Hih_icon.ico
UninstallDisplayIcon=.\instat\Resources\rinstat_icon_Hih_icon.ico
Compression=lzma
SolidCompression=yes

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0

[Files]
Source: "instat\bin\x64\Release\instat.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "instat\bin\x64\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
;{#SetupSetting("AppVersion")}
Name: "{group}\R-Instat {#SetupSetting("AppVersion")}"; Filename: "{app}\instat.exe"
Name: "{group}\{cm:UninstallProgram,R-Instat}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\R-Instat {#SetupSetting("AppVersion")}"; Filename: "{app}\instat.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\R-Instat {#SetupSetting("AppVersion")}"; Filename: "{app}\instat.exe"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\instat.exe"; Description: "{cm:LaunchProgram,R-Instat}"; Flags: nowait postinstall skipifsilent
43 changes: 43 additions & 0 deletions inno_install_script_64bit.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppVersion= {#GetStringFileInfo("instat\bin\Release\instat.exe", "FileVersion")}
AppId={{5455FC1A-85BE-4679-B600-8A1A4FC3CDD9-{#SetupSetting("AppVersion")}}
AppName=R-Instat

AppPublisher=African Maths Initiative
AppPublisherURL=http://r-instat.org/
AppSupportURL=http://r-instat.org/
AppUpdatesURL=http://r-instat.org/
DefaultDirName={autopf}\R-Instat\
DefaultGroupName=R-Instat
AllowNoIcons=yes
OutputBaseFilename=R-Instat_Installer_64
SetupIconFile=.\instat\Resources\rinstat_icon_Hih_icon.ico
UninstallDisplayIcon=.\instat\Resources\rinstat_icon_Hih_icon.ico
Compression=lzma
SolidCompression=yes
ArchitecturesInstallIn64BitMode=x64

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0

[Files]
Source: "instat\bin\Release\instat.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "instat\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
;{#SetupSetting("AppVersion")}
Name: "{group}\R-Instat {#SetupSetting("AppVersion")}"; Filename: "{app}\instat.exe"
Name: "{group}\{cm:UninstallProgram,R-Instat}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\R-Instat {#SetupSetting("AppVersion")}"; Filename: "{app}\instat.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\R-Instat {#SetupSetting("AppVersion")}"; Filename: "{app}\instat.exe"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\instat.exe"; Description: "{cm:LaunchProgram,R-Instat}"; Flags: nowait postinstall skipifsilent
21 changes: 14 additions & 7 deletions instat/UserControls/frmMaximiseOutput.vb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Public Class frmMaximiseOutput
End Sub

Private Sub mnuSave_Click(sender As Object, e As EventArgs) Handles mnuSave.Click
'copies displayed file to the destination folder selected by user
Using dlgSaveFile As New SaveFileDialog
dlgSaveFile.Title = "Save Output"
dlgSaveFile.Filter = _strFileFilter
Expand All @@ -83,20 +84,26 @@ Public Class frmMaximiseOutput

_strFileDestinationDirectory = Path.GetDirectoryName(dlgSaveFile.FileName)

'for htmls copy the html file with it's associated directory; css, javascript files etc
If Path.GetExtension(_strDisplayedFileName).ToLower = ".html" Then
For Each foundDirectory As String In My.Computer.FileSystem.GetDirectories(
'for html copy the html file associated directories, css, javascript files etc
For Each strFoundDirectory As String In My.Computer.FileSystem.GetDirectories(
Path.GetDirectoryName(_strDisplayedFileName),
FileIO.SearchOption.SearchTopLevelOnly,
"*" & Path.GetFileNameWithoutExtension(_strDisplayedFileName) & "*")
My.Computer.FileSystem.CopyDirectory(foundDirectory, _strFileDestinationDirectory, True)

'create the destination folder first
Dim strDestDir As String = Path.Combine(_strFileDestinationDirectory,
Path.GetFileName(strFoundDirectory))
If Not Directory.Exists(strDestDir) Then
Directory.CreateDirectory(strDestDir)
End If
My.Computer.FileSystem.CopyDirectory(strFoundDirectory, strDestDir, True)
Next
Else
My.Computer.FileSystem.CopyFile(_strDisplayedFileName, dlgSaveFile.FileName, True)
End If
End If


'then copy the file
My.Computer.FileSystem.CopyFile(_strDisplayedFileName, dlgSaveFile.FileName, True)
End If
End Using

End Sub
Expand Down
Loading

0 comments on commit ae02a5c

Please sign in to comment.