Skip to content

Commit

Permalink
Merge pull request #264 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
MeSophie authored Oct 21, 2024
2 parents 2c2aaf1 + eb578e0 commit ffcac32
Show file tree
Hide file tree
Showing 18 changed files with 1,265 additions and 314 deletions.
196 changes: 196 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@

name: Create Installers



on:
workflow_dispatch:
inputs:
major_version:
description: 'Major Version'
required: true
minor_version:
description: 'Minor Version'
required: true
revision_no:
description: 'Revision'
required: true
r-version:
description: 'Specify the R version to install'
required: true
default: '4.4.1' # Default version if the user does not specify

jobs:

build:

# 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
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}


# 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=Release

# increment build number
- name: Generate build 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.revision_no }}.${env:BUILD_NUMBER}"

# Create the app package by building and packaging the Windows Application Packaging project
# 64bit
- name: Create the app package 64 bit
run: msbuild $env:Solution_Name /p:Configuration=Release /p:Platform=x64 /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_Package_Build_Mode: StoreUpload
Configuration: ${{ matrix.configuration }}

# 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@v4
if: ${{ github.event_name != 'pull_request' }}
with:
path: "Output/"
name: rinstat64NoR

- name: Remove 64 bit without R installer
run: |
del "Output/*"
# check out R-Instat Data
- name: Checkout Instat Data
uses: actions/checkout@v3
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\x64\Release\static\Library\
- name: Copy R-Instat Data 64 bit
run: |
ROBOCOPY InstatData\data\ instat\bin\x64\Release\static\Library\ /E
continue-on-error: true

# Install R
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ inputs.r-version }}

- name: Debug paths
run: |
$R_HOME=$(Rscript -e 'cat(R.home())')
echo "R_HOME path: $R_HOME"
echo "Source path: $(pwd)\installer\Rprofile.site"
- name: Update Rprofile.site
run: |
$R_HOME=$(Rscript -e 'cat(R.home())')
ROBOCOPY "${{ github.workspace }}\installer" "$R_HOME\etc" "Rprofile.site" /COPY:DAT
continue-on-error: true

- name: Copy R 64 bit
run: |
$R_HOME=$(Rscript -e 'cat(R.home())')
ROBOCOPY "$R_HOME" "${{ github.workspace }}\instat\bin\x64\Release\static\R" /E
continue-on-error: true

- name: Set R-tools
uses: r-windows/install-rtools@master

# Check if the directory exists
- name: Verify InstallPackages.R directory
run: |
if (Test-Path "D:\a\R-Instat\R-Instat\instat\static\InstatObject\R") {
Write-Host "Directory exists."
} else {
Write-Host "Directory does not exist."
}
# List the contents of the directory to check for the script
- name: List contents of InstatObject\R directory
run: |
Get-ChildItem "D:\a\R-Instat\R-Instat\instat\static\InstatObject\R"
# Check if the directory exists
- name: Verify script directory
run: |
if (Test-Path "D:\a\R-Instat\R-Instat\instat\bin\x64\Release\static\R") {
Write-Host "Directory exists."
} else {
Write-Host "Directory does not exist."
}
# List the contents of the directory to check for the script
- name: List contents of R\bin directory
run: |
Get-ChildItem "D:\a\R-Instat\R-Instat\instat\bin\x64\Release\static"
- name: List contents of R\bin directory
run: |
Get-ChildItem "D:\a\R-Instat\R-Instat\instat\bin\x64\Release\static\R"
- name: Install R packages (64 bit)
run: |
"${{ github.workspace }}\instat\bin\x64\Release\static\R\bin\Rscript.exe" "${{ github.workspace }}\instat\static\InstatObject\R\InstallPackages.R"
shell: cmd

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

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


25 changes: 25 additions & 0 deletions installer/Rprofile.site
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Things you might want to change

# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")

# set the default help type
# options(help_type="text")
options(help_type="html")

# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")

# Only use internal library
if (length(.libPaths()) == 2) .libPaths(.libPaths()[2])

# set a CRAN mirror
# local({r <- getOption("repos")
# r["CRAN"] <- "http://my.local.cran"
# options(repos=r)})

# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
# if (interactive())
# fortunes::fortune()
Loading

0 comments on commit ffcac32

Please sign in to comment.