diff --git a/.github/workflows/ci-wsl.yml b/.github/workflows/ci-wsl.yml index 9808b919bf4..7c5cce70cb3 100644 --- a/.github/workflows/ci-wsl.yml +++ b/.github/workflows/ci-wsl.yml @@ -1,11 +1,19 @@ name: Build & Test WSL -on: [push, pull_request] +on: + pull_request: + types: [opened, synchronize] + push: + tags: + - '*' + branches: + - 'public/build/**wsl**' + workflow_dispatch: jobs: windows: runs-on: windows-latest - name: Windows (using WSL) + name: Ubuntu 20.04 # Following https://trac.sagemath.org/ticket/25206#comment:63 steps: - name: Configure git @@ -18,22 +26,10 @@ jobs: Ubuntu\ubuntu2004.exe install --root - name: Install dependencies run: | - Function ExtractPackages - { - param($path) - @(Get-Content $path | Where-Object { !$_.StartsWith("#") }) - } - $packages = Get-ChildItem build/pkgs -recurse -Include debian.txt, debian-bootstrap.txt | foreach-object { ExtractPackages $_.FullName } | sort -Unique - # Add tox which is use to build - $packages += 'tox' - echo "Install the following packages:" @packages - # Add deadsnakes so that libpython3.7-dev is found - & wsl sudo add-apt-repository ppa:deadsnakes/ppa - # Install - & wsl sudo apt-get update -y - & wsl sudo apt-get install -y @packages + wsl sudo apt-get update -y + wsl sudo apt-get install -y tox - name: Build - run: wsl tox -e local -- SAGE_NUM_THREADS=4 build + run: wsl tox -e local-sudo-ubuntu-standard -- SAGE_NUM_THREADS=4 build env: # WSL runs everything as root, so we have to enable build as root user EXTRA_CONFIGURE_ARGS: "--enable-build-as-root" @@ -42,7 +38,7 @@ jobs: MAKE: "make -j2" WSLENV: EXTRA_CONFIGURE_ARGS:MAKE - name: Test - run: wsl tox -e local -- SAGE_NUM_THREADS=4 ptest + run: wsl tox -e local-sudo-ubuntu-standard -- SAGE_NUM_THREADS=4 ptest - name: Prepare logs artifact run: mkdir -p "artifacts/logs"; cp -r .tox/*/log "artifacts/logs" shell: bash diff --git a/build/bin/sage-print-system-package-command b/build/bin/sage-print-system-package-command index 839085be093..2117a26b094 100755 --- a/build/bin/sage-print-system-package-command +++ b/build/bin/sage-print-system-package-command @@ -21,6 +21,12 @@ do --prompt) PROMPT=' $ ' ;; + --no-install-recommends) + NO_INSTALL_RECOMMENDS=yes + ;; + --yes) + YES=yes + ;; -*) echo >&2 "$0: unknown option $1" exit 1 @@ -37,6 +43,7 @@ if [ -z "$system" -o -z "$command" ]; then exit 1 fi system_packages="$*" +options= shopt -s extglob case $system:$command in homebrew*:setup-build-env) @@ -56,22 +63,33 @@ case $system:$command in echo "${PROMPT}${SUDO}apt-get $command $system_packages" ;; @(debian*|ubuntu*):*) - [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}apt-get $command $system_packages" + [ "$NO_INSTALL_RECOMMENDS" = yes ] && options="$options --no-install-recommends" + [ "$YES" = yes ] && options="$options --yes" + [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}apt-get $command $options $system_packages" ;; @(fedora*|redhat*|centos*):install) - [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}yum install $system_packages" + [ "$YES" = yes ] && options="$options -y" + [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}yum install $options $system_packages" ;; gentoo*:install) [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}emerge $system_packages" ;; + arch*:update) + echo "${PROMPT}${SUDO}pacman -Sy" + ;; arch*:install) - [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}pacman -S $system_packages" + [ "$YES" = yes ] && options="$options --noconfirm" + [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}pacman -S $options $system_packages" + ;; + void*:update) + echo "${PROMPT}${SUDO}xbps-install -Su" ;; - void*:install) - [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}xbps-install $system_packages" + [ "$YES" = yes ] && options="$options --yes" + [ -n "$system_packages" ] && echo "${PROMPT}${SUDO}xbps-install $options $system_packages" ;; *conda*:install) + [ "$YES" = yes ] && options="$options --yes" [ -n "$system_packages" ] && echo "${PROMPT}conda install $system_packages" ;; homebrew*:install) diff --git a/build/pkgs/_recommended/distros/debian.txt b/build/pkgs/_recommended/distros/debian.txt index 8cd6a185445..8041435c58d 100644 --- a/build/pkgs/_recommended/distros/debian.txt +++ b/build/pkgs/_recommended/distros/debian.txt @@ -1,7 +1,7 @@ # From https://wiki.sagemath.org/prerequisitesUbuntu # to generate pdf documentation -texlive-generic-extra +texlive-latex-extra # to convert Jupyter notebooks to pdf texlive-xetex # to generate pdf documentation diff --git a/tox.ini b/tox.ini index fee460bd22d..ce11cdc35f6 100644 --- a/tox.ini +++ b/tox.ini @@ -132,6 +132,8 @@ setenv = maximal: TYPE_PATTERN=@(standard|optional) # local envs need HOME set, also Docker 19.03 needs HOME {local,docker}: HOME={envdir} + # for local envs we can guess the package system if it is not provided as a factor + local: SYSTEM=$(build/bin/sage-guess-package-system) # # default tag is "latest" # @@ -409,6 +411,14 @@ commands = local-conda-standard: bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/*/distros/conda.txt`; {env:SETENV} && {env:CONDA_PREFIX}/bin/conda install --yes --quiet $PACKAGES' local-conda-maximal: bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/*/distros/conda.txt`; {env:SETENV} && {env:CONDA_PREFIX}/bin/conda install --yes --quiet $PACKAGES' # + # local-sudo + # + local-sudo: bash -c '$(build/bin/sage-print-system-package-command {env:SYSTEM} update) #' + local-sudo: bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/{env:SYSTEM}*.txt`; $(build/bin/sage-print-system-package-command {env:SYSTEM} --sudo --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ' + # -standard and -maximal are for now the same. This should be fixed when refactoring write-dockerfile. + local-sudo-standard: bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/*/distros/{env:SYSTEM}.txt`; $(build/bin/sage-print-system-package-command {env:SYSTEM} --sudo --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ' + local-sudo-maximal: bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/*/distros/{env:SYSTEM}.txt`; $(build/bin/sage-print-system-package-command {env:SYSTEM} --sudo --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ' + # # All "local" environments # # Install symbolic links "config.log" and "logs" in SAGE_ROOT so that log files are written into the tox log directory.