|
| 1 | +name: JuliaCompileAndTest |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [master, latest] |
| 5 | + pull_request: |
| 6 | + types: [opened, synchronize, ready_for_review, reopened] |
| 7 | +# needed to allow julia-actions/cache to delete old caches that it has created |
| 8 | +permissions: |
| 9 | + actions: write |
| 10 | + contents: read |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + name: Julia - ${{ github.event_name }} |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + # Install Julia 1.7 for BinaryBuilder. Note that this is an old version of |
| 18 | + # Julia, but it is required for compatibility with BinaryBuilder. |
| 19 | + - uses: julia-actions/setup-julia@v2 |
| 20 | + with: |
| 21 | + version: "1.7" |
| 22 | + arch: x64 |
| 23 | + - uses: julia-actions/cache@v2 |
| 24 | + # Set the environment variables required by BinaryBuilder. |
| 25 | + - run: | |
| 26 | + git fetch --tags |
| 27 | + echo "HIGHS_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1) | sed 's/^v//')" >> $GITHUB_ENV |
| 28 | + if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 29 | + echo "HIGHS_COMMIT=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV |
| 30 | + echo "HIGHS_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV |
| 31 | + else |
| 32 | + echo "HIGHS_COMMIT=${{ github.sha }}" >> $GITHUB_ENV |
| 33 | + echo "HIGHS_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV |
| 34 | + fi |
| 35 | + - run: | |
| 36 | + julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' |
| 37 | + julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-cxx11 --verbose --deploy="local" |
| 38 | + # Now install a newer version of Julia to actually test HiGHS_jll. We |
| 39 | + # choose v1.10 because it is the current Long-Term Support (LTS). |
| 40 | + - uses: julia-actions/setup-julia@v2 |
| 41 | + with: |
| 42 | + version: "1.10" |
| 43 | + arch: x64 |
| 44 | + # We want to install the latest version of HiGHS.jl, but we also want it |
| 45 | + # to be compatible with our newly compiled HiGHS_jll. To do so, we |
| 46 | + # manually edit HiGHS.jl's Project.toml file to allow any v1.X.Y version |
| 47 | + # of HiGHS_jll |
| 48 | + - shell: julia --color=yes {0} |
| 49 | + run: | |
| 50 | + using Pkg |
| 51 | + Pkg.develop("HiGHS") |
| 52 | + project_filename = "/home/runner/.julia/dev/HiGHS/Project.toml" |
| 53 | + project = read(project_filename, String) |
| 54 | + write( |
| 55 | + project_filename, |
| 56 | + replace(project, r"HiGHS_jll = \"=.+?\"" => "HiGHS_jll = \"1\""), |
| 57 | + ) |
| 58 | + # Now we can add HiGHS_jll and run the tests for HiGHS. |
| 59 | + - shell: julia --color=yes {0} |
| 60 | + run: | |
| 61 | + using Pkg |
| 62 | + Pkg.develop(; path="/home/runner/.julia/dev/HiGHS_jll") |
| 63 | + Pkg.test("HiGHS") |
0 commit comments