Skip to content

Commit e04ea4a

Browse files
Synchronize with scala/scala3 LTS release 3.3.5 (#25)
1 parent 80d111d commit e04ea4a

29 files changed

+834
-75
lines changed
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
###################################################################################################
2+
### THIS IS A REUSABLE WORKFLOW TO BUILD SCALA WITH CHOCOLATEY ###
3+
### HOW TO USE: ###
4+
### ###
5+
### NOTE: ###
6+
### ###
7+
###################################################################################################
8+
9+
10+
name: Build 'scala' Chocolatey Package
11+
run-name: Build 'scala' (${{ inputs.version }}) Chocolatey Package
12+
13+
on:
14+
workflow_call:
15+
inputs:
16+
version:
17+
required: true
18+
type : string
19+
url:
20+
required: true
21+
type : string
22+
digest:
23+
required: true
24+
type : string
25+
26+
jobs:
27+
build:
28+
runs-on: windows-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Replace the version placeholder
32+
uses: richardrigutins/replace-in-files@v2
33+
with:
34+
files: ./pkgs/chocolatey/scala.nuspec
35+
search-text: '@LAUNCHER_VERSION@'
36+
replacement-text: ${{ inputs.version }}
37+
- name: Replace the URL placeholder
38+
uses: richardrigutins/replace-in-files@v2
39+
with:
40+
files: ./pkgs/chocolatey/tools/chocolateyInstall.ps1
41+
search-text: '@LAUNCHER_URL@'
42+
replacement-text: ${{ inputs.url }}
43+
- name: Replace the CHECKSUM placeholder
44+
uses: richardrigutins/replace-in-files@v2
45+
with:
46+
files: ./pkgs/chocolatey/tools/chocolateyInstall.ps1
47+
search-text: '@LAUNCHER_SHA256@'
48+
replacement-text: ${{ inputs.digest }}
49+
- name: Build the Chocolatey package (.nupkg)
50+
run: choco pack ./pkgs/chocolatey/scala.nuspec --out ./pkgs/chocolatey
51+
- name: Upload the Chocolatey package to GitHub
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: scala.nupkg
55+
path: ./pkgs/chocolatey/scala.${{ inputs.version }}.nupkg
56+
if-no-files-found: error
57+

.github/workflows/build-sdk.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
###################################################################################################
2+
### THIS IS A REUSABLE WORKFLOW TO BUILD THE SCALA LAUNCHERS ###
3+
### HOW TO USE: ###
4+
### - THSI WORKFLOW WILL PACKAGE THE ALL THE LAUNCHERS AND UPLOAD THEM TO GITHUB ARTIFACTS ###
5+
### ###
6+
### NOTE: ###
7+
### - SEE THE WORFLOW FOR THE NAMES OF THE ARTIFACTS ###
8+
###################################################################################################
9+
10+
11+
name: Build Scala Launchers
12+
run-name: Build Scala Launchers
13+
14+
on:
15+
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+
universal-digest:
25+
description: The SHA256 of the uploaded artifact (universal)
26+
value : ${{ jobs.build.outputs.universal-digest }}
27+
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
universal-id : ${{ steps.universal.outputs.artifact-id }}
34+
universal-digest : ${{ steps.universal-digest.outputs.digest }}
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-java@v4
39+
with:
40+
distribution: temurin
41+
java-version: ${{ inputs.java-version }}
42+
cache : sbt
43+
- uses: sbt/setup-sbt@v1
44+
- name: Build and pack the SDK (universal)
45+
run : ./project/scripts/sbt dist/pack
46+
47+
- name: Upload zip archive to GitHub Artifact (universal)
48+
uses: actions/upload-artifact@v4
49+
id : universal
50+
with:
51+
path: ./dist/target/pack/*
52+
name: scala3-universal
53+
54+
- name: Compute SHA256 of the uploaded artifact (universal)
55+
id : universal-digest
56+
run : |
57+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip -L https://api.github.com/repos/scala/scala3/actions/artifacts/${{ steps.universal.outputs.artifact-id }}/zip
58+
echo "digest=$(sha256sum artifact.zip | cut -d " " -f 1)" >> "$GITHUB_OUTPUT"

.github/workflows/ci.yaml

+45-19
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
## Workaround for https://github.com/actions/runner/issues/2033 (See https://github.com/scala/scala3/pull/19720)
7373
- name: Reset existing repo
7474
run: |
75-
git config --global --add safe.directory /__w/scala3/scala3
75+
git config --global --add safe.directory $GITHUB_WORKSPACE
7676
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
7777
7878
- name: Checkout cleanup script
@@ -125,7 +125,7 @@ jobs:
125125

126126
- name: Reset existing repo
127127
run: |
128-
git config --global --add safe.directory /__w/scala3/scala3
128+
git config --global --add safe.directory $GITHUB_WORKSPACE
129129
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
130130
131131
- name: Checkout cleanup script
@@ -168,7 +168,7 @@ jobs:
168168
- name: Reset existing repo
169169
shell: cmd
170170
run: |
171-
git config --global --add safe.directory /__w/scala3/scala3
171+
git config --global --add safe.directory $GITHUB_WORKSPACE
172172
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
173173
174174
- name: Git Checkout
@@ -212,7 +212,7 @@ jobs:
212212
- name: Reset existing repo
213213
shell: cmd
214214
run: |
215-
git config --global --add safe.directory /__w/scala3/scala3
215+
git config --global --add safe.directory $GITHUB_WORKSPACE
216216
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
217217
218218
- name: Git Checkout
@@ -254,7 +254,7 @@ jobs:
254254

255255
- name: Reset existing repo
256256
run: |
257-
git config --global --add safe.directory /__w/scala3/scala3
257+
git config --global --add safe.directory $GITHUB_WORKSPACE
258258
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
259259
260260
- name: Checkout cleanup script
@@ -301,7 +301,7 @@ jobs:
301301
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
302302
- name: Reset existing repo
303303
run: |
304-
git config --global --add safe.directory /__w/scala3/scala3
304+
git config --global --add safe.directory $GITHUB_WORKSPACE
305305
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
306306
307307
- name: Checkout cleanup script
@@ -318,7 +318,7 @@ jobs:
318318

319319
- name: Test
320320
run: |
321-
git config --global --add safe.directory /__w/scala3/scala3
321+
git config --global --add safe.directory $GITHUB_WORKSPACE
322322
git submodule sync
323323
git submodule update --init --recursive --jobs 7
324324
./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestA"
@@ -355,7 +355,7 @@ jobs:
355355
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
356356
- name: Reset existing repo
357357
run: |
358-
git config --global --add safe.directory /__w/scala3/scala3
358+
git config --global --add safe.directory $GITHUB_WORKSPACE
359359
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
360360
361361
- name: Checkout cleanup script
@@ -372,7 +372,7 @@ jobs:
372372

373373
- name: Test
374374
run: |
375-
git config --global --add safe.directory /__w/scala3/scala3
375+
git config --global --add safe.directory $GITHUB_WORKSPACE
376376
git submodule sync
377377
git submodule update --init --recursive --jobs 7
378378
./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestB"
@@ -409,7 +409,7 @@ jobs:
409409
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
410410
- name: Reset existing repo
411411
run: |
412-
git config --global --add safe.directory /__w/scala3/scala3
412+
git config --global --add safe.directory $GITHUB_WORKSPACE
413413
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
414414
415415
- name: Checkout cleanup script
@@ -426,7 +426,7 @@ jobs:
426426

427427
- name: Test
428428
run: |
429-
git config --global --add safe.directory /__w/scala3/scala3
429+
git config --global --add safe.directory $GITHUB_WORKSPACE
430430
git submodule sync
431431
git submodule update --init --recursive --jobs 7
432432
./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestC"
@@ -462,7 +462,7 @@ jobs:
462462

463463
- name: Reset existing repo
464464
run: |
465-
git config --global --add safe.directory /__w/scala3/scala3
465+
git config --global --add safe.directory $GITHUB_WORKSPACE
466466
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
467467
468468
- name: Checkout cleanup script
@@ -511,7 +511,7 @@ jobs:
511511

512512
- name: Reset existing repo
513513
run: |
514-
git config --global --add safe.directory /__w/scala3/scala3
514+
git config --global --add safe.directory $GITHUB_WORKSPACE
515515
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
516516
517517
- name: Checkout cleanup script
@@ -559,7 +559,7 @@ jobs:
559559
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
560560
- name: Reset existing repo
561561
run: |
562-
git config --global --add safe.directory /__w/scala3/scala3
562+
git config --global --add safe.directory $GITHUB_WORKSPACE
563563
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
564564
565565
- name: Checkout cleanup script
@@ -623,7 +623,7 @@ jobs:
623623
steps:
624624
- name: Reset existing repo
625625
run: |
626-
git config --global --add safe.directory /__w/scala3/scala3
626+
git config --global --add safe.directory $GITHUB_WORKSPACE
627627
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
628628
629629
- name: Checkout cleanup script
@@ -640,7 +640,7 @@ jobs:
640640

641641
- name: Generate Website
642642
run: |
643-
git config --global --add safe.directory /__w/scala3/scala3
643+
git config --global --add safe.directory $GITHUB_WORKSPACE
644644
./project/scripts/genDocs -doc-snapshot
645645
646646
- name: Deploy Website to dotty-website
@@ -678,7 +678,7 @@ jobs:
678678
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
679679
- name: Reset existing repo
680680
run: |
681-
git config --global --add safe.directory /__w/scala3/scala3
681+
git config --global --add safe.directory $GITHUB_WORKSPACE
682682
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
683683
684684
- name: Checkout cleanup script
@@ -707,7 +707,6 @@ jobs:
707707
run: |
708708
./project/scripts/sbt dist/packArchive
709709
sha256sum dist/target/scala3-* > dist/target/sha256sum.txt
710-
echo "RELEASE_TAG=${GITHUB_REF#*refs/tags/}" >> $GITHUB_ENV
711710
712711
- name: Create GitHub Release
713712
id: create_gh_release
@@ -752,7 +751,7 @@ jobs:
752751
asset_content_type: text/plain
753752

754753
- name: Publish Release
755-
run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease"
754+
run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleUpload"
756755

757756

758757
open_issue_on_failure:
@@ -774,3 +773,30 @@ jobs:
774773
WORKFLOW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
775774
with:
776775
filename: .github/workflows/issue_nightly_failed.md
776+
777+
build-sdk-package:
778+
uses: ./.github/workflows/build-sdk.yml
779+
if:
780+
(github.event_name == 'pull_request' && !contains(github.event.pull_request.body, '[skip ci]')) ||
781+
(github.event_name == 'workflow_dispatch' && github.repository == 'scala/scala3') ||
782+
(github.event_name == 'schedule' && github.repository == 'scala/scala3') ||
783+
github.event_name == 'push'
784+
with:
785+
java-version: 8
786+
787+
build-chocolatey-package:
788+
uses: ./.github/workflows/build-chocolatey.yml
789+
needs: [ build-sdk-package ]
790+
with:
791+
version: 3.3.5-local # unused
792+
url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.universal-id }}/zip
793+
digest : ${{ needs.build-sdk-package.outputs.universal-digest }}
794+
795+
test-chocolatey-package:
796+
uses: ./.github/workflows/test-chocolatey.yml
797+
with:
798+
version : 3.3.5-local # unused
799+
java-version: 8
800+
if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]')
801+
needs: [ build-chocolatey-package ]
802+

.github/workflows/dependency-graph.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
- uses: sbt/setup-sbt@v1
1213
- uses: scalacenter/sbt-dependency-submission@v3

.github/workflows/language-reference.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
distribution: 'temurin'
3737
java-version: 17
3838
cache: 'sbt'
39+
- uses: sbt/setup-sbt@v1
3940

4041
- name: Generate reference documentation and test links
4142
run: |
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
###################################################################################################
2+
### THIS IS A REUSABLE WORKFLOW TO PUBLISH SCALA TO CHOCOLATEY ###
3+
### HOW TO USE: ###
4+
### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ###
5+
### - IT WILL PUBLISH TO CHOCOLATEY THE MSI ###
6+
### ###
7+
### NOTE: ###
8+
### - WE SHOULD KEEP IN SYNC THE NAME OF THE MSI WITH THE ACTUAL BUILD ###
9+
### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ###
10+
### - IT ASSUMES THAT THE `build-chocolatey` WORKFLOW WAS EXECUTED BEFORE ###
11+
###################################################################################################
12+
13+
14+
name: Publish Scala to Chocolatey
15+
run-name: Publish Scala ${{ inputs.version }} to Chocolatey
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
version:
21+
required: true
22+
type: string
23+
secrets:
24+
# Connect to https://community.chocolatey.org/profiles/scala
25+
# Accessible via https://community.chocolatey.org/account
26+
API-KEY:
27+
required: true
28+
29+
jobs:
30+
publish:
31+
runs-on: windows-latest
32+
steps:
33+
- name: Fetch the Chocolatey package from GitHub
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: scala.nupkg
37+
- name: Publish the package to Chocolatey
38+
run: choco push scala.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.API-KEY }}
39+

0 commit comments

Comments
 (0)