Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimal set of tests for runner installed from .msi file #21835

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,15 @@ jobs:
build-msi-package:
uses: ./.github/workflows/build-msi.yml
if : github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')
# TODO: ADD A JOB THAT DEPENDS ON THIS TO TEST THE MSI

test-msi-package:
uses: ./.github/workflows/test-msi.yml
needs: [build-msi-package]
with:
# Ensure that version starts with prefix 3.
# In the future it can be adapted to compare with with git tag or version set in the build.s
version: "3."
java-version: 8

build-sdk-package:
uses: ./.github/workflows/build-sdk.yml
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/test-msi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
###################################################################################################
### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH MSI RUNNER ###
### HOW TO USE: ###
### Provide optional `version` to test if installed binaries are installed with ###
### correct Scala version. ###
### NOTE: Requires `scala.msi` artifact uploaded within the same run ###
### ###
###################################################################################################

name: Test 'scala' MSI Package
run-name: Test 'scala' (${{ inputs.version }}) MSI Package

on:
workflow_call:
inputs:
version:
required: true
type: string
java-version:
required: true
type : string

jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ inputs.java-version }}
- name: Download MSI artifact
uses: actions/download-artifact@v4
with:
name: scala.msi
path: .

# Run the MSI installer
# During normal installation msiexec would modify the PATH automatically.
# However, it seems not to work in GH Actions. Append the PATH manually instead.
- name: Install Scala Runner
shell: pwsh
run: |
Start-Process 'msiexec.exe' -ArgumentList '/I "scala.msi" /L*V "install.log" /qb' -Wait
Get-Content 'install.log'
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\scala\bin"

# Run tests to ensure the Scala Runner was installed and works
- name: Test Scala Runner
shell: pwsh
run: |
scala --version
if (-not (scala --version | Select-String "Scala version \(default\): ${{ inputs.version }}")) {
Write-Host "Invalid Scala version of MSI installed runner, expected ${{ inputs.version }}"
Exit 1
}
- name : Test the `scalac` command
shell: pwsh
run: |
scalac --version
if (-not (scalac --version | Select-String "Scala compiler version ${{ inputs.version }}")) {
Write-Host "Invalid scalac version of MSI installed runner, expected ${{ inputs.version }}"
Exit 1
}
- name : Test the `scaladoc` command
shell: pwsh
run: |
scaladoc --version
if (-not (scaladoc --version | Select-String "Scaladoc version ${{ inputs.version }}")) {
Write-Host "Invalid scaladoc version of MSI installed runner, expected ${{ inputs.version }}"
Exit 1
}
- name : Uninstall the `scala` package
shell: pwsh
run: |
Start-Process 'msiexec.exe' -ArgumentList '/X "scala.msi" /L*V "uninstall.log" /qb' -Wait
Get-Content 'uninstall.log'