Build & Test using Conda #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test using Conda | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- 'public/build/**-runci' | |
pull_request: | |
workflow_dispatch: | |
# Allow to run manually | |
concurrency: | |
# Cancel previous runs of this workflow for the same branch | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Conda | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: ${{ github.event_name == 'pull_request' }} | |
max-parallel: ${{ github.event_name == 'pull_request' && 2 || 6 }} | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python: ['3.9', '3.10', '3.11'] | |
# Optional environment is disabled for now as its not yet working | |
# environment: [environment, environment-optional] | |
conda-env: [environment] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Merge CI fixes from sagemath/sage | |
run: | | |
.ci/merge-fixes.sh | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Check for Miniconda | |
id: check_conda | |
run: echo ::set-output name=installed::$CONDA | |
# Miniconda is installed by default in the ubuntu-latest, however not in the act-image to run it locally | |
- name: Install Miniconda | |
if: steps.check_conda.outputs.installed == '' | |
run: | | |
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh -O ~/miniconda.sh | |
bash ~/miniconda.sh -b -p $HOME/miniconda | |
echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV | |
- name: Create conda environment files | |
run: ./bootstrap-conda | |
- name: Cache conda packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ hashFiles('src/environment-3.11.yml') }} | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
channel-priority: true | |
activate-environment: sage | |
environment-file: src/${{ matrix.conda-env }}-${{ matrix.python }}.yml | |
- name: Print Conda environment | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Configure | |
shell: bash -l {0} | |
continue-on-error: true | |
run: | | |
./bootstrap | |
echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" | |
./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX --enable-system-site-packages $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt --exclude rpy2); do echo --with-system-$pkg=force; done) | |
echo "::remove-matcher owner=configure-system-package-warning::" | |
echo "::remove-matcher owner=configure-system-package-error::" | |
- name: Build | |
shell: bash -l {0} | |
run: | | |
# Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda. | |
pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup | |
pip install --no-build-isolation --no-deps -v -v -e ./src | |
env: | |
SAGE_NUM_THREADS: 2 | |
- name: Verify dependencies | |
if: success() || failure() | |
shell: bash -l {0} | |
run: pip check | |
- name: Test | |
if: success() || failure() | |
shell: bash -l {0} | |
run: ./sage -t --all -p0 | |
- name: Print logs | |
if: always() | |
run: | | |
for file in $(find . -type f -name "*.log"); do | |
echo "::group::$file" | |
cat "$file" | |
echo "::endgroup::" | |
done |