Skip to content

Commit d3e7d75

Browse files
committed
Enable the possibility to test on the PR
1 parent 129a1d1 commit d3e7d75

File tree

6 files changed

+102
-39
lines changed

6 files changed

+102
-39
lines changed

.github/workflows/build-chocolatey.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ jobs:
4343
uses: actions/upload-artifact@v4
4444
with:
4545
name: scala.nupkg
46-
path: ./pkgs/chocolatey/scala.*.nupkg
46+
path: ./pkgs/chocolatey/scala.${{ inputs.version }}.nupkg
4747
if-no-files-found: error

.github/workflows/build-sdk.yml

+60-18
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,94 @@ run-name: Build Scala Launchers
1313

1414
on:
1515
workflow_call:
16+
inputs:
17+
java-version:
18+
type : string
19+
required : true
20+
outputs:
21+
universal-id:
22+
description: ID of the `universal` package from GitHub Artifacts (Authentication Required)
23+
value : ${{ jobs.build.outputs.universal-id }}
24+
linux-x86_64-id:
25+
description: ID of the `linux x86-64` package from GitHub Artifacts (Authentication Required)
26+
value : ${{ jobs.build.outputs.linux-x86_64-id }}
27+
linux-aarch64-id:
28+
description: ID of the `linux aarch64` package from GitHub Artifacts (Authentication Required)
29+
value : ${{ jobs.build.outputs.linux-aarch64-id }}
30+
mac-x86_64-id:
31+
description: ID of the `mac x86-64` package from GitHub Artifacts (Authentication Required)
32+
value : ${{ jobs.build.outputs.mac-x86_64-id }}
33+
mac-aarch64-id:
34+
description: ID of the `mac aarch64` package from GitHub Artifacts (Authentication Required)
35+
value : ${{ jobs.build.outputs.mac-aarch64-id }}
36+
win-x86_64-id:
37+
description: ID of the `win x86-64` package from GitHub Artifacts (Authentication Required)
38+
value : ${{ jobs.build.outputs.win-x86_64-id }}
39+
1640

1741
jobs:
1842
build:
1943
runs-on: ubuntu-latest
44+
outputs:
45+
universal-id : ${{ steps.universal.outputs.artifact-id }}
46+
linux-x86_64-id : ${{ steps.linux-x86_64.outputs.artifact-id }}
47+
linux-aarch64-id: ${{ steps.linux-aarch64.outputs.artifact-id }}
48+
mac-x86_64-id : ${{ steps.mac-x86_64.outputs.artifact-id }}
49+
mac-aarch64-id : ${{ steps.mac-aarch64.outputs.artifact-id }}
50+
win-x86_64-id : ${{ steps.win-x86_64.outputs.artifact-id }}
2051
steps:
2152
- uses: actions/checkout@v4
53+
- uses: actions/setup-java@v4
54+
with:
55+
distribution: temurin
56+
java-version: ${{ inputs.java-version }}
57+
cache : sbt
2258
- name: Build and pack the SDK (universal)
23-
run : ./project/scripts/sbt dist/Universal/packageBin
59+
run : ./project/scripts/sbt dist/Universal/stage
2460
- name: Build and pack the SDK (linux x86-64)
25-
run : ./project/scripts/sbt dist-linux-x86_64/Universal/packageBin
61+
run : ./project/scripts/sbt dist-linux-x86_64/Universal/stage
2662
- name: Build and pack the SDK (linux aarch64)
27-
run : ./project/scripts/sbt dist-linux-aarch64/Universal/packageBin
63+
run : ./project/scripts/sbt dist-linux-aarch64/Universal/stage
2864
- name: Build and pack the SDK (mac x86-64)
29-
run : ./project/scripts/sbt dist-mac-x86_64/Universal/packageBin
65+
run : ./project/scripts/sbt dist-mac-x86_64/Universal/stage
3066
- name: Build and pack the SDK (mac aarch64)
31-
run : ./project/scripts/sbt dist-mac-aarch64/Universal/packageBin
67+
run : ./project/scripts/sbt dist-mac-aarch64/Universal/stage
3268
- name: Build and pack the SDK (win x86-64)
33-
run : ./project/scripts/sbt dist-win-x86_64/Universal/packageBin
69+
run : ./project/scripts/sbt dist-win-x86_64/Universal/stage
3470
- name: Upload zip archive to GitHub Artifact (universal)
3571
uses: actions/upload-artifact@v4
72+
id : universal
3673
with:
37-
path: ./dist/target/universal/scala3-*.zip
38-
name: scala3.zip
74+
path: ./dist/target/universal/stage
75+
name: scala3-universal
3976
- name: Upload zip archive to GitHub Artifact (linux x86-64)
4077
uses: actions/upload-artifact@v4
78+
id : linux-x86_64
4179
with:
42-
path: ./dist/linux-x86_64/target/universal/scala3-*-x86_64-pc-linux.zip
43-
name: scala3-x86_64-pc-linux.zip
80+
path: ./dist/linux-x86_64/target/universal/stage
81+
name: scala3-x86_64-pc-linux
4482
- name: Upload zip archive to GitHub Artifact (linux aarch64)
4583
uses: actions/upload-artifact@v4
84+
id : linux-aarch64
4685
with:
47-
path: ./dist/linux-aarch64/target/universal/scala3-*-aarch64-pc-linux.zip
48-
name: scala3-aarch64-pc-linux.zip
86+
path: ./dist/linux-aarch64/target/universal/stage
87+
name: scala3-aarch64-pc-linux
4988
- name: Upload zip archive to GitHub Artifact (mac x86-64)
5089
uses: actions/upload-artifact@v4
90+
id : mac-x86_64
5191
with:
52-
path: ./dist/mac-x86_64/target/universal/scala3-*-x86_64-apple-darwin.zip
53-
name: scala3-x86_64-apple-darwin.zip
92+
path: ./dist/mac-x86_64/target/universal/stage
93+
name: scala3-x86_64-apple-darwin
5494
- name: Upload zip archive to GitHub Artifact (mac aarch64)
5595
uses: actions/upload-artifact@v4
96+
id : mac-aarch64
5697
with:
57-
path: ./dist/mac-aarch64/target/universal/scala3-*-aarch64-apple-darwin.zip
58-
name: scala3-aarch64-apple-darwin.zip
98+
path: ./dist/mac-aarch64/target/universal/stage
99+
name: scala3-aarch64-apple-darwin
59100
- name: Upload zip archive to GitHub Artifact (win x86-64)
60101
uses: actions/upload-artifact@v4
102+
id : win-x86_64
61103
with:
62-
path: ./dist/win-x86_64/target/universal/scala3-*-x86_64-pc-win32.zip
63-
name: scala3-x86_64-pc-win32.zip
104+
path: ./dist/win-x86_64/target/universal/stage
105+
name: scala3-x86_64-pc-win32
64106

.github/workflows/ci.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1016,18 +1016,20 @@ jobs:
10161016

10171017
build-sdk-package:
10181018
uses: ./.github/workflows/build-sdk.yml
1019-
1019+
with:
1020+
java-version: 8
10201021

10211022
build-chocolatey-package:
10221023
uses: ./.github/workflows/build-chocolatey.yml
10231024
needs: [ build-sdk-package ]
10241025
with:
1025-
version: 3.6.0-RC1 # TODO: FIX THIS
1026-
url : 'https://github.com/scala/scala3/releases/download/3.5.0-RC4/scala3-3.5.0-RC4-x86_64-pc-win32.zip' # TODO: Fix this
1026+
version: 3.6.0-local # TODO: FIX THIS
1027+
url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.win-x86_64-id }}/zip
10271028

10281029
test-chocolatey-package:
10291030
uses: ./.github/workflows/test-chocolatey.yml
10301031
with:
1031-
version: 3.6.0-RC1 # TODO: FIX THIS
1032+
version : 3.6.0-local # TODO: FIX THIS
1033+
java-version: 8
10321034
if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]')
10331035
needs: [ build-chocolatey-package ]

.github/workflows/test-chocolatey.yml

+8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@ on:
1515
version:
1616
required: true
1717
type: string
18+
java-version:
19+
required: true
20+
type : string
1821

1922
env:
2023
CHOCOLATEY-REPOSITORY: chocolatey-pkgs
24+
DOTTY_CI_INSTALLATION: ${{ secrets.GITHUB_TOKEN }}
2125

2226
jobs:
2327
test:
2428
runs-on: windows-latest
2529
steps:
30+
- uses: actions/setup-java@v4
31+
with:
32+
distribution: temurin
33+
java-version: ${{ inputs.java-version }}
2634
- name: Download the 'nupkg' from GitHub Artifacts
2735
uses: actions/download-artifact@v4
2836
with:

pkgs/chocolatey/tools/chocolateyInstall.ps1

+20-7
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,30 @@ $packageArgs = @{
1111
UnzipLocation = $unzipLocation
1212
}
1313

14-
Install-ChocolateyZipPackage @packageArgs
14+
## In case we are running in the CI, add the authorisation header to fetch the zip
15+
## See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact
16+
if ($env:DOTTY_CI_INSTALLATION) {
17+
Write-Host "Installing the Chocolatey package in Scala 3's CI"
18+
$packageArgs += @{
19+
Options = @{
20+
Headers = @{
21+
Accept = 'application/vnd.github+json'
22+
Authorization = "Bearer $env:DOTTY_CI_INSTALLATION"
23+
}
24+
}
25+
}
26+
}
1527

16-
$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1
28+
Install-ChocolateyZipPackage @packageArgs
1729

18-
if (-not $extractedDir) {
19-
throw "Failed to find the extracted directory."
30+
# Find the path to the bin directory to create the shims
31+
if($env:DOTTY_CI_INSTALLATION) {
32+
$scalaBinPath = Join-Path $unzipLocation 'bin' # Update this path if the structure inside the ZIP changes
33+
} else {
34+
$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1
35+
$scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin'
2036
}
2137

22-
# Define the bin path
23-
$scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin' # Update this path if the structure inside the ZIP changes
24-
2538
# Iterate through the .bat files in the bin directory and create shims
2639
Write-Host "Creating shims for .bat file from $scalaBinPath"
2740
Get-ChildItem -Path $scalaBinPath -Filter '*.bat' | ForEach-Object {

pkgs/chocolatey/tools/chocolateyUninstall.ps1

+7-9
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ $unzipLocation = Split-Path -Parent $MyInvocation.MyCommand.Definition #
44
$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageName)" # Append the package's name
55
$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageVersion)" # Append the package's version
66

7-
8-
$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1
9-
10-
if (-not $extractedDir) {
11-
throw "Failed to find the extracted directory."
12-
}
13-
14-
# Define the bin path
15-
$scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin' # Update this path if the structure inside the ZIP changes
7+
# Find the path to the bin directory to create the shims
8+
if($env:DOTTY_CI_INSTALLATION) {
9+
$scalaBinPath = Join-Path $unzipLocation 'bin' # Update this path if the structure inside the ZIP changes
10+
} else {
11+
$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1
12+
$scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin'
13+
}
1614

1715
# Iterate through the .bat files in the bin directory and remove shims
1816
Write-Host "Removing shims for .bat file from $scalaBinPath"

0 commit comments

Comments
 (0)