Skip to content

Commit

Permalink
Scala 3.6.x preparations (#313)
Browse files Browse the repository at this point in the history
Also fixes the test, previously this was testing sbt on the build server instead of the docker image.
  • Loading branch information
francisdb authored Dec 11, 2024
1 parent 98aac05 commit ac98511
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 36 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
scalaVersion: ['2.12.20', '2.13.15', '3.3.4', '3.5.2']
javaTag: [
Expand Down Expand Up @@ -122,19 +123,17 @@ jobs:
SCALA_VERSION=${{ matrix.scalaVersion }}
load: true
- name: Test docker image as root (default)
if: ${{ !startsWith(matrix.scalaVersion, '2.12') }}
if: ${{ !startsWith(matrix.scalaVersion, '2.12') && !contains(matrix.baseImageTag, 'alpine') }}
# scala --version does not work on < 2.13
# sbt --script-version does not work on alpine https://github.com/sbt/sbt/issues/7942
run: |
docker run "${{ steps.create_docker_tag.outputs.TAG }}" \
scala --version &&
sbt about
docker run "${{ steps.create_docker_tag.outputs.TAG }}" /bin/bash -c "scala --version && sbt --script-version"
- name: Test docker image scala as sbtuser
if: ${{ !startsWith(matrix.scalaVersion, '2.12') }}
if: ${{ !startsWith(matrix.scalaVersion, '2.12') && !contains(matrix.baseImageTag, 'alpine') }}
# scala --version does not work on < 2.13
# sbt --script-version does not work on alpine https://github.com/sbt/sbt/issues/7942
run: |
docker run -u sbtuser -w /home/sbtuser "${{ steps.create_docker_tag.outputs.TAG }}" \
scala --version &&
sbt about
docker run -u sbtuser -w /home/sbtuser "${{ steps.create_docker_tag.outputs.TAG }}" /bin/bash -c "scala --version && sbt --script-version"
- name: Log in to DockerHub
if: github.event_name != 'pull_request' && github.actor != 'dependabot[bot]'
uses: docker/login-action@v3
Expand Down
12 changes: 7 additions & 5 deletions amazoncorretto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ RUN \
# Install Scala
RUN \
case $SCALA_VERSION in \
"3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \
*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \
2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \
esac && \
curl -fsL --show-error $URL | tar xfz - -C /usr/share && \
mkdir -p $EXTRACT_DIR && \
curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \
mv $SCALA_DIR /usr/share/scala && \
chown -R root:root /usr/share/scala && \
chmod -R 755 /usr/share/scala && \
ln -s /usr/share/scala/bin/* /usr/local/bin && \
mkdir -p /test && \
case $SCALA_VERSION in \
"3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \
*) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \
2*) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \
*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \
esac && \
scala -nocompdaemon test/test.scala && \
rm -fr test
Expand Down
12 changes: 7 additions & 5 deletions eclipse-temurin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@ RUN \
# Install Scala
RUN \
case $SCALA_VERSION in \
"3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \
*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \
2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \
esac && \
curl -fsL --show-error $URL | tar xfz - -C /usr/share && \
mkdir -p $EXTRACT_DIR && \
curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \
mv $SCALA_DIR /usr/share/scala && \
chown -R root:root /usr/share/scala && \
chmod -R 755 /usr/share/scala && \
ln -s /usr/share/scala/bin/* /usr/local/bin && \
mkdir -p /test && \
case $SCALA_VERSION in \
"3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \
*) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \
2*) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \
*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \
esac && \
scala -nocompdaemon test/test.scala && \
rm -fr test
Expand Down
14 changes: 8 additions & 6 deletions eclipse-temurin/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ RUN apk add --no-cache --virtual=.build-dependencies wget ca-certificates bash c
RUN \
cd "/tmp" && \
case $SCALA_VERSION in \
"3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=scala3-$SCALA_VERSION ;; \
*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=scala-$SCALA_VERSION ;; \
2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \
esac && \
curl -fsL --show-error $URL | tar xfz - -C /usr/share && \
mv /usr/share/$SCALA_DIR $SCALA_HOME && \
mkdir -p $EXTRACT_DIR && \
curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \
mv $SCALA_DIR $SCALA_HOME && \
ln -s "$SCALA_HOME/bin/"* "/usr/bin/" && \
update-ca-certificates && \
scala -version && \
case $SCALA_VERSION in \
"3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
esac && \
scala -nocompdaemon test.scala && rm test.scala

Expand Down
13 changes: 7 additions & 6 deletions graalvm-ce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@ RUN \
ln -s /usr/share/sbt/bin/sbt /usr/local/bin/sbt

# Install Scala
## Piping curl directly in tar
RUN \
case $SCALA_VERSION in \
"3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \
*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \
2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \
esac && \
curl -fsL --show-error $URL | tar xfz - -C /usr/share && \
mkdir -p $EXTRACT_DIR && \
curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \
mv $SCALA_DIR /usr/share/scala && \
chown -R root:root /usr/share/scala && \
chmod -R 755 /usr/share/scala && \
ln -s /usr/share/scala/bin/* /usr/local/bin && \
case $SCALA_VERSION in \
"3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
esac && \
scala -nocompdaemon test.scala && rm test.scala

Expand Down
13 changes: 7 additions & 6 deletions graalvm-community/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@ RUN \
ln -s /usr/share/sbt/bin/sbt /usr/local/bin/sbt

# Install Scala
## Piping curl directly in tar
RUN \
case $SCALA_VERSION in \
"3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \
*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \
2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \
*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \
esac && \
curl -fsL --show-error $URL | tar xfz - -C /usr/share && \
mkdir -p $EXTRACT_DIR && \
curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \
mv $SCALA_DIR /usr/share/scala && \
chown -R root:root /usr/share/scala && \
chmod -R 755 /usr/share/scala && \
ln -s /usr/share/scala/bin/* /usr/local/bin && \
case $SCALA_VERSION in \
"3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
esac && \
scala -nocompdaemon test.scala && rm test.scala

Expand Down

0 comments on commit ac98511

Please sign in to comment.