Skip to content

Commit

Permalink
Shrink CI matrix (#1547)
Browse files Browse the repository at this point in the history
* We probably only need to each on each Java and Scala version once,
rather than on the full cross matrix of all combinations.
* We probably don't need to test every PR with every single Scala
version. For now, for each Scala major version I picked three minor
versions: highest, lowest, and one in the middle.
* Replaced `__.publishLocal` with `__.compile`, which should hopefully
catch most of the same bugs but be much cheaper not creating jars
* I suspect the `unitTest` and `integrationTest` helper tasks were not
doing the right thing - they were taking far longer than they should
have been taking - but I couldn't figure out why. For now I just ditched
them and use Mill queries to select the tests I want manually
* Turned on Mill parallelism
* We drop CI for Java 8, in line with the rest of the com-lihaoyi
ecosystem

Hopefully that will give us enough confidence that things mostly work,
and if anything emerges that's super version specific we can fix it
ad-hoc without needing to wait 40+ hours of CPU time for every PR to be
validated
lihaoyi authored Sep 11, 2024
1 parent cb4b372 commit 2668a43
Showing 3 changed files with 50 additions and 55 deletions.
74 changes: 30 additions & 44 deletions .github/workflows/actions.yml → .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Run Tests
on:
push:
branches:
@@ -17,57 +17,47 @@ jobs:
strategy:
fail-fast: false
matrix:
java-version: [ 8, 17 ]
scala-binary-version: [ 2.12, 2.13, 3.3, 3.4.2 ]
include:
# Including lowest/highest versions that work with Java 21
- java-version: 21
scala-version: 2.12.18
- java-version: 21
scala-version: 2.12.19
- java-version: 21
scala-version: 2.13.11
- java-version: 21
scala-version: 2.13.14
- java-version: 21
scala-version: 3.3.1
- java-version: 11
command: 'terminal.__.test'

- java-version: 11
command: 'sshd[{2.12.19,2.13.14,3.3.3,3.4.2}].__.test'

- java-version: 11
command: 'amm.repl[2.12.{9,14,19}].__.test'
- java-version: 17
command: 'amm.repl[2.13.{4,9,14}].__.test'
- java-version: 21
scala-version: 3.3.3
command: 'amm.repl[{3.3.3,3.4.2}].__.test'

- java-version: 11
command: 'amm[2.12.{9,14,19}].__.test'
- java-version: 17
command: 'amm[2.13.{4,9,14}].__.test'
- java-version: 21
scala-version: 3.4.2
command: 'amm[{3.3.3,3.4.2}].__.test'

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
- run: ./mill -i -k unitTest "${{ matrix.scala-version }}"
- run: ./mill -i -k -j4 "${{ matrix.command }}"

itest:
strategy:
fail-fast: false
matrix:
java-version: [ 8, 17 ]
scala-version: [ 2.12, 2.13, 3.3, 3.4.2 ]
include:
# Including lowest/highest versions that work with Java 21
- java-version: 21
scala-version: 2.12.18
- java-version: 21
scala-version: 2.12.19
- java-version: 21
scala-version: 2.13.11
- java-version: 21
scala-version: 2.13.14
- java-version: 11
scala-version: '2.12.{9,14,19}'
- java-version: 17
scala-version: '2.13.{4,9,14}'
- java-version: 21
scala-version: 3.3.1
- java-version: 21
scala-version: 3.3.3
- java-version: 21
scala-version: 3.4.2
scala-version: '{3.3.3,3.4.2}'

runs-on: ubuntu-latest
steps:
@@ -78,7 +68,7 @@ jobs:
with:
java-version: ${{ matrix.java-version }}
distribution: temurin
- run: ./mill -i -k integrationTest ${{ matrix.scala-version }}
- run: ./mill -i -k 'integration[${{ matrix.scala-version }}].__.test'

site:
runs-on: ubuntu-latest
@@ -95,29 +85,25 @@ jobs:
env:
TERM: xterm-256color

publishLocal:
compileAll:
strategy:
fail-fast: false
matrix:
scala-version: [ 2.12.19, 2.13.14, 3.3.3, 3.4.2 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
- run: ./mill -i -k __[${{ matrix.scala-version }}].__.publishLocal
- run: ./mill -i -k -j4 '__.compile'

release:
if: github.repository == 'com-lihaoyi/Ammonite' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.x')
needs: [ test, itest, site, publishLocal ]
needs: [ test, itest, site, compileAll ]
uses: ./.github/workflows/release.yml
secrets: inherit

publishDosc:
publishDocs:
if: github.repository == 'com-lihaoyi/Ammonite' && github.ref == 'refs/heads/main'
needs: [ test, itest, site ]
uses: ./.github/workflows/publishDocs.yml
11 changes: 7 additions & 4 deletions amm/repl/src/test/scala/ammonite/session/ProjectTests.scala
Original file line number Diff line number Diff line change
@@ -184,9 +184,12 @@ object ProjectTests extends TestSuite {
}

test("finagle") {
val s = new java.net.ServerSocket(0);
val port = s.getLocalPort
s.close()
// Prevent regressions when wildcard-importing things called `macro` or `_`
check.session("""
@ import $ivy.`com.twitter::finagle-http:21.4.0 compat`
check.session(s"""
@ import $$ivy.`com.twitter::finagle-http:21.4.0 compat`

@ import com.twitter.finagle._, com.twitter.util._

@@ -203,9 +206,9 @@ object ProjectTests extends TestSuite {
@ }
@ }

@ val server = Http.serve(":8080", service)
@ val server = Http.serve(":$port", service)

@ val client: Service[http.Request, http.Response] = Http.client.newService(":8080")
@ val client: Service[http.Request, http.Response] = Http.client.newService(":$port")

@ val request = http.Request(http.Method.Get, "/")

20 changes: 13 additions & 7 deletions build.sc
Original file line number Diff line number Diff line change
@@ -33,16 +33,22 @@ val isPublishableCommit =
publishBranches.exists(suffix => x.endsWith(s"/${suffix}"))
)

val latestTaggedVersion = os.proc("git", "describe", "--abbrev=0", "--tags").call().out.trim
val latestTaggedVersion = try{
os.proc("git", "describe", "--abbrev=0", "--tags").call().out.trim
}catch{case e: os.SubprocessException =>
"dev"
}

val gitHead = os.proc("git", "rev-parse", "HEAD").call().out.trim

val commitsSinceTaggedVersion = {
os.proc("git", "rev-list", gitHead, "--not", latestTaggedVersion, "--count")
.call()
.out
.trim
.toInt
val commitsSinceTaggedVersion = latestTaggedVersion match{
case "dev" => 0
case latest =>
os.proc("git", "rev-list", gitHead, "--not", latest, "--count")
.call()
.out
.trim
.toInt
}

//val isJava21 = scala.util.Properties.isJavaAtLeast(21).tap {

0 comments on commit 2668a43

Please sign in to comment.