This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.2.x' into 1.2-release
- Loading branch information
Showing
24 changed files
with
429 additions
and
102 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
.github/scripts/ExtractBuildDependenciesFromPullRequest.gawk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/^[[:space:]]*"body": / { | ||
# Convert character sequences to character constants | ||
gsub(/\\r/, "") | ||
gsub(/\\n/, "\n") | ||
# Remove trailing punctuation | ||
gsub(/\n*",$/, "") | ||
# Look for the build dependency tag | ||
i=split($0, a, /### Build Dependencies/) | ||
if ( i != 2 ) { | ||
print "no build dependencies" | ||
exit 0 | ||
} | ||
# Throw away everything up to the build dependency tag | ||
$0=a[2] | ||
# Grab the specific build dependencies | ||
i=split($0,a,/\nBuild with: /) | ||
delete a[1] | ||
# Format the individual dependencies | ||
errLines = 0 | ||
depLines = 0 | ||
for (i in a) { | ||
# Remove trailing text | ||
gsub(/\n.*$/, "", a[i]) | ||
n=split(a[i], d, /\s+/) | ||
switch (d[1]) { | ||
case /maven-version/ : | ||
if (n != 3) { | ||
err[errLines++]="unrecognized maven-version stanza: " a[i] "(" n ")" | ||
} | ||
break | ||
|
||
case /git-clone/ : | ||
if (n != 4) { | ||
err[errLines++]="unrecognized git-clone stanza: " a[i] "(" n ")" | ||
} | ||
break | ||
|
||
default: | ||
err[errLines++]="unrecognized build type: " d[1] " - " a[i] | ||
break | ||
|
||
} | ||
# If we don't have any errors, format this dependency line and add it | ||
# to the list of dependency lines. | ||
if (errLines == 0) { | ||
sep="" | ||
line="" | ||
for (n in d) { | ||
line=line sep d[n] | ||
sep=" " | ||
} | ||
dep[depLines++]=line | ||
} | ||
} | ||
# Print either errors (to stderr) or the dependency lines (to stdout) | ||
if (errLines == 0) { | ||
for (n in dep) { | ||
print dep[n] | ||
} | ||
} else { | ||
for (n in err) { | ||
print err[n] > "/dev/stderr" | ||
} | ||
exit 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generate commands to: | ||
# - clone, build, and publish dependencies, (on stdout) | ||
# - fetch corresponding shas ( on fd 3) | ||
# Specify "-v verbose=1" on the command line for verbose output (to stderr) | ||
/#/ { | ||
# Strip comments | ||
gsub(/#.*$/,"") | ||
} | ||
/git-clone/ { | ||
project=$2 | ||
repo=$3 | ||
tag=$4 | ||
if (verbose) { | ||
print "writing clone and build commands to stdout." > "/dev/stderr" | ||
} | ||
# Generate commands to do a shallow fetch of all branches, checkout the desired ref/sha, and build and publish the jars. | ||
printf "git clone --no-single-branch --no-checkout --depth 5 %s %s && (cd %s && git checkout %s && sbt +publishLocal)\n",repo,project,project,tag | ||
# If the tag looks like a SHA, assume it is and generate a command to just echo it, | ||
# otherwise, generate a string to fetch the sha from the remote. | ||
# In either case, write the output to fd 3. | ||
if (verbose) { | ||
print "writing sha generation commands to fd 3." > "/dev/stderr" | ||
} | ||
if ( tag ~ /^[[:xdigit:]]+$/ ) { | ||
printf "echo %s\n", tag > "/dev/fd/3" | ||
} else { | ||
printf "git ls-remote --tags --heads %s %s", repo, tag > "/dev/fd/3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generate suitable definitions for sbt to override default dependency | ||
# specifications in the associated build.sbt, assuming the latter has | ||
# been structured to support this. It should contain something like: | ||
# | ||
# // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. | ||
# val defaultVersions = Seq( | ||
# "chisel3" -> "3.3-SNAPSHOT", | ||
# "treadle" -> "1.2-SNAPSHOT" | ||
# ) | ||
# | ||
# libraryDependencies ++= defaultVersions.map { case (dep, ver) => | ||
# "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", ver) } | ||
|
||
/#/ { | ||
# Strip comments | ||
gsub(/#.*$/,"") | ||
} | ||
/maven-version/ { | ||
# Print a series of "-DfooVersion=xxx" to override the default chisel versions in build.sbt | ||
printf "%s-D%sVersion=%s", sep, $2, $3; sep = " " | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Test | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ci | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ucbbar/chisel3-tools | ||
options: --user github --entrypoint /bin/bash | ||
env: | ||
CHISEL3_REF: master | ||
FIRRTL_REF: master | ||
FIRRTL_INTERPRETER_REF: master | ||
TREADLE_REF: master | ||
CONTAINER_HOME: /home/github | ||
|
||
steps: | ||
- name: id | ||
id: id | ||
run: | | ||
uid=$(id -u) | ||
echo ::set-env name=CONTAINER_HOME::$(if [ "$uid" = "0" ]; then echo "/root"; else echo "/home/github"; fi) | ||
printenv | ||
whoami | ||
git --version | ||
pwd | ||
# Currently, sbt seems to either ignore (or doesn't see) $HOME inside the container, | ||
# and insists on using /home/<user> (i.e., /home/github). | ||
# Set up symbolic links so /home/gitsub/.{sbt,cache} (inside the container) are links to | ||
# the equivalent directories in $HOME (i.e, /github/home) | ||
- name: link-caches | ||
id: link-caches | ||
run: | | ||
echo "Link $CONTAINER_HOME caches to $HOME" | ||
echo mkdir -p $HOME/.cache $HOME/.ivy2 $HOME/.sbt | ||
mkdir -p $HOME/.cache $HOME/.ivy2 $HOME/.sbt | ||
echo ln -s $HOME/.cache $HOME/.ivy2 $HOME/.sbt $CONTAINER_HOME | ||
ln -s $HOME/.cache $HOME/.ivy2 $HOME/.sbt $CONTAINER_HOME | ||
echo ls -la $HOME . $CONTAINER_HOME | ||
ls -la $HOME . $CONTAINER_HOME | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: repo | ||
- name: cache-sbt | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-sbt | ||
with: | ||
path: ~/.sbt | ||
key: build-${{ env.cache-name }}-v1 | ||
restore-keys: | | ||
build-${{ env.cache-name }}- | ||
- name: cache-coursier | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-coursier | ||
with: | ||
path: ~/.cache | ||
key: build-${{ env.cache-name }}-v1 | ||
restore-keys: | | ||
build-${{ env.cache-name }}- | ||
- name: list | ||
id: list | ||
run: | | ||
echo ls -la . repo ~/.sbt ~/.cache /home/github /home/github/.??* | ||
ls -la . repo ~/.sbt ~/.cache /home/github /home/github/.??* | ||
- name: env | ||
id: env | ||
run: | | ||
echo "cat $GITHUB_EVENT_PATH" | ||
cat $GITHUB_EVENT_PATH | ||
- name: gawk | ||
id: gawk | ||
run: | | ||
gawk -f repo/.github/scripts/ExtractBuildDependenciesFromPullRequest.gawk $GITHUB_EVENT_PATH > deps | ||
ls -l deps | ||
cat deps | ||
gawk -f repo/.github/scripts/generateGitClones.gawk deps > clones.sh 3> shas.sh | ||
cat shas.sh | ||
bash shas.sh > shas | ||
- name: cache-dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-dependencies | ||
with: | ||
path: ~/.ivy2/local | ||
key: build-${{ env.cache-name }}-v1-${{ hashFiles('shas') }} | ||
- name: clone-deps | ||
id: clone-deps | ||
run: | | ||
cat clones.sh | ||
bash clones.sh | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
- name: version-deps | ||
id: version-deps | ||
run: | | ||
versionDeps=$(gawk -f repo/.github/scripts/generateVersionOverrides.gawk deps) | ||
echo "versonDeps: $versionDeps" | ||
- name: test | ||
id: test | ||
run: cat /dev/null | sbt $versionDeps +test | ||
working-directory: ./repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.