Files
mlpack/.github/actions/binding_setup/action.yml
T
Ryan Curtin e7f79637f6 First attempt at GHA CI instead of Azure Pipelines. (#3881)
* First attempt at GHA CI instead of Azure Pipelines.

* Could I have the matrix config wrong?

* Oh, oops, I was just looking in the wrong place for the GHA log.

* Disable Azure Pipelines Linux job.

* Fix some additional small syntax errors.

* Minor updates.

* Try to figure out what is happening with this test!

* Ha, actually remember the argument.

* Try to parse the CTest results.

* Don't build CLI programs for the debug-only mlpack_test build.

* Try to figure out why we don't have the CTest output file.

* Seems like maybe the test just needs more iterations.

* Fix directory for CTest output.

* Try running mlpack_test manually to see if we get better test output.

* Remove version numbers and other non-XML from XML output test file.

* Try to fix debug build.

* Filtering regex.

* Try to fail the build when the tests fail.

* Minor fixes and cleanups to run Python binding tests.

* Print test failure information in the actual build step.

* Update Julia testing strategy.

* Try to also get outputs from other test bindings.

* Fix Julia and Go testing blocks.

* Avoid random collisions that cause test failures.

* Try moving splitting into the trial loop.

* Try a different test reporter action.

* Install pytest for Python tests.

* Fix working directory for Julia test.

* Add test case that will fail to see what it looks like.

* Back to the old action, the new one I tried didn't do what I needed.

* Try a better way to print the test output.

* I still don't know how to mark the job failed yet.

* Maybe this stdout character works better.

* Try a forked test-summary action.

* Try to use distribution version of the modified action.

* Try to see if ccache is doing anything.

* Always run ccache stats step.

* Turn off PCH for ccache.

* Let's just see what it looks like with more error output.

* Clean up ccache configuration.

* Remove fake test because it seems like now I have the output working right.

* Try to reduce file size by not printing debug output into it.

* Try and refactor binding environment seutp into a composite local action.

* Try to fix some syntactical errors.

* Refactor test running into a separate composite action.

* Start trying to make the R build part of the main CI build.

* Oops, the include directory was in the wrong place.

* Try actually running R tests in the workflow too.

* Try to fix a few action issues.

* Try to work around libicu issue.

* Remove unnecessary option.

* Try to run OS X builds too.

* Try to fix matrix configuration.

* Revert "Try to fix matrix configuration."

This reverts commit 22a08d6dcd0d39de0a27f2df16e885bd68e18fda.

* Oops, maybe it was just an extra comma.

* Fix naming, and maybe we have to remove stringi first.

* Try to set Julia location correctly.

* Some fixes to the pipelines.

* Oops, I need root for that.

* Some additional fixes for jobs.

* Hopefully fix a few more builds.

* What, how did that get there?

* Don't use non-portable -i option with sed.

* Run R tests properly to get junit output.

* Oops, I have to redirect the output.

* Where is the output file?

* Try to fix macOS Python location.

* Oops, ROOTDIR is just not set.

* Try to store the name of the R package correctly.

* Oops, we need to specify pip.

* Try to get the right directory for the R package.

* Try to fix another round of issues.  I'm getting closer, at least.

* Okay, fine, let's do it the brutalistic way.

* What is actually happening with the Go binding tests?

* Try a different strategy for printing.

* Make some updates to prepare for Windows builds.

* What's the output of go test?

* Remove -Wall as per golang/go#6883.

* Try to fix duplicate library warning.

* Maybe I just specified the variable in an invalid way that didn't stick?

* This should fix the Go build.

* How did that cd go missing?

* Try to remove DEBUG output from the debug tests.

* Try to be more specific about the ccache key.

* Oops, incorrect variable name.

* Try to speed up the testing step.

* Try to run the Windows build through GHA.

* Try to install locally to deps/.

* Try to install and set up Windows dependencies correctly.

* Try to debug Windows build.

* Use bash for CMake configuration.

* Some additional path fixes.

* A couple fixes, but I don't have the Armadillo path right.

* Fix curl command.

* Maybe this is closer to the right path...

* Okay, look one directory deeper...

* Temporarily print STB compilation failure.

* Try to use absolute path for STB inclusion test.

* Oops, fix syntax.

* Try using REALPATH instead.

* Try just skipping the check...

* Try specifying BLAS and LAPACK locations directly.

* Try to figure out what is going on.

* Are we even using the correct FindArmadillo script?

* Try specifying the libraries manually.

* Try disabling the wrapper library.

* What version of CMake is this?

* Print the configuration.

* What if we specify these library locations?

* Double-check: this should fail.

* Okay, that actually surprisingly did not fail.

* Fix style issues.

* Compress into only one GHA file so all the jobs show up in the same place.

* Try to use absolute path to OpenBLAS.

* Try to fix path mangling on Windows.

* Fix STB path and no PS please.

* Try to fix output on Windows tests.

* Call test from the right place.

* Remove some unnecessary output.

* Try just running the test.

* What is going on, why doesn't the test run?

* Try just running the test with PowerShell.

* Maybe I have the filename wrong?

* PowerShell makes me angry...

* Right, .exe is the suffix...

* I love PowerShell!

* Okay, forget PowerShell.

* Can we even run the test?

* Is it a DLL search path issue?

* Okay, I think this might work for Windows.

* Fix porting of new r2u/p3m workflow (hopefully).

* Fix possibly incorrect variable name.

* Reduce the number of macOS jobs.

* Fix name of job.

* Remove potentially unnecessary step.

* Document CI changes and reorganize jobs for better viewing.

* Remove invalid link.  (Awesome that the link check build picked this up.)
2025-02-14 20:22:13 -05:00

127 lines
5.2 KiB
YAML

# This action sets up any language-specific environment for any of mlpack's
# bindings.
name: "Set up binding environments"
description: "Install build and runtime dependencies for mlpack's bindings to other languages."
inputs:
lang:
required: true
description: "The language to set up bindings for."
runs:
using: "composite"
steps:
#
# Python bindings.
#
- name: "Set up Python (Linux)"
if: inputs.lang == 'Python' && runner.os == 'Linux'
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade --ignore-installed setuptools cython \
pandas wheel pytest
echo "CMAKE_BINDING_ARGS=-DPYTHON_EXECUTABLE=`which python3`" >> $GITHUB_ENV
- name: "Set up Python (macOS)"
if: inputs.lang == 'Python' && runner.os == 'macOS'
shell: bash
run: |
/opt/homebrew/bin/python3 -m pip install --break-system-packages --upgrade pip
/opt/homebrew/bin/python3 -m pip install --break-system-packages setuptools cython pandas zipp configparser wheel pytest
echo "CMAKE_BINDING_ARGS=-DPYTHON_EXECUTABLE=/opt/homebrew/bin/python3" >> $GITHUB_ENV
#
# Julia bindings.
#
- name: "Set up Julia on Linux"
if: inputs.lang == 'Julia' && runner.os == 'Linux'
shell: bash
run: |
wget https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz
sudo tar -C /opt/ -xvpf julia-1.10.4-linux-x86_64.tar.gz
echo "CMAKE_BINDING_ARGS=-DJULIA_EXECUTABLE=/opt/julia-1.10.4/bin/julia" >> $GITHUB_ENV
echo "JULIA_EXECUTABLE=/opt/julia-1.10.4/bin/julia" >> $GITHUB_ENV
- name: "Set up Julia on macOS"
if: inputs.lang == 'Julia' && runner.os == 'macOS'
shell: bash
run: |
brew install --cask julia
echo "CMAKE_BINDING_ARGS=-DJULIA_EXECUTABLE=/opt/homebrew/bin/julia" >> $GITHUB_ENV
echo "JULIA_EXECUTABLE=/opt/homebrew/bin/julia" >> $GITHUB_ENV
#
# R bindings.
#
- name: Extract mlpack version for R bindings
if: inputs.lang == 'R'
shell: bash
run: |
MLPACK_VERSION_MAJOR=$(grep -i ".*#define MLPACK_VERSION_MAJOR.*" src/mlpack/core/util/version.hpp | grep -o "[0-9]*")
MLPACK_VERSION_MINOR=$(grep -i ".*#define MLPACK_VERSION_MINOR.*" src/mlpack/core/util/version.hpp | grep -o "[0-9]*")
MLPACK_VERSION_PATCH=$(grep -i ".*#define MLPACK_VERSION_PATCH.*" src/mlpack/core/util/version.hpp | grep -o "[0-9]*")
MLPACK_VERSION_VALUE=${MLPACK_VERSION_MAJOR}.${MLPACK_VERSION_MINOR}.${MLPACK_VERSION_PATCH}
echo "MLPACK_R_PACKAGE=$(echo mlpack_"$MLPACK_VERSION_VALUE".tar.gz)" >> $GITHUB_ENV
- name: "Setup pandoc for R"
if: inputs.lang == 'R'
uses: r-lib/actions/setup-pandoc@v2
# Setup r2u (linux)
- name: Setup r2u
if: inputs.lang == 'R' && runner.os == 'Linux'
uses: eddelbuettel/github-actions/r2u-setup@master
- name: Setup p3m.dev (macOS / Windows)
uses: r-lib/actions/setup-r@v2
if: inputs.lang == 'R' && (runner.os == 'Windows' || runner.os == 'macOS')
with:
r-version: "release"
use-public-rspm: true
- name: "Configure ccache for R"
if: inputs.lang == 'R'
shell: bash
run: |
ccache --set-config "sloppiness=include_file_ctime"
ccache --set-config "hash_dir=false"
ccache --zero-stats
- name: "Query R dependencies"
if: inputs.lang == 'R'
shell: bash
run: |
cp src/mlpack/bindings/R/mlpack/DESCRIPTION.in DESCRIPTION
Rscript -e 'install.packages(c("remotes", "roxygen2", "pkgbuild"))'
Rscript -e 'remotes::install_deps(".", dependencies=TRUE)'
- name: Install cereal manually for R
if: inputs.lang == 'R'
shell: bash
run: |
# We don't install cereal via apt, because the Debian packagers
# split the rapidjson dependency into a separate package. We will
# bundle the cereal sources with the R package, so we want them to
# be exactly the upstream sources (with rapidjson included).
wget https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.2.tar.gz
tar -xvzpf v1.3.2.tar.gz
#
# These directives cause warnings on CRAN:
# https://github.com/USCiLab/cereal/blob/master/include/cereal/external/base64.hpp#L28-L31
# The command below comments them out.
sed 's|#pragma|// #pragma|' cereal-1.3.2/include/cereal/external/base64.hpp > cereal-1.3.2/include/cereal/external/base64.hpp.tmp
mv cereal-1.3.2/include/cereal/external/base64.hpp.tmp cereal-1.3.2/include/cereal/external/base64.hpp
#
# Fix cereal compilation on clang 19+; see
# https://github.com/USCiLab/cereal/pull/835
sed 's|::template apply|::apply|' cereal-1.3.2/include/cereal/types/tuple.hpp > cereal-1.3.2/include/cereal/types/tuple.hpp.tmp
mv cereal-1.3.2/include/cereal/types/tuple.hpp.tmp cereal-1.3.2/include/cereal/types/tuple.hpp
#
# Go bindings.
#
- name: "Set up Go on macOS"
if: inputs.lang == 'Go' && runner.os == 'macOS'
shell: bash
run: brew install go