From 9e25a88d55056b65efdaa809b20babaf5b985759 Mon Sep 17 00:00:00 2001 From: JKRT Date: Mon, 2 Feb 2026 18:20:58 +0100 Subject: [PATCH 1/4] Removed ws in readme --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index c8f2d42..30b9f1b 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,3 @@ sed -i.bak 's/ db/ # db/g' /etc/nsswitch.conf ```` Then start MSYS2 MinGW terminal and then follow the instructions for Linux/Mac. - - - - - - - - From cbefcef84c7e412a34514d7a1832811eb8e871d7 Mon Sep 17 00:00:00 2001 From: JKRT Date: Mon, 2 Feb 2026 18:56:48 +0100 Subject: [PATCH 2/4] Updated workflows --- .github/workflows/local-test.yml | 72 ++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 17 ++++---- .github/workflows/manual.yml | 30 ++++++------- 3 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/local-test.yml diff --git a/.github/workflows/local-test.yml b/.github/workflows/local-test.yml new file mode 100644 index 0000000..24a4c8c --- /dev/null +++ b/.github/workflows/local-test.yml @@ -0,0 +1,72 @@ +name: Local Test (act) + +# This workflow is designed to be run locally with act (nektos/act) +# It only targets Ubuntu since act does not support macOS runners + +on: + workflow_dispatch: + push: + branches: [ modprod2026 ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + julia-version: ['1.10', '1.11', '1.12'] + name: Build parser (Julia ${{ matrix.julia-version }}) + steps: + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + + - name: Setup Julia + uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.julia-version }} + + - uses: actions/checkout@v4 + + - name: Install build dependencies + run: | + apt-get update + apt-get install -y build-essential autoconf automake libtool m4 pkg-config + + - name: Configure and build parser library + run: | + which gcc + gcc --version + cd lib/parser + autoconf + ./configure + make + cd ../build/lib + tar -czvf ubuntu-julia-${{ matrix.julia-version }}-library.tar.gz * + mv ubuntu-julia-${{ matrix.julia-version }}-library.tar.gz '${{ github.workspace }}/'. + + - name: Build Julia package + run: | + julia --compiled-modules=no --color=yes --project -e ' + import Pkg + Pkg.Registry.add("General") + Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/JKRT/OpenModelicaRegistry.git")) + Pkg.build(verbose=true) + Pkg.instantiate() + Pkg.resolve() + ' + + - name: Test + run: | + julia --color=yes --project -e ' + import Pkg + Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master")) + Pkg.test("Absyn") + Pkg.test("OMParser") + ' + + - name: Upload library + uses: actions/upload-artifact@v4 + with: + name: parser-library-julia-${{ matrix.julia-version }} + path: ${{ github.workspace }}/ubuntu-julia-${{ matrix.julia-version }}-library.tar.gz diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b02e417..c4c32d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,10 +14,11 @@ jobs: - { os: windows-latest, shell: 'msys2 {0}' } - { os: ubuntu-latest, shell: bash } - { os: macos-latest, shell: bash } + julia-version: ['1.10', '1.11', '1.12'] defaults: run: shell: ${{ matrix.sys.shell }} - name: building OMParser.jl/lib/parser + name: Build parser (${{ matrix.sys.os }}, Julia ${{ matrix.julia-version }}) steps: - uses: actions/setup-java@v4 with: @@ -26,7 +27,7 @@ jobs: - name: setup julia environment uses: julia-actions/setup-julia@v2 with: - version: "1.10.0" + version: ${{ matrix.julia-version }} - name: setup msys2 environment uses: msys2/setup-msys2@v2 with: @@ -50,7 +51,7 @@ jobs: brew install pkg-config brew install libtool - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: configure the library and build run: | which gcc @@ -60,8 +61,8 @@ jobs: ./configure make cd ../build/lib - tar -czvf ${{matrix.sys.os}}-library.tar.gz * - mv ${{matrix.sys.os}}-library.tar.gz '${{github.workspace}}/'. + tar -czvf ${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz * + mv ${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz '${{ github.workspace }}/'. - name: Build # Always use bash to avoid having to escape quotes for Windows @@ -72,7 +73,7 @@ jobs: run: julia --color=yes --project -e 'import Pkg; Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master")); Pkg.test("Absyn"); Pkg.test("OMParser")' - name: upload library - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: parser-library - path: ${{github.workspace}}/${{matrix.sys.os}}-library.tar.gz \ No newline at end of file + name: parser-library-${{ matrix.sys.os }}-julia-${{ matrix.julia-version }} + path: ${{ github.workspace }}/${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz \ No newline at end of file diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index a84dcd6..8c2380f 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -14,8 +14,6 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: build: - name: building OMParser.jl/lib/parser - runs-on: ${{ matrix.sys.os }} strategy: matrix: @@ -23,17 +21,20 @@ jobs: - { os: windows-latest, shell: 'msys2 {0}' } - { os: ubuntu-latest, shell: bash } - { os: macos-latest, shell: bash } + julia-version: ['1.10', '1.11', '1.12'] defaults: run: shell: ${{ matrix.sys.shell }} + name: Build parser (${{ matrix.sys.os }}, Julia ${{ matrix.julia-version }}) + steps: - name: setup julia environment - uses: julia-actions/setup-julia@v1 + uses: julia-actions/setup-julia@v2 with: - version: "1.10.0" + version: ${{ matrix.julia-version }} - name: setup msys2 environment uses: msys2/setup-msys2@v2 @@ -58,7 +59,7 @@ jobs: brew install pkg-config brew install libtool - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: configure the library and build run: | @@ -69,25 +70,24 @@ jobs: ./configure make cd ../build/lib - tar -czvf ${{matrix.sys.os}}-library.tar.gz * - mv ${{matrix.sys.os}}-library.tar.gz '${{github.workspace}}/'. + tar -czvf ${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz * + mv ${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz '${{ github.workspace }}/'. - - name: Run the testsuite - run: julia --color=yes --project -e 'import Pkg; Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master")); Pkg.test("Absyn"); Pkg.test("OMParser")' + - name: Run the testsuite + run: julia --color=yes --project -e 'import Pkg; Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master")); Pkg.test("Absyn"); Pkg.test("OMParser")' - name: upload library - uses: actions/upload-artifact@v3 - + uses: actions/upload-artifact@v4 with: - name: parser-library - path: ${{github.workspace}}/${{matrix.sys.os}}-library.tar.gz + name: parser-library-${{ matrix.sys.os }}-julia-${{ matrix.julia-version }} + path: ${{ github.workspace }}/${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz - name: "Perform Release" uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{github.events.inputs.myInput}}${{matrix.sys.os}}" + automatic_release_tag: "${{ github.event.inputs.myInput }}-${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}" draft: false prerelease: true files: | - ${{matrix.sys.os}}-library.tar.gz + ${{ matrix.sys.os }}-julia-${{ matrix.julia-version }}-library.tar.gz From de037ff170aaf22bfb82c0fc0fe49e2e89a353ac Mon Sep 17 00:00:00 2001 From: JKRT Date: Mon, 2 Feb 2026 19:09:07 +0100 Subject: [PATCH 3/4] Updated built script to take versions into account --- deps/build.jl | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index 10203b9..3bf374c 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,4 +1,4 @@ -#= Build script for the OpenModelica parser. Currently it is for windows only. =# +#= Build script for the OpenModelica parser. =# @info "Building OpenModelicaParser A Modelica Parser in Julia" import ZipFile import Tar @@ -15,7 +15,7 @@ if ! ("Absyn" in keys(pkgs)) end function extractTar(libraryString; URL) - @info "Downloading Linux so file..." + @info "Downloading shared library from: $URL" HTTP.download(URL, PATH_TO_EXT) println(pwd()) cd(PATH_TO_EXT) @@ -48,22 +48,33 @@ using HTTP #=Extern path=# PATH_TO_EXT = realpath("$(pwd())/../lib/ext") +#= Determine Julia version for library selection =# +const JULIA_MAJOR_MINOR = "$(VERSION.major).$(VERSION.minor)" +@info "Detected Julia version: $JULIA_MAJOR_MINOR" @static if v"1.10.0" > VERSION throw("Building OMParser with precompiled shared libraries is currently only supported for Julia version 1.10 or greater. For prior versions of Julia please download and extract the libraries available at https://github.com/OpenModelica/OMParser.jl/releases or build the libraries in the lib subdirectory.") end +#= Construct platform and Julia version specific library names =# +function getLibraryURL(os_name::String) + local lib_name = "$(os_name)-julia-$(JULIA_MAJOR_MINOR)-library" + local release_tag = "Latest-$(os_name)-julia-$(JULIA_MAJOR_MINOR)" + local url = "https://github.com/OpenModelica/OMParser.jl/releases/download/$(release_tag)/$(lib_name).tar.gz" + return (lib_name, url) +end + @static if Sys.iswindows() #= Download the shared libraries (DLLS for Windows) =# - extractTar("windows-latest-library"; - URL="https://github.com/OpenModelica/OMParser.jl/releases/download/Latest-windows-latest/windows-latest-library.tar.gz") + local (lib_name, url) = getLibraryURL("windows-latest") + extractTar(lib_name; URL=url) elseif Sys.islinux() - extractTar("ubuntu-latest-library"; - URL="https://github.com/OpenModelica/OMParser.jl/releases/download/Latest-ubuntu-latest/ubuntu-latest-library.tar.gz") + local (lib_name, url) = getLibraryURL("ubuntu-latest") + extractTar(lib_name; URL=url) elseif Sys.isapple() - extractTar("macos-latest-library"; - URL="https://github.com/OpenModelica/OMParser.jl/releases/download/Latest-macos-latest/macos-latest-library.tar.gz") -else#= Throw error for other variants =# - @error "Non Linux/Windows systems are currently not supported" + local (lib_name, url) = getLibraryURL("macos-latest") + extractTar(lib_name; URL=url) +else + @error "Non Linux/Windows/macOS systems are currently not supported" throw("Unsupported system error") end From 794b018771ba827b07574886fd3203b5484771a6 Mon Sep 17 00:00:00 2001 From: JKRT Date: Mon, 2 Feb 2026 19:19:03 +0100 Subject: [PATCH 4/4] Further adjustment to build script --- deps/build.jl | 54 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index 3bf374c..77dd30c 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -56,6 +56,31 @@ const JULIA_MAJOR_MINOR = "$(VERSION.major).$(VERSION.minor)" throw("Building OMParser with precompiled shared libraries is currently only supported for Julia version 1.10 or greater. For prior versions of Julia please download and extract the libraries available at https://github.com/OpenModelica/OMParser.jl/releases or build the libraries in the lib subdirectory.") end +#= Check if local build already exists (from configure/make) =# +function checkLocalBuildExists() + local build_path = realpath("$(pwd())/../lib/build/lib") + if isdir(build_path) + local lib_files = filter(f -> endswith(f, ".so") || endswith(f, ".dll") || endswith(f, ".dylib"), + readdir(build_path; join=true)) + if !isempty(lib_files) + @info "Local build already exists at $build_path, skipping download" + return true + end + #= Check subdirectories (platform-specific) =# + for subdir in readdir(build_path) + local subpath = joinpath(build_path, subdir) + if isdir(subpath) + local sub_files = filter(f -> occursin("libomparse-julia", f), readdir(subpath)) + if !isempty(sub_files) + @info "Local build already exists at $subpath, skipping download" + return true + end + end + end + end + return false +end + #= Construct platform and Julia version specific library names =# function getLibraryURL(os_name::String) local lib_name = "$(os_name)-julia-$(JULIA_MAJOR_MINOR)-library" @@ -64,17 +89,22 @@ function getLibraryURL(os_name::String) return (lib_name, url) end -@static if Sys.iswindows() - #= Download the shared libraries (DLLS for Windows) =# - local (lib_name, url) = getLibraryURL("windows-latest") - extractTar(lib_name; URL=url) -elseif Sys.islinux() - local (lib_name, url) = getLibraryURL("ubuntu-latest") - extractTar(lib_name; URL=url) -elseif Sys.isapple() - local (lib_name, url) = getLibraryURL("macos-latest") - extractTar(lib_name; URL=url) +#= Only download if local build does not exist =# +if !checkLocalBuildExists() + @static if Sys.iswindows() + #= Download the shared libraries (DLLS for Windows) =# + local (lib_name, url) = getLibraryURL("windows-latest") + extractTar(lib_name; URL=url) + elseif Sys.islinux() + local (lib_name, url) = getLibraryURL("ubuntu-latest") + extractTar(lib_name; URL=url) + elseif Sys.isapple() + local (lib_name, url) = getLibraryURL("macos-latest") + extractTar(lib_name; URL=url) + else + @error "Non Linux/Windows/macOS systems are currently not supported" + throw("Unsupported system error") + end else - @error "Non Linux/Windows/macOS systems are currently not supported" - throw("Unsupported system error") + @info "Using locally built parser library" end