Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 42 additions & 0 deletions .github/actions/setup-mill/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Set up Mill
description: Set up the JDK and dependency cache, optionally restoring compiled Mill output.
inputs:
artifact-id:
description: Compiled output artifact to restore; omit when compiling from source.
required: false
default: ""
runs:
using: composite
steps:
- name: Fetch git tags
shell: bash
run: git fetch -f --depth=1 origin '+refs/tags/*:refs/tags/*'

- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "21"

- name: Cache Mill and Coursier
uses: actions/cache@v5
with:
path: |
~/.cache/mill
~/.cache/coursier
key: ${{ runner.os }}-mill-${{ hashFiles('build.mill', '**/*.mill') }}
restore-keys: |
${{ runner.os }}-mill-

- name: Download compiled output
if: inputs.artifact-id != ''
uses: actions/download-artifact@v8.0.2
with:
artifact-ids: ${{ inputs.artifact-id }}
path: ${{ runner.temp }}/mill-compiled

- name: Restore compiled output
if: inputs.artifact-id != ''
shell: bash
run: tar -xzf "$RUNNER_TEMP/mill-compiled/mill-compiled.tar.gz"

14 changes: 14 additions & 0 deletions .github/actions/test-instrumentation/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Test instrumentation
description: Run one instrumentation test group using the prepared Mill environment.
inputs:
group:
description: Instrumentation group to run (akka, pekko, play, or other).
required: true
runs:
using: composite
steps:
- name: Run instrumentation tests
shell: bash
env:
INSTRUMENTATION_GROUP: ${{ inputs.group }}
run: python3 "$GITHUB_ACTION_PATH/test-instrumentation.py" "$INSTRUMENTATION_GROUP"
54 changes: 54 additions & 0 deletions .github/actions/test-instrumentation/test-instrumentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""Resolve and run a disjoint group of instrumentation tests."""

import argparse
import subprocess


MODULE_GROUPS = {
"akka": {"akka", "akkaHttp", "akkaGrpc", "alpakkaKafka", "lagom"},
"pekko": {"pekko", "pekkoHttp", "pekkoGrpc", "pekkoConnectorsKafka"},
"play": {"play"},
}


def task_group(task):
module = task.removeprefix("instrumentation.").split("[", 1)[0].split(".", 1)[0]
for group, modules in MODULE_GROUPS.items():
if module in modules:
return group
return "other"


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("group", choices=[*MODULE_GROUPS, "other"])
parser.add_argument("--list", action="store_true", help="List tasks without running tests")
args = parser.parse_args()

resolved = subprocess.check_output(
["./mill", "--no-daemon", "resolve", "instrumentation.__.testForked"],
text=True,
)
tasks = [
line.strip()
for line in resolved.splitlines()
if line.strip().startswith("instrumentation.")
and line.strip().endswith(".testForked")
]
selected = [task for task in tasks if task_group(task) == args.group]
if not selected:
parser.exit(1, f"No instrumentation tests resolved for group {args.group!r}\n")

print("\n".join(selected), flush=True)
if not args.list:
selectors = []
for task in selected:
if selectors:
selectors.append("+")
selectors.append(task)
subprocess.run(["./mill", "--no-daemon", "-j", "1", *selectors], check=True)


if __name__ == "__main__":
main()
208 changes: 183 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test all the things
name: CI

on:
"on":
pull_request:
push:
branches:
Expand All @@ -11,26 +11,184 @@ env:
JVM_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch -f --depth=1 origin '+refs/tags/*:refs/tags/*'
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
with:
jvm: zulu:17
apps: sbt
- name: Test
run: sbt -v ";+core/test;+instrumentation/test;+reporters/test"
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
with:
jvm: zulu:17
apps: sbt
- name: Test
run: sbt -v "+scalafmtCheckAll;scalafmtSbtCheck"
compile:
name: Compile everything
runs-on: ubuntu-26.04
outputs:
artifact-id: ${{ steps.compiled.outputs.artifact-id }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill

- name: Verify build loading
run: ./mill --no-daemon version

- name: Check Scala formatting
run: ./mill --no-daemon mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll

- name: Compile all modules
run: ./mill --no-daemon '__.compile'

- name: Archive compiled output
run: |
tar -czf "$RUNNER_TEMP/mill-compiled.tar.gz" \
--exclude='out/mill-daemon' \
--exclude='out/mill-no-daemon' \
--exclude='out/mill-out-lock' \
--exclude='out/mill-worker-*' \
out

- name: Get short commit SHA
id: commit
run: echo "short-sha=${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT"

- name: Upload compiled output
id: compiled
uses: actions/upload-artifact@v7.0.2
with:
name: mill-compiled-${{ steps.commit.outputs.short-sha }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/mill-compiled.tar.gz
if-no-files-found: error
compression-level: 0

core:
name: Run core tests
needs: compile
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Test core modules
run: ./mill --no-daemon 'core.__.testForked'

instrumentation-akka:
name: Run Akka tests
needs: [compile, core]
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Test Akka instrumentation
uses: ./.github/actions/test-instrumentation
with:
group: akka

instrumentation-pekko:
name: Run Pekko tests
needs: [compile, core]
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Test Pekko instrumentation
uses: ./.github/actions/test-instrumentation
with:
group: pekko

instrumentation-play:
name: Run Play tests
needs: [compile, core]
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Test Play instrumentation
uses: ./.github/actions/test-instrumentation
with:
group: play

instrumentation-other:
name: Run all other tests
needs: [compile, core]
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Test other instrumentation
uses: ./.github/actions/test-instrumentation
with:
group: other

exporters:
name: Run reporter tests
needs: [compile, core]
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Test reporters
run: ./mill --no-daemon -j 1 'reporters.__.testForked'

bundle:
name: Verify release packaging
needs: [compile, core]
runs-on: ubuntu-26.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Mill
uses: ./.github/actions/setup-mill
with:
artifact-id: ${{ needs.compile.outputs.artifact-id }}

- name: Verify published bundles
run: ./mill --no-daemon 'bundle.bundle.__.verifyJar'

- name: Generate release artifacts
run: ./mill --no-daemon '__.publishArtifacts'
57 changes: 44 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,54 @@ on:

jobs:
release:
runs-on: ubuntu-latest
runs-on: ubuntu-26.04
env:
JAVA_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- uses: actions/checkout@v4
- run: git fetch -f --depth=1 origin '+refs/tags/*:refs/tags/*'
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
- name: Checkout repository
uses: actions/checkout@v5
with:
jvm: zulu:17
apps: sbt
- name: Release
run: sbt ";+instrumentation/publishLocal; release"
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}

- name: Fetch git tags
run: git fetch -f --depth=1 origin '+refs/tags/*:refs/tags/*'

- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '21'

- name: Cache Mill and Coursier
uses: actions/cache@v5
with:
path: |
~/.cache/mill
~/.cache/coursier
key: ${{ runner.os }}-mill-${{ hashFiles('build.mill', '**/*.mill') }}
restore-keys: |
${{ runner.os }}-mill-

- name: Verify published bundles
run: ./mill --no-daemon 'bundle.bundle.__.verifyJar'

- name: Publish to Maven Central
run: |
if [ -n "$MILL_PGP_SECRET_BASE64" ]; then
if ! echo "$MILL_PGP_SECRET_BASE64" | base64 -d > /dev/null 2>&1; then
export MILL_PGP_SECRET_BASE64="$(echo "$MILL_PGP_SECRET_BASE64" | base64 -w 0)"
fi
fi
./mill --no-daemon mill.javalib.SonatypeCentralPublishModule/publishAll
shell: bash
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MILL_SONATYPE_USERNAME: ${{ secrets.MILL_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
MILL_SONATYPE_PASSWORD: ${{ secrets.MILL_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
MILL_PGP_SECRET_BASE64: ${{ secrets.MILL_PGP_SECRET_BASE64 || secrets.MILL_PGP_SECRET || secrets.PGP_SECRET }}
MILL_PGP_PASSPHRASE: ${{ secrets.MILL_PGP_PASSPHRASE || secrets.PGP_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.MILL_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.MILL_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
PGP_SECRET: ${{ secrets.MILL_PGP_SECRET_BASE64 || secrets.MILL_PGP_SECRET || secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.MILL_PGP_PASSPHRASE || secrets.PGP_PASSPHRASE }}
Loading
Loading