Skip to content

Commit

Permalink
Merge branch 'pre-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGrayson committed Jan 17, 2021
2 parents 2cabd6b + 47eabeb commit ebafe09
Show file tree
Hide file tree
Showing 204 changed files with 1,262 additions and 814 deletions.
57 changes: 34 additions & 23 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
name: ${{ matrix.build-system }}-${{ matrix.os }}-${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # eventually make this true
fail-fast: true
matrix:
build-system:
- cmake
Expand All @@ -54,11 +54,15 @@ jobs:
cxx: clang++-10
cc: clang-10
# This build tests Clang rather than AppleClang (keep)
#- build-system: cmake
# os: macos-latest
# compiler: clang10
# cxx: clang++
# cc: clang
- build-system: cmake
os: macos-latest
compiler: clang10
cxx: clang++
cc: clang
exclude:
- build-system: cmake
os: macos-latest
compiler: default

steps:
- uses: actions/checkout@v2
Expand All @@ -71,9 +75,12 @@ jobs:
if: runner.os == 'macOS'
run: |
brew config
# autoconf, libtool are already in the virtual env
brew install automake ccache gnu-tar make ninja pkg-config yasm
brew install bdw-gc boost cddlib eigen flint glpk libatomic_ops libomp mpfr mpir ncurses ntl tbb
brew tap macaulay2/tap
brew install autoconf automake bison ccache cmake gnu-tar libtool make ninja pkg-config yasm
brew install bdw-gc boost eigen gdbm readline libatomic_ops libxml2 libomp tbb
brew install gmp mpfr ntl [email protected] [email protected] mpsolve glpk
brew install frobby memtailor mathic mathicgb givaro fflas-ffpack
brew install 4ti2 cohomcalg csdp gfan lrs nauty normaliz topcom
# ----------------------
# Install missing tools and libraries for Linux
Expand All @@ -88,10 +95,9 @@ jobs:
sudo apt-get install -y -q --no-install-recommends libatomic-ops-dev libboost-stacktrace-dev \
libncurses-dev libncurses5-dev libreadline-dev libeigen3-dev liblapack-dev libxml2-dev \
libgc-dev libgdbm-dev libglpk-dev libgmp3-dev libgtest-dev libmpfr-dev libntl-dev gfan \
libcdd-dev libgivaro-dev libboost-regex-dev fflas-ffpack w3c-markup-validator \
cohomcalg libflint-dev libmps-dev topcom \
libsingular-dev libfrobby-dev libgtest-dev libmemtailor-dev libmathic-dev \
libmathicgb-dev 4ti2 normaliz coinor-csdp nauty lrslib singular-data
libgivaro-dev libboost-regex-dev fflas-ffpack libflint-dev libmps-dev libfrobby-dev \
libsingular-dev singular-data libmemtailor-dev libmathic-dev libmathicgb-dev libcdd-dev \
cohomcalg topcom 4ti2 normaliz coinor-csdp nauty lrslib w3c-markup-validator
# ----------------------
# Steps common to all build variants
Expand All @@ -101,7 +107,6 @@ jobs:
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=`brew --prefix`/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
if [[ "${{ runner.os }}" == "Linux" ]]
then echo "/usr/lib/ccache" >> $GITHUB_PATH
# ccache doesn't seem to create the right symlink for clang-10 on ubuntu
Expand All @@ -112,17 +117,17 @@ jobs:
fi
- uses: actions/cache@v2
if: matrix.build-system == 'cmake' # TODO: remove when autotools is more efficient with space
if: matrix.build-system == 'cmake'
id: restore-cache
with:
path: |
~/.ccache
~/work/M2/M2/M2/BUILD/build/usr-host
key: build-cache-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build-system }}-${{ hashFiles('**/cmake/*-libraries.cmake') }}
restore-keys: |
build-cache-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build-system }}-
build-cache-${{ runner.os }}-${{ matrix.compiler }}-
build-cache-${{ runner.os }}-
key: build-cache-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build-system }}-${{ hashFiles('**/cmake/*-libraries.cmake', '.github/workflows/test_build.yml') }}
# restore-keys: |
# build-cache-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build-system }}-
# build-cache-${{ runner.os }}-${{ matrix.compiler }}-
# build-cache-${{ runner.os }}-


# ----------------------
Expand All @@ -132,12 +137,15 @@ jobs:
- name: Configure Macaulay2 using CMake
if: matrix.build-system == 'cmake'
run: |
deps=`brew deps --1 --include-optional macaulay2/tap/M2 | tr '\n' ';'`
paths=$HOMEBREW_PREFIX/opt/${deps//;/;$HOMEBREW_PREFIX/opt/}
cmake -S../.. -B. -GNinja \
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_SYSTEM_PREFIX_PATH=`brew --prefix` \
-DBUILD_NATIVE=OFF -DBUILD_LIBRARIES="Givaro;FFLAS_FFPACK" # TODO: remove when the packages are updated
-DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_NATIVE=OFF \
-DCMAKE_PREFIX_PATH=$paths \
-DCMAKE_INSTALL_PREFIX=/usr
- name: Build libraries using Ninja
if: matrix.build-system == 'cmake' # && steps.restore-cache.outputs.cache-hit != 'true'
if: matrix.build-system == 'cmake'
run: |
cmake --build . --target build-libraries build-programs
Expand All @@ -160,6 +168,8 @@ jobs:
run: |
make -C ../.. get-libtool get-automake get-autoconf
make -C ../.. all
export CPPFLAGS=-I`brew --prefix`/include
export LDFLAGS=-L`brew --prefix`/lib
../../configure --enable-download
- name: Build Macaulay2 using Make
Expand Down Expand Up @@ -200,6 +210,7 @@ jobs:
path: |
# Autotools
M2/BUILD/build/config.log
M2/BUILD/build/include/*
M2/BUILD/build/libraries/*/build/*/config.log
# CMake
M2/BUILD/build/CMakeFiles/CMakeCache.txt
Expand Down
1 change: 1 addition & 0 deletions M2/BUILD/docker/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
storage
!storage/.emacs
nightly/*.zip
20 changes: 12 additions & 8 deletions M2/BUILD/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
FROM ubuntu:bionic
# Time usage: <5min
# Net usage: ~200MB
# Disk usage: <800MB docker image

FROM ubuntu:focal

# Setting up Macaulay2 repository
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl gnupg && \
curl https://faculty.math.illinois.edu/Macaulay2/PublicKeys/Macaulay2-key -s --output - | apt-key add - && \
echo 'deb http://www.math.uiuc.edu/Macaulay2/Repositories/Ubuntu bionic main' > \
/etc/apt/sources.list.d/macaulay2.list && apt-get update && apt-get clean
apt-get install -y --no-install-recommends software-properties-common apt-transport-https && \
add-apt-repository ppa:profzoom/macaulay2 && add-apt-repository ppa:profzoom/macaulay2 && \
apt-get update && apt-get clean

# Install Macaulay2
RUN apt-get install -y macaulay2 && apt-get clean
RUN apt-get install -y --no-install-recommends macaulay2 && apt-get clean

# Install optional packages
RUN apt-get install -y emacs bash-completion git mlocate && apt-get clean && updatedb
RUN apt-get install -y emacs elpa-macaulay2 bash-completion curl git mlocate && \
apt-get clean && updatedb

# Add non-root user for running Macaulay2
RUN useradd -G sudo -g root -u 1000 -m macaulay
RUN useradd -G sudo -g root -u 1000 -m macaulay && echo "macaulay ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER 1000:0

# Setting environment variables
Expand Down
27 changes: 14 additions & 13 deletions M2/BUILD/docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
## Parameters
TAG = m2
STORAGE = `pwd`/storage
M2_REPO = `pwd`/../../..
M2_HOME = /home/macaulay
M2_REPO = $(shell git rev-parse --show-toplevel)
STORAGE = $(M2_REPO)/M2/BUILD/docker/storage
VOLUME = --volume $(STORAGE):$(M2_HOME) --volume $(M2_REPO):$(M2_HOME)/M2
BUILD_DIR = M2/M2/BUILD/build-docker
BUILD_DIR = M2/BUILD/build-docker

###############################################################################

always:; @cat README.md

all: build run

clean:; rm -rf ${M2_REPO}/../$(BUILD_DIR) $(STORAGE)/.ccache
clean:; [[ "$(BUILD_DIR)" =~ "M2/BUILD/build".* ]] && rm -rf $(M2_REPO)/$(BUILD_DIR) $(STORAGE)/.ccache

###############################################################################
# Build targets
Expand All @@ -25,18 +25,19 @@ build-image:; docker build --tag $(TAG) .
# M2 targets

run: run-emacs
run-M2:; docker run $(VOLUME) -it --entrypoint M2 $(TAG)
run-M2-safe:; docker run $(VOLUME) -it --entrypoint M2 $(TAG) -q --int --no-readline --no-randomize --no-threads
run-emacs-tui:; docker run $(VOLUME) -it --entrypoint emacs $(TAG)
run-emacs:; docker run $(VOLUME) --entrypoint emacs --net=host --env="DISPLAY" $(TAG)

run-M2:; docker run $(VOLUME) -it --entrypoint="" $(TAG) M2

run-M2-safe:; docker run $(VOLUME) -it --entrypoint="" $(TAG) M2 -q --int --no-readline --no-randomize --no-threads

run-emacs-tui:; docker run $(VOLUME) -it $(TAG)

run-emacs:; docker run $(VOLUME) --net=host --env="DISPLAY" $(TAG)
check: check-1
check-1:; docker run $(VOLUME) -it --entrypoint M2 $(TAG) -q --no-preload --check 1 -e 'exit 0'
check-2:; docker run $(VOLUME) -it --entrypoint M2 $(TAG) -q --no-preload --check 2 -e 'exit 0'
check-3:; docker run $(VOLUME) -it --entrypoint M2 $(TAG) -q --no-preload --check 3 -e 'exit 0'

###############################################################################
# Terminal targets

root:; docker run $(VOLUME) -it -w $(M2_HOME)/$(BUILD_DIR) --user root --entrypoint bash $(TAG)
root:; docker run $(VOLUME) -it -w $(M2_HOME)/M2/$(BUILD_DIR) --user root --entrypoint bash $(TAG)

shell:; docker run $(VOLUME) -it -w $(M2_HOME)/$(BUILD_DIR) --entrypoint bash $(TAG)
shell:; docker run $(VOLUME) -it -w $(M2_HOME)/M2/$(BUILD_DIR) --entrypoint bash $(TAG)
10 changes: 6 additions & 4 deletions M2/BUILD/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

Docker is a containerization program for building, shipping, or running applications on different platforms.

The `Dockerfile` in this directory creates a container image based on Ubuntu 18.04.4 with Macaulay2 installed from the repository. Each subdirectory contains a `Dockerfile` built for other use cases:
The `Dockerfile` in this directory creates a container image based on Ubuntu 20.04.1 LTS with Macaulay2 installed from the repository. Each subdirectory contains a `Dockerfile` built for other use cases:

- `ubuntu`: Compiling Macaulay2 in a Container
- `debian`: Packaging Macaulay2 for Debian (.deb)
- `fedora`: Packaging Macaulay2 for Fedora (.rpm)
- [`ubuntu`](ubuntu): Compiling Macaulay2 in a Container
- [`debian`](debian): Packaging Macaulay2 for Debian (.deb)
- [`fedora`](fedora): Packaging Macaulay2 for Fedora (.rpm)
- [`brew`](brew): Bottling Macaulay2 for [Homebrew](https://brew.sh/)
- [`nightly`](nightly): Testing the Nightly Build of Macaulay2

## Getting Started
0. Install Docker and start the daemon.
Expand Down
27 changes: 27 additions & 0 deletions M2/BUILD/docker/brew/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Time usage: <15min
# Net usage: ~700MB
# Disk usage: ~1GB

FROM linuxbrew/brew

# Install optional packages
RUN apt-get update && apt-get install -y -q --no-install-recommends vim mlocate && apt-get clean

USER 1000:0

# Add the tap containing the formulae for Macaulay2 and its dependencies
RUN brew update && brew config && brew tap Macaulay2/tap

RUN brew install bash-completion && echo '\n\
[[ -r "`brew --prefix`/etc/profile.d/bash_completion.sh" ]] && \n\
. "`brew --prefix`/etc/profile.d/bash_completion.sh"' >> /home/linuxbrew/.bashrc

# Install dependencies of Macaulay2
#RUN brew install --only-dependencies Macaulay2/tap/macaulay2

# Install Macaulay2
#RUN brew install --verbose --build-bottle Macaulay2/tap/macaulay2

RUN sudo updatedb

WORKDIR /home/linuxbrew
35 changes: 35 additions & 0 deletions M2/BUILD/docker/brew/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Parameters
TAG = m2-homebrew
M2_HOME = /home/linuxbrew
M2_REPO = $(shell git rev-parse --show-toplevel)
STORAGE = $(M2_REPO)/M2/BUILD/docker/storage

VOLUME-A = --volume /home/linuxbrew:$(M2_HOME)
VOLUME-B = --volume $(STORAGE)/.cache:$(M2_HOME)/.cache
VOLUME-C = --volume $(M2_REPO):$(M2_HOME)/M2

###############################################################################

always:; @cat README.md

all: build shell

###############################################################################
# Build targets

build: build-image

build-image:; docker build --tag $(TAG) .

###############################################################################
# Terminal targets

shell: shell-linux

# Run this on Linux
shell-linux:; docker run $(VOLUME-A) $(VOLUME-C) -it --entrypoint bash $(TAG)

# Run this on macOS
shell-macos:; docker run $(VOLUME-B) $(VOLUME-C) -it --entrypoint bash $(TAG)

shell-raw:; docker run $(VOLUME-C) -it --entrypoint bash $(TAG)
22 changes: 22 additions & 0 deletions M2/BUILD/docker/brew/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Bottling Macaulay2 for [Homebrew](https://brew.sh/)

Homebrew is a package manager for macOS and Linux. The `Dockerfile` in this directory creates a container image based on Ubuntu 20.04 for building and testing the Homebrew formula for Macaulay2 available at [`Macaulay2/tap`](https://github.com/Macaulay2/homebrew-tap).

## Getting Started
0. Install Docker and start the daemon (optionally, also install [Homebrew](https://brew.sh/)).

1. Build the container using Docker:
```
make build
```

2. Enter the shell:
```
make shell-linux # if you are using Linuxbrew
make shell-macos # if you are using Homebrew
```

3. Bottle Macaulay2:
```
brew install --keep-tmp --verbose --build-bottle Macaulay2/tap/M2
```
2 changes: 1 addition & 1 deletion M2/BUILD/docker/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN apt-get install -y libeigen3-dev libglpk-dev libgmp3-dev libmpfr-dev \
RUN apt-get install -y mlocate bash-completion

# Add non-root user for building and running Macaulay2
RUN useradd -G sudo -g root -u 1000 -m macaulay
RUN useradd -G sudo -g root -u 1000 -m macaulay && echo "macaulay ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER 1000:0

ENV PKG_CONFIG_PATH /usr/lib/x86_64-linux-gnu/pkgconfig
Expand Down
8 changes: 2 additions & 6 deletions M2/BUILD/docker/debian/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ include ../ubuntu/Makefile

## Parameters
TAG = m2-debian-build
STORAGE = `pwd`/../storage
M2_REPO = `pwd`/../../../..
M2_HOME = /home/macaulay
VOLUME = --volume $(STORAGE):$(M2_HOME) --volume $(M2_REPO):$(M2_HOME)/M2
BUILD_DIR = M2/M2/BUILD/build-docker
BUILD_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DUSING_MPIR=OFF
BUILD_DIR = M2/BUILD/build-docker
BUILD_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr

deb:; docker run $(VOLUME) -it --entrypoint "" $(TAG) bash -c "cd $(BUILD_DIR); cpack -G DEB"

Expand Down
2 changes: 1 addition & 1 deletion M2/BUILD/docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN microdnf install eigen3-devel glpk-devel gmp-devel mpfr-devel ntl-devel libf
RUN microdnf install mlocate bash-completion

# Add non-root user for building and running Macaulay2
RUN useradd -G wheel -g root -u 1000 -m macaulay
RUN useradd -G wheel -g root -u 1000 -m macaulay && echo "macaulay ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER 1000:0

ENV PATH /home/macaulay/M2/M2/BUILD/build-docker:${PATH}
Expand Down
8 changes: 2 additions & 6 deletions M2/BUILD/docker/fedora/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ include ../ubuntu/Makefile

## Parameters
TAG = m2-fedora-build
STORAGE = `pwd`/../storage
M2_REPO = `pwd`/../../../..
M2_HOME = /home/macaulay
VOLUME = --volume $(STORAGE):$(M2_HOME) --volume $(M2_REPO):$(M2_HOME)/M2
BUILD_DIR = M2/M2/BUILD/build-docker
BUILD_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DUSING_MPIR=OFF
BUILD_DIR = M2/BUILD/build-docker
BUILD_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr

rpm:; docker run $(VOLUME) -it --entrypoint "" $(TAG) bash -c "cd $(BUILD_DIR); cpack -G RPM"

Expand Down
Loading

0 comments on commit ebafe09

Please sign in to comment.