Skip to content

Commit

Permalink
Make RIDDL build natively (#663)
Browse files Browse the repository at this point in the history
This rather large merge consisted of 43 commits over several months. It provides the ability for all of RIDDL to be
compiled to a native binary (riddlc) and library (riddl-lib) using Scala Native. Along the way several other things were accomplished:

* Several improvements to  sbt-ossuminc project, from 0.14.0 to 0.18.1
* Upgrade to sbt 1.10.6
* Provide ExceptionUtils for native
* Provide a PThread workaround for native
* Provide native definition for ExceptionUtils
* Convert from pureconfig to sconfig for platform support
* File issue #4053  with scala-native
* Configure ScalaTest for JS and Native
* Get the language module testing correctly on 3 platforms.
* Get the passes module testing correctly on 3 platforms.
* Get the testkit module testing correctly on 3 platforms.
* Get the commands module compiling correctly on 2 platforms.
* Get native riddlc to build
* Add packaging targets to build
* Eliminate duplicate JVM option settings in the workflow
* Break workflow into more management sections, group by target
* Don't dump output of dump command if -quiet option is given
* Set up SBT & cache it in workflow
* Use the Ubuntu image's version of clang
* Consolidate JVM options to .jvmopts file
* Upgrade to sbt-ossuminc 0.18.1 for needed features
* Upgrade scalafmt.conf configuration
* Install platform aware build info keys for  ScalaJS and ScalaNative versions
* Give the JVM more memory & reduce memory consumption
- Replace all  --suppress... options with --set options that take a true/false value
- Move coverage support in scala.yml build to coverage.yml workflow
- break scala-build workflow into sections for each target
* Update get-riddlc action to 0.56.0
  • Loading branch information
reid-spencer authored Dec 8, 2024
1 parent 0761d50 commit b0b4de5
Show file tree
Hide file tree
Showing 284 changed files with 1,947 additions and 1,838 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Scala Coverage Testing

on:
workflow_dispatch:

jobs:
coverage:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set Up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: temurin
cache: sbt

- name: Set Up SBT
uses: sbt/setup-sbt@v1

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.112.0'
extended: true

- name: Coursier Caching
uses: coursier/cache-action@v6

- name: Coverage For JVM projects only
run: |
sbt -v clean coverage \
utils/Test/compile language/Test/compile passes/Test/compile diagrams/Test/compile \
commands/Test/compile riddlc/Test/compile \
utils/test language/test passes/test diagrams/test commands/test riddlc/test \
coverageAggregate coveralls
- name: Coverage Results Collection
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: |
- **/jvm/target/scala-3.4.3/scoverage-report/scoverage.xml
- **/target/scala-3.4.3/scoverage-report/scoverage.xml
- target/scala-3.4.3/scoverage-report/scoverage.xml
110 changes: 88 additions & 22 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ on:
- '.github/workflows/gh-pages.yml'

jobs:
build:
scala-build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RIDDLC_PATH: riddlc/native/target/scala-3.4.3/riddlc
runs-on: ubuntu-latest
steps:
- name: Checkout Code
Expand All @@ -23,7 +24,18 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt-hotspot'
distribution: temurin
cache: sbt

- name: Set Up SBT
uses: sbt/setup-sbt@v1

- name: Check Clang Okayness
run: |
echo CLANG: `which clang`
echo LD64.LLD: `which ld64.lld`
echo LLD: `which lld`
clang --version
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
Expand All @@ -34,35 +46,89 @@ jobs:
- name: Coursier Caching
uses: coursier/cache-action@v6

- name: Build, Run Test
env:
RIDDLC_PATH: riddlc/target/universal/stage/bin/riddlc
- name: Build JVM Versions
run: |
sbt -v clean Test/compile test
# Disable until 1.0: mimaReportBinaryIssues tastyMiMaReportIssues
sbt -v clean \
utils/Test/compile \
language/Test/compile \
passes/Test/compile \
diagrams/Test/compile \
commands/Test/compile \
riddlLib/Test/compile \
riddlc/Test/compile \
- name: Test sbt-riddl plugin
env:
RIDDLC_PATH: riddlc/target/universal/stage/bin/riddlc
- name: Test JVM Versions
run: |
sbt -v publishLocal riddlc/stage sbt-riddl/scripted
sbt \
utils/test \
language/test \
passes/test \
diagrams/test \
commands/test \
riddlLib/test \
riddlc/test \
- name: Coverage For JVM projects only
- name: Build Native Versions
run: |
sbt -v clean coverage \
utils/Test/compile language/Test/compile passes/Test/compile diagrams/Test/compile \
commands/Test/compile riddlc/Test/compile \
utils/test language/test passes/test diagrams/test commands/test riddlc/test \
coverageAggregate coveralls
sbt -v \
utilsNative/Test/compile \
languageNative/Test/compile \
passesNative/Test/compile \
diagramsNative/Test/compile \
commandsNative/Test/compile \
riddlcNative/Test/compile
- name: Coverage Results Collection
- name: Test Native Versions
run: |
sbt -v \
utilsNative/Test/test \
languageNative/Test/test \
passesNative/Test/test \
diagramsNative/Test/test \
commandsNative/Test/test \
riddlLibNative/Test/compile \
riddlcNative/Test/test
- name: Build JS Versions
run: |
sbt -v \
utilsJS/Test/compile \
languageJS/Test/compile \
passesJS/Test/compile \
diagramsJS/Test/compile \
riddlLibJS/Test/compile
- name: Test JS Versions
run: |
sbt -v \
utilsJS/Test/test \
languageJS/Test/test \
passesJS/Test/test \
diagramsJS/Test/test
- name: Package Release Artifacts
run: |
sbt -v \
publishLocal \
riddlc/stage \
riddlc/Universal/packageBin \
riddlcNative/nativeLink \
riddlLibJS/fullLinkJS
- name: Package Release Artifacts Collection
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
name: release-artifacts-collection
path: |
- **/jvm/target/scala-3.4.3/scoverage-report/scoverage.xml
- **/target/scala-3.4.3/scoverage-report/scoverage.xml
- target/scala-3.4.3/scoverage-report/scoverage.xml
- riddlc/native/target/scala-3.4.3/riddlc
- riddlc/jvm/target/scala-3.4.3/universal/riddlc.zip
- riddlLib/js/target/scala-3.4.3/riddl-lib-opt/main.js
- name: Test sbt-riddl plugin
env:
RIDDLC_PATH: riddlc/target/universal/stage/bin/riddlc
run: |
sbt -v sbt-riddl/scripted
- name: Cleanup Before Caching
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-Xms512M
-Xmx4096M
-Xss4M
-XX:MaxMetaspaceSize=1024M
-Xms5120M
-Xmx8192M
-Xss6M
-Dfile.encoding=UTF-8
19 changes: 17 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version=3.7.17
version = 3.8.3
runner.dialect = scala212source3
preset = default
maxColumn = 120
docstrings.style = SpaceAsterisk
runner.dialect = scala3
indent.main = 2

optIn {
Expand All @@ -29,3 +29,18 @@ project {
excludeFilters = []
}

fileOverride {
"glob:**.sbt" {
runner.dialect = scala212source3
}

"glob:**/project/plugins.sbt" {
runner.dialect = scala212source3
newlines.topLevelStatementBlankLines = [
{
blanks = 1,
minBreaks = 0
}
]
}
}
2 changes: 1 addition & 1 deletion actions/get-riddlc/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
distribution: 'temurin'
java-version: '17'
- run: |
version="0.40.0"
version="0.56.0"
wget --quiet https://github.com/ossuminc/riddl/releases/download/${version}/riddlc-${version}.zip
unzip riddlc-${version}.zip
export RIDDLC="$(pwd)/riddlc-${version}/bin"
Expand Down
Loading

0 comments on commit b0b4de5

Please sign in to comment.