Skip to content

Commit

Permalink
Enable the possibility to test on the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzaremmal committed Jul 16, 2024
1 parent 129a1d1 commit 26bdbee
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/build-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,37 @@ run-name: Build Scala Launchers

on:
workflow_call:
outputs:
universal-url:
description: URL to downloald the `universal` package from GitHub Artifacts (Authentication Required)
value : ${{ jobs.build.outputs.universal-url }}
linux-x86_64-url:
description: URL to downloald the `linux x86-64` package from GitHub Artifacts (Authentication Required)
value : ${{ jobs.build.outputs.linux-x86_64-url }}
linux-aarch64-url:
description: URL to downloald the `linux aarch64` package from GitHub Artifacts (Authentication Required)
value : ${{ jobs.build.outputs.linux-aarch64-url }}
mac-x86_64-url:
description: URL to downloald the `mac x86-64` package from GitHub Artifacts (Authentication Required)
value : ${{ jobs.build.outputs.mac-x86_64-url }}
mac-aarch64-url:
description: URL to downloald the `mac aarch64` package from GitHub Artifacts (Authentication Required)
value : ${{ jobs.build.outputs.mac-aarch64-url }}
win-x86_64-url:
description: URL to downloald the `win x86-64` package from GitHub Artifacts (Authentication Required)
value : ${{ jobs.build.outputs.win-x86_64-url }}


jobs:
build:
runs-on: ubuntu-latest
outputs:
universal-url : ${{ steps.universal.outputs.artifact-url }}
linux-x86_64-url : ${{ steps.linux-x86_64.outputs.artifact-url }}
linux-aarch64-url: ${{ steps.linux-aarch64.outputs.artifact-url }}
mac-x86_64-url : ${{ steps.mac-x86_64.outputs.artifact-url }}
mac-aarch64-url : ${{ steps.mac-aarch64.outputs.artifact-url }}
win-x86_64-url : ${{ steps.win-x86_64.outputs.artifact-url }}
steps:
- uses: actions/checkout@v4
- name: Build and pack the SDK (universal)
Expand All @@ -33,31 +60,37 @@ jobs:
run : ./project/scripts/sbt dist-win-x86_64/Universal/packageBin
- name: Upload zip archive to GitHub Artifact (universal)
uses: actions/upload-artifact@v4
id : universal
with:
path: ./dist/target/universal/scala3-*.zip
name: scala3.zip
- name: Upload zip archive to GitHub Artifact (linux x86-64)
uses: actions/upload-artifact@v4
id : linux-x86_64
with:
path: ./dist/linux-x86_64/target/universal/scala3-*-x86_64-pc-linux.zip
name: scala3-x86_64-pc-linux.zip
- name: Upload zip archive to GitHub Artifact (linux aarch64)
uses: actions/upload-artifact@v4
id : linux-aarch64
with:
path: ./dist/linux-aarch64/target/universal/scala3-*-aarch64-pc-linux.zip
name: scala3-aarch64-pc-linux.zip
- name: Upload zip archive to GitHub Artifact (mac x86-64)
uses: actions/upload-artifact@v4
id : mac-x86_64
with:
path: ./dist/mac-x86_64/target/universal/scala3-*-x86_64-apple-darwin.zip
name: scala3-x86_64-apple-darwin.zip
- name: Upload zip archive to GitHub Artifact (mac aarch64)
uses: actions/upload-artifact@v4
id : mac-aarch64
with:
path: ./dist/mac-aarch64/target/universal/scala3-*-aarch64-apple-darwin.zip
name: scala3-aarch64-apple-darwin.zip
- name: Upload zip archive to GitHub Artifact (win x86-64)
uses: actions/upload-artifact@v4
id : win-x86_64
with:
path: ./dist/win-x86_64/target/universal/scala3-*-x86_64-pc-win32.zip
name: scala3-x86_64-pc-win32.zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ jobs:
needs: [ build-sdk-package ]
with:
version: 3.6.0-RC1 # TODO: FIX THIS
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
url : ${{ needs.build-sdk-package.outputs.win-x86_64-url }}

test-chocolatey-package:
uses: ./.github/workflows/test-chocolatey.yml
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- name : Install the `scala` package with Chocolatey
run : choco install scala --source "${{ env.CHOCOLATEY-REPOSITORY }}" --pre # --pre since we might be testing non-stable releases
shell: pwsh
env:
DOTTY_CI_INSTALLATION: ${{ secrets.GITHUB_TOKEN }}
- name : Test the `scala` command
run : scala --version
shell: pwsh
Expand Down
12 changes: 12 additions & 0 deletions pkgs/chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ $packageArgs = @{
UnzipLocation = $unzipLocation
}

## In case we are running in the CI, add the authorisation header to fetch the zip
if ($env:DOTTY_CI_INSTALLATION) {
Write-Host "Installing the Chocolatey package in Scala 3's CI"
$packageArgs += @{
Options = @{
Headers = @{
Authorization = "Bearer $env:DOTTY_CI_INSTALLATION"
}
}
}
}

Install-ChocolateyZipPackage @packageArgs

$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1
Expand Down

0 comments on commit 26bdbee

Please sign in to comment.