Skip to content
Open
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
54 changes: 54 additions & 0 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
###################################################################################################
### THIS IS A REUSABLE WORKFLOW TO BUILD SCALA DEB ###
### HOW TO USE: ###
### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ###
### - IT WILL UPLOAD TO GITHUB THE DEB FILE FOR SCALA UNDER THE 'scala.deb' NAME ###
### ###
### NOTE: ###
### - SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17 ###
###################################################################################################

name: Build the Debian Package

on:
workflow_call:
outputs:
version:
description: 'The full Scala version, from sbt (scala3-compiler-bootstrapped/version)'
value: ${{ jobs.build.outputs.version }}

env:
# Release only happens when triggering CI by pushing a tag
RELEASEBUILD: ${{ startsWith(github.event.ref, 'refs/tags/') && 'yes' || 'no' }}

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: 17
cache: sbt
- uses: sbt/setup-sbt@bfea3c5f48abd221b04a6df4798aa5eb8b6a2baf # v1.5.6
- name: Ensure Debian build tooling
run: |
command -v dpkg-deb >/dev/null && command -v fakeroot >/dev/null \
|| (sudo apt-get update && sudo apt-get install -y --no-install-recommends dpkg-dev fakeroot)
- name: Extract Scala version
id: extract-version
shell: bash
run: |
version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Extracted Scala version: $version"
- name: Build the .deb package
run: ./project/scripts/sbt "dist-linux-x86_64-deb/Debian/packageBin"
- name: Upload deb Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: scala.deb
path: ./dist/linux-x86_64-deb/target/scala.deb
8 changes: 4 additions & 4 deletions .github/workflows/build-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### - IT WILL UPLOAD TO GITHUB THE MSI FILE FOR SCALA UNDER THE 'scala.msi' NAME ###
### ###
### NOTE: ###
### - WE SHOULD BUILD SCALA USING JAVA 8 ###
### - SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17 ###
###################################################################################################

name: Build the MSI Package
Expand All @@ -14,14 +14,14 @@ on:
workflow_call:
outputs:
version:
description: 'The developed Scala version (major.minor.patch) extracted from project/Build.scala'
description: 'The full Scala version, from sbt (scala3-compiler-bootstrapped/version)'
value: ${{ jobs.build.outputs.version }}

permissions:
contents: read

env:
# Release only happends when triggering CI by pushing tag
# Release only happens when triggering CI by pushing a tag
RELEASEBUILD: ${{ startsWith(github.event.ref, 'refs/tags/') && 'yes' || 'no' }}

jobs:
Expand All @@ -40,7 +40,7 @@ jobs:
id: extract-version
shell: bash
run: |
version=$(sed -n 's/.*val developedVersion = "\(.*\)".*/\1/p' project/Build.scala)
version=$(sbt -no-colors "print scala3-compiler-bootstrapped/version" | tr -d '\r' | tail -n1)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Extracted Scala version: $version"
- name: Build MSI package
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
###################################################################################################
### THIS IS A REUSABLE WORKFLOW TO BUILD SCALA RPM ###
### HOW TO USE: ###
### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ###
### - IT WILL UPLOAD TO GITHUB THE RPM FILE FOR SCALA UNDER THE 'scala.rpm' NAME ###
### ###
### NOTE: ###
### - SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17 ###
### - rpmbuild is provided by the `rpm` apt package (cross-distro build tool) ###
###################################################################################################

name: Build the RPM Package

on:
workflow_call:
outputs:
version:
description: 'The full Scala version, from sbt (scala3-compiler-bootstrapped/version)'
value: ${{ jobs.build.outputs.version }}

env:
# Release only happens when triggering CI by pushing a tag
RELEASEBUILD: ${{ startsWith(github.event.ref, 'refs/tags/') && 'yes' || 'no' }}

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: 17
cache: sbt
- uses: sbt/setup-sbt@bfea3c5f48abd221b04a6df4798aa5eb8b6a2baf # v1.5.6
- name: Ensure RPM build tooling
run: command -v rpmbuild >/dev/null || (sudo apt-get update && sudo apt-get install -y rpm)
- name: Extract Scala version
id: extract-version
shell: bash
run: |
version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Extracted Scala version: $version"
- name: Build the .rpm package
run: ./project/scripts/sbt "dist-linux-x86_64-rpm/Rpm/packageBin"
- name: Upload rpm Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: scala.rpm
path: ./dist/linux-x86_64-rpm/target/rpm/scala.rpm
50 changes: 50 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,30 @@ jobs:
mv scala.msi "${msiInstaller}"
sha256sum "${msiInstaller}" > "${msiInstaller}.sha256"

- name: Download deb package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: scala.deb
path: .
- name: Prepare deb package
shell: bash
run: |
debInstaller="scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.deb"
mv scala.deb "${debInstaller}"
sha256sum "${debInstaller}" > "${debInstaller}.sha256"

- name: Download rpm package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: scala.rpm
path: .
- name: Prepare rpm package
shell: bash
run: |
rpmInstaller="scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.rpm"
mv scala.rpm "${rpmInstaller}"
sha256sum "${rpmInstaller}" > "${rpmInstaller}.sha256"

- name: Install GH CLI
uses: dev-hanz-ops/install-gh-cli-action@af38ce09b1ec248aeb08eea2b16bbecea9e059f8 # v0.2.1
with:
Expand Down Expand Up @@ -251,6 +275,8 @@ jobs:
--verify-tag ${{ env.RELEASE_TAG }} \
scala3-${{ env.RELEASE_TAG }}*.zip \
scala3-${{ env.RELEASE_TAG }}*.tar.gz \
scala3-${{ env.RELEASE_TAG }}*.deb \
scala3-${{ env.RELEASE_TAG }}*.rpm \
scala3-${{ env.RELEASE_TAG }}*.sha256 \
scala3-${{ env.RELEASE_TAG }}.msi

Expand Down Expand Up @@ -379,6 +405,30 @@ jobs:
version: ${{ needs.build-msi-package.outputs.version }}
java-version: 17

build-deb-package:
uses: ./.github/workflows/build-deb.yml
if :
(github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_deb]')) ||
(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))

test-deb-package:
uses: ./.github/workflows/test-deb.yml
needs: [build-deb-package]
with:
version: ${{ needs.build-deb-package.outputs.version }}

build-rpm-package:
uses: ./.github/workflows/build-rpm.yml
if :
(github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_rpm]')) ||
(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))

test-rpm-package:
uses: ./.github/workflows/test-rpm.yml
needs: [build-rpm-package]
with:
version: ${{ needs.build-rpm-package.outputs.version }}

build-sdk-package:
uses: ./.github/workflows/build-sdk.yml
permissions:
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/test-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
###################################################################################################
### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH DEB RUNNER ###
### HOW TO USE: ###
### `version` is the expected Scala version; the installed scala/scalac/scaladoc ###
### are asserted to report it, then a program is compiled and run. ###
### NOTE: Requires `scala.deb` artifact uploaded within the same run ###
### ###
###################################################################################################

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

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

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- debian:12
- debian:13
- ubuntu:22.04
- ubuntu:24.04
container: ${{ matrix.image }}
env:
VERSION: ${{ inputs.version }}
steps:
- name: Download deb artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: scala.deb
path: .

- name: Install Scala Runner
run: |
apt-get update
apt-get install -y ./scala.deb

- name: Verify installation layout
run: |
set -e
echo "Checking /usr/bin/scala symlink..."
test -L /usr/bin/scala
test "$(readlink -f /usr/bin/scala)" = /usr/share/scala3/bin/scala

echo "Checking VERSION file..."
test -f /usr/share/scala3/VERSION
cat /usr/share/scala3/VERSION

echo "Checking scala-cli launcher..."
test -x /usr/share/scala3/libexec/scala-cli

echo "Checking maven2 directory..."
test -d /usr/share/scala3/maven2

- name: Test Scala Runner
run: |
out="$(scala --version)"; echo "$out"
echo "$out" | grep -qF "Scala version (default): $VERSION"
- name: Test the `scalac` command
run: |
out="$(scalac --version)"; echo "$out"
echo "$out" | grep -qF "Scala compiler version $VERSION"
- name: Test the `scaladoc` command
run: |
out="$(scaladoc --version)"; echo "$out"
echo "$out" | grep -qF "Scaladoc version $VERSION"

- name: Smoke test - compile and run
run: |
echo '@main def test() = println("Hello from Scala")' > test.scala
scala run --server=false test.scala

- name: Uninstall the `scala` package
run: apt-get remove -y scala3
95 changes: 95 additions & 0 deletions .github/workflows/test-rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
###################################################################################################
### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH RPM RUNNER ###
### HOW TO USE: ###
### `version` is the expected Scala version; the installed scala/scalac/scaladoc ###
### are asserted to report it, then a program is compiled and run. ###
### NOTE: Requires `scala.rpm` artifact uploaded within the same run ###
### ###
###################################################################################################

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

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

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- fedora:43
- fedora:latest
- almalinux:9
- almalinux:10
- opensuse/leap:16.0
- opensuse/tumbleweed
container: ${{ matrix.image }}
env:
VERSION: ${{ inputs.version }}
steps:
- name: Download rpm artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: scala.rpm
path: .

- name: Install Scala Runner
run: |
if command -v dnf >/dev/null; then
dnf install -y ./scala.rpm
elif command -v zypper >/dev/null; then
zypper --non-interactive --gpg-auto-import-keys refresh
zypper --non-interactive install --allow-unsigned-rpm ./scala.rpm
else
echo "No supported package manager (dnf/zypper) found"; exit 1
fi

- name: Verify installation layout
run: |
set -e
echo "Checking /usr/bin/scala symlink..."
test -L /usr/bin/scala
test "$(readlink -f /usr/bin/scala)" = /usr/share/scala3/bin/scala

echo "Checking VERSION file..."
test -f /usr/share/scala3/VERSION
cat /usr/share/scala3/VERSION

echo "Checking scala-cli launcher..."
test -x /usr/share/scala3/libexec/scala-cli

echo "Checking maven2 directory..."
test -d /usr/share/scala3/maven2

- name: Test Scala Runner
run: |
out="$(scala --version)"; echo "$out"
echo "$out" | grep -qF "Scala version (default): $VERSION"
- name: Test the `scalac` command
run: |
out="$(scalac --version)"; echo "$out"
echo "$out" | grep -qF "Scala compiler version $VERSION"
- name: Test the `scaladoc` command
run: |
out="$(scaladoc --version)"; echo "$out"
echo "$out" | grep -qF "Scaladoc version $VERSION"

- name: Smoke test - compile and run
run: |
echo '@main def test() = println("Hello from Scala")' > test.scala
scala run --server=false test.scala

- name: Uninstall the `scala` package
run: |
if command -v dnf >/dev/null; then
dnf remove -y scala3
elif command -v zypper >/dev/null; then
zypper --non-interactive remove scala3
fi
Loading
Loading