Skip to content

Commit 641b67a

Browse files
Add minimal set of tests for runner installed from .msi file (#21835)
Add minimal set of tests to check installation of Scala runner from .msi file.
1 parent f7f51ed commit 641b67a

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

.github/workflows/ci.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,15 @@ jobs:
11191119
build-msi-package:
11201120
uses: ./.github/workflows/build-msi.yml
11211121
if : github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')
1122-
# TODO: ADD A JOB THAT DEPENDS ON THIS TO TEST THE MSI
1122+
1123+
test-msi-package:
1124+
uses: ./.github/workflows/test-msi.yml
1125+
needs: [build-msi-package]
1126+
with:
1127+
# Ensure that version starts with prefix 3.
1128+
# In the future it can be adapted to compare with with git tag or version set in the build.s
1129+
version: "3."
1130+
java-version: 8
11231131

11241132
build-sdk-package:
11251133
uses: ./.github/workflows/build-sdk.yml

.github/workflows/test-msi.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
###################################################################################################
2+
### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH MSI RUNNER ###
3+
### HOW TO USE: ###
4+
### Provide optional `version` to test if installed binaries are installed with ###
5+
### correct Scala version. ###
6+
### NOTE: Requires `scala.msi` artifact uploaded within the same run ###
7+
### ###
8+
###################################################################################################
9+
10+
name: Test 'scala' MSI Package
11+
run-name: Test 'scala' (${{ inputs.version }}) MSI Package
12+
13+
on:
14+
workflow_call:
15+
inputs:
16+
version:
17+
required: true
18+
type: string
19+
java-version:
20+
required: true
21+
type : string
22+
23+
jobs:
24+
test:
25+
runs-on: windows-latest
26+
steps:
27+
- uses: actions/setup-java@v4
28+
with:
29+
distribution: temurin
30+
java-version: ${{ inputs.java-version }}
31+
- name: Download MSI artifact
32+
uses: actions/download-artifact@v4
33+
with:
34+
name: scala.msi
35+
path: .
36+
37+
# Run the MSI installer
38+
# During normal installation msiexec would modify the PATH automatically.
39+
# However, it seems not to work in GH Actions. Append the PATH manually instead.
40+
- name: Install Scala Runner
41+
shell: pwsh
42+
run: |
43+
Start-Process 'msiexec.exe' -ArgumentList '/I "scala.msi" /L*V "install.log" /qb' -Wait
44+
Get-Content 'install.log'
45+
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\scala\bin"
46+
47+
# Run tests to ensure the Scala Runner was installed and works
48+
- name: Test Scala Runner
49+
shell: pwsh
50+
run: |
51+
scala --version
52+
if (-not (scala --version | Select-String "Scala version \(default\): ${{ inputs.version }}")) {
53+
Write-Host "Invalid Scala version of MSI installed runner, expected ${{ inputs.version }}"
54+
Exit 1
55+
}
56+
- name : Test the `scalac` command
57+
shell: pwsh
58+
run: |
59+
scalac --version
60+
if (-not (scalac --version | Select-String "Scala compiler version ${{ inputs.version }}")) {
61+
Write-Host "Invalid scalac version of MSI installed runner, expected ${{ inputs.version }}"
62+
Exit 1
63+
}
64+
- name : Test the `scaladoc` command
65+
shell: pwsh
66+
run: |
67+
scaladoc --version
68+
if (-not (scaladoc --version | Select-String "Scaladoc version ${{ inputs.version }}")) {
69+
Write-Host "Invalid scaladoc version of MSI installed runner, expected ${{ inputs.version }}"
70+
Exit 1
71+
}
72+
- name : Uninstall the `scala` package
73+
shell: pwsh
74+
run: |
75+
Start-Process 'msiexec.exe' -ArgumentList '/X "scala.msi" /L*V "uninstall.log" /qb' -Wait
76+
Get-Content 'uninstall.log'
77+

0 commit comments

Comments
 (0)