Skip to content

Commit

Permalink
Allow to bisect against specific project revision
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Jul 17, 2023
1 parent 344141b commit b0cfb7b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/buildBisect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
type: string
description: "List of project targets to builds (comma deliomited)"
default: ""
project-revision:
type: string
description: "Specific version of project to bisect against"
default: ""
repository-url:
type: string
description: "GitHub repository URL for compiler to build"
Expand Down Expand Up @@ -66,6 +70,7 @@ jobs:
cd ${{ github.workspace }}/compiler
scala-cli ${{ github.workspace }}/opencb/scripts/bisect.scala -- \
--project-name=${{ inputs.project-name }} \
--project-revision=${{ inputs.project-revision }}
--targets=${{ inputs.project-targets }} \
--releases=${{ inputs.scala-version-start}}..${{ inputs.scala-version-end}} \
--extra-scalac-options=${{ inputs.extra-scalac-options }} \
Expand Down
3 changes: 2 additions & 1 deletion project-builder/checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ branch=""
if [ -n "$rev" ]; then
branch="-b $rev"
fi
git clone --quiet "$repo" "$repoDir" $branch
git clone --quiet "$repo" "$repoDir" $branch ||
( git clone --quiet "$repo" "$repoDir" && git checkout $rev )
11 changes: 10 additions & 1 deletion scripts/bisect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ end run

case class ValidationCommand(
projectName: String = "",
revision: Option[String] = None,
targets: String = "",
extraScalacOptions: String = "",
disabledScalacOption: String = ""
Expand All @@ -58,6 +59,7 @@ case class Config(

lazy val remoteValidationScript: File = ValidationScript.buildProject(
projectName = command.projectName,
projectRevision = command.revision,
targets = Option(command.targets).filter(_.nonEmpty),
extraScalacOptions = command.extraScalacOptions,
disabledScalacOption = command.disabledScalacOption,
Expand Down Expand Up @@ -100,6 +102,11 @@ object Config {
(v, c) => c.withCommand(_.copy(projectName =v ))
.text("Name of the project to run using GitHub coordinates")
.required(),
opt[String]("project-revision")
.action:
(v, c) => c.withCommand(_.copy(revision = Option(v).filter(_.nonEmpty) ))
.text("Version of project to bisect against")
.required(),
opt[String]("targets")
.action:
(v, c) => c.withCommand(_.copy(targets = v))
Expand Down Expand Up @@ -135,6 +142,7 @@ object Config {
object ValidationScript:
def buildProject(
projectName: String,
projectRevision: Option[String],
targets: Option[String],
extraScalacOptions: String,
disabledScalacOption: String,
Expand All @@ -147,6 +155,7 @@ object ValidationScript:
if executeTests
then ""
else """* { "tests": "compile-only"} """
val revision = projectRevision.getOrElse("$(config .revision)")
raw"""
|#!/usr/bin/env bash
|set -e
Expand All @@ -170,7 +179,7 @@ object ValidationScript:
|
|/build/build-revision.sh \
| "$$(config .repoUrl)" \
| "$$(config .revision)" \
| "$revision" \
| "$${scalaVersion}" \
| "" \
| "${targets.getOrElse("$(config .targets)")}" \
Expand Down

0 comments on commit b0cfb7b

Please sign in to comment.