julia-actions / setup-julia

This action sets up a Julia environment for use in actions by downloading a specified version of Julia and adding it to PATH.
MIT License
93 stars 23 forks source link

Unable to test C libraries against Julia packages #98

Closed albinahlback closed 2 years ago

albinahlback commented 2 years ago

I'm trying to write some tests to check whether a C library can via some Julia packages as they are intended to. The problem I'm having is that I cannot get Julia on this workflow to accept the compiled library. A similar approach to my workflow file works fine on my local system. However, on Github they do not.

Workflow file to reproduce the behavior:

name: CI

on: [push, pull_request]

jobs:
  nemo:
    name: Nemo.jl

    runs-on: ubuntu-latest

    # some environment variables to build the C library
    env:
      MAKE: "make -j"
      LOCAL: ${{ github.workspace }}/local
      LDFLAGS: "-Wl,-rpath,$LOCAL/lib"
      CFLAGS: ""

    steps:
      - uses: actions/checkout@v2

      - name: "Set up Julia"
        run: |
          uses: julia-actions/setup-julia@v1
          with:
            version: "1.7.2"

      - name: "Setup"
        run: |
          gcc --version
          make --version
          julia --version

      - name: "Build dependencies"
        run: |
          ./.build_dependencies # Just some dependencies to build C library

      - name: "Configure" # Run configure file for the C library
        run: |
          ./configure --disable-static --enable-shared CFLAGS=${CFLAGS} \
              --with-gmp=${LOCAL} --with-mpfr=${LOCAL} --prefix=${LOCAL}

      - name: "Compile and install" # Compile and install the C library
        run: |
          $MAKE
          $MAKE install
          # FLINT_jll can be lagging behind by one version, so we make a fake
          # lower version.
          FLINT_MAJOR=$(grep "FLINT_MAJOR=" Makefile)
          FLINT_MAJOR=${FLINT_MAJOR:12}
          cp ${LOCAL}/lib/libflint.so.${FLINT_MAJOR} ${LOCAL}/lib/libflint.so.$((${FLINT_MAJOR} - 1))

      - name: "Set up Nemo.jl"
        run: |
          # Add the Julia packages
          julia -e "import Pkg; Pkg.add(\"FLINT_jll\"); Pkg.add(\"Nemo\");"

          # Override the original artifacts with what we have compiled
          echo -e "[e134572f-a0d5-539d-bddf-3cad8db41a82]\nFLINT = \"${LOCAL}\"" > ~/.julia/artifacts/Overrides.toml
          touch ~/.julia/packages/FLINT_jll/*/src/FLINT_jll.jl # Binary wrapper for the C library. We touch a file within the package to force re-precompilation.
          julia -e "using FLINT_jll; println(FLINT_jll.libflint)"
          touch ~/.julia/packages/Nemo/*/src/Nemo.jl # User interface for the C library
          julia -e "using Nemo; println(Nemo.libflint)"

      - name: "Check Nemo"
        run: |
          julia -e "import Pkg; Pkg.test(\"Nemo\")" # Test the Julia package
albinahlback commented 2 years ago

There is a big possibility that this error is on my side, but I couldn't find any issue or question here or anywhere else that faced the same issue.

SaschaMann commented 2 years ago

Hi, this doesn't seem like an issue with setup-julia, since Julia itself seems to have been installed just fine. You might have more luck asking on Zulip, Slack, or Discourse.