Skip to content
Closed
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
21 changes: 21 additions & 0 deletions .github/scripts/setup-dev-mill.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e

if [ ! -e "$HOME/.ivy2/local/mill-proguard.jar" ]; then
MILL_COMMIT="de17c958012"

# Adding an extra directory "thing", to work around some Mill issue with scripts
mkdir thing
cd thing
git clone https://github.com/alexarchambault/mill.git -b scala3-new mill-scala3
cd mill-scala3
git switch --detach "$MILL_COMMIT"
./mill -i dist.installLocal
mv mill-proguard.jar "$HOME/.ivy2/local/"
cd ..
cd ..
rm -rf thing
fi

ln -sf "$HOME/.ivy2/local/mill-proguard.jar" mill
chmod +x mill
160 changes: 160 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: CI
on:
push:
branches:
- mill-build
pull_request:

jobs:
compile-all:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
# submodules: true
- uses: coursier/setup-action@v2
- name: Setup Mill
run: .github/scripts/setup-dev-mill.sh
- name: No modules with empty sources
run: ./mill -i ci.noEmptySources --tasks __.allSourceFiles
- name: No orphan sources
run: ./mill -i ci.noOrphanSources --sourceTasks '__.{allSourceFiles,compileResources}'
- name: Compile everything
run: ./mill -i __.compile
- name: Pre-upload artifact
run: |
mv ~/.cache/coursier/v1 coursier-cache
mv ~/.cache/mill mill-cache
if test -d ~/.cache/mill/download; then
chmod +x ~/.cache/mill/download/*
fi
mkdir -p ~/.ivy2/local
mv ~/.ivy2/local ivy2-local
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: out
path: out
if-no-files-found: error
retention-days: 3
- name: Upload coursier cache
uses: actions/upload-artifact@v4
with:
name: coursier-cache
path: coursier-cache
if-no-files-found: error
retention-days: 3
- name: Upload Mill cache
uses: actions/upload-artifact@v4
with:
name: mill-cache
path: mill-cache
if-no-files-found: error
retention-days: 3
- name: Upload ivy2 local
uses: actions/upload-artifact@v4
with:
name: ivy2-local
path: ivy2-local
if-no-files-found: error
retention-days: 3

repl-test:
runs-on: ubuntu-latest
needs: compile-all
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: out
path: out
- uses: actions/download-artifact@v4
with:
name: coursier-cache
path: coursier-cache
- uses: actions/download-artifact@v4
with:
name: mill-cache
path: mill-cache
- uses: actions/download-artifact@v4
with:
name: ivy2-local
path: ivy2-local
- name: Post-download artifacts
run: |
mkdir -p ~/.cache/coursier
mv coursier-cache ~/.cache/coursier/v1
mv mill-cache ~/.cache/mill
if test -d ~/.cache/mill/download; then
chmod +x ~/.cache/mill/download/*
fi
mkdir -p ~/.ivy2
mv ivy2-local ~/.ivy2/local
- uses: coursier/setup-action@v2
- name: Install expect
run: |
sudo apt-get update
sudo apt-get install -y expect
expect -v
- name: Setup Mill
run: .github/scripts/setup-dev-mill.sh
- name: Prepare for REPL test
run: ./mill -i 'repl[final].compile'
- name: Run REPL test
env:
TERM: dumb
run: project/scripts/mill-repl-test.expect

tests:
runs-on: ubuntu-latest
needs: compile-all
name: ${{ matrix.BUILD_TYPE }}
strategy:
fail-fast: false
matrix:
BUILD_TYPE: ["bootstrapping", "final"]
TEST: ["test", "full-test"]
timeout-minutes: 120
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
# submodules: true
- uses: actions/download-artifact@v4
with:
name: out
path: out
- uses: actions/download-artifact@v4
with:
name: coursier-cache
path: coursier-cache
- uses: actions/download-artifact@v4
with:
name: mill-cache
path: mill-cache
- uses: actions/download-artifact@v4
with:
name: ivy2-local
path: ivy2-local
- name: Post-download artifacts
run: |
mkdir -p ~/.cache/coursier
mv coursier-cache ~/.cache/coursier/v1
mv mill-cache ~/.cache/mill
if test -d ~/.cache/mill/download; then
chmod +x ~/.cache/mill/download/*
fi
mkdir -p ~/.ivy2
mv ivy2-local ~/.ivy2/local
- uses: coursier/setup-action@v2
- name: Setup Mill
run: .github/scripts/setup-dev-mill.sh
- name: Test
run: ./mill -i '__[${{ matrix.BUILD_TYPE }}].${{ matrix.TEST }}'
env:
DOTTY_CI_RUN: true
105 changes: 105 additions & 0 deletions build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//| mill-version: 1.1.2
//| bspScriptIgnore:
//| - ".plasmon/"
//| - "bench/"
//| - "bin/"
//| - "community-build/"
//| - "compiler/test/"
//| - "compiler/test-resources/"
//| - "language-server/"
//| - "project/"
//| - "repl/test/"
//| - "repl/test-resources/"
//| - "sandbox/"
//| - "sbt-test/"
//| - "scaladoc/"
//| - "scaladoc-js/"
//| - "sjs-compiler-tests/"
//| - "tests/"

package build

import mill.*
import mill.util.Tasks
import mill.api.BuildCtx
import mill.constants.OutFiles

object ci extends Module {

val allowEmptySources = Set(
"sjs-compiler-tests.bootstrapping",
"sjs-compiler-tests.final"
)

def noEmptySources(tasks: mill.util.Tasks[Seq[PathRef]]) = Task.Command[Unit] {
val values = tasks.value.zip(Task.sequence(tasks.value)())
val invalid = values
.filter(_._2.isEmpty)
.filter {
case (m, _) =>
val moduleName = m.toString.stripSuffix(".allSourceFiles")
!allowEmptySources.contains(moduleName)
}

if (invalid.nonEmpty) {
System.err.println("Found modules with no sources:")
for ((m, _) <- invalid)
System.err.println(s" $m")
sys.error(s"Found modules with no sources: ${invalid.map(_._1).mkString(", ")}")
}
}

def noOrphanSources(sourceTasks: Tasks[Seq[PathRef]]) = Task.Command[Unit] {
val allSources = Task.sequence(sourceTasks.value)()
.flatten
.map(_.path)
.filter(_.startsWith(BuildCtx.workspaceRoot))
.flatMap { path =>
if (os.isDir(path)) os.walk(path)
else Seq(path)
}
.map(_.subRelativeTo(BuildCtx.workspaceRoot))
.toSet

val ignore = Seq[os.SubPath](
"bench",
"bench-micro",
"bench-run",
"bin",
"library-aux", // Unused directory?
// See comment in library-js/package.mill about these two
"library-js/src/scala/math/ScalaNumber.scala",
"library-js/src/scala/runtime/BoxesRunTime.scala",
"mill-build",
"project",
"sbt-test",
"tests"
)

val outDir = BuildCtx.workspaceRoot / OutFiles.OutFiles.out
val foundFiles = os.walk(
BuildCtx.workspaceRoot,
skip = p =>
p.startsWith(outDir) || {
val subPath = p.subRelativeTo(BuildCtx.workspaceRoot)
(subPath.segments.length == 1 && subPath.segments.head.startsWith(".")) ||
ignore.exists(subPath.startsWith)
}
)
val foundSources = foundFiles
.filter(_.last.endsWith(".scala"))
.filter(os.isFile)
.map(_.subRelativeTo(BuildCtx.workspaceRoot))

pprint.err.log(foundSources.length)

val orphanSources = foundSources.filter(!allSources.contains(_))

if (orphanSources.nonEmpty) {
System.err.println(" Found orphan sources:")
for (f <- orphanSources)
System.err.println(s" $f")
sys.error("Found orphan sources")
}
}
}
26 changes: 26 additions & 0 deletions community-build/package.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package build.`community-build`

import scala3build.*

import mill.*
import mill.scalalib.*

object `package` extends Scala3Module {
def moduleDeps = super.moduleDeps ++ Seq(
build.library(buildType)
)
def buildType = BuildType.Bootstrapping

def testSrc = Task.Source("test")

object test extends Scala3Tests {
def testSources = Task {
Seq(testSrc())
}

def testArgsDefault = super.testArgsDefault() ++ Seq(
"--include-categories=dotty.communitybuild.TestCategory",
"--run-listener=dotty.communitybuild.FailureSummarizer"
)
}
}
Loading
Loading