|
| 1 | +name: Build & Test using Conda |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + branches: |
| 10 | + - 'public/build/**-runci' |
| 11 | + workflow_dispatch: |
| 12 | + # Allow to run manually |
| 13 | + |
| 14 | +concurrency: |
| 15 | + # Cancel previous runs of this workflow for the same branch |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + test: |
| 21 | + name: Conda |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + os: [ubuntu-latest, macos-latest] |
| 28 | + python: [3.8, 3.9] |
| 29 | + conda-env: [environment, environment-optional] |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v2 |
| 33 | + |
| 34 | + - name: Check for Miniconda |
| 35 | + id: check_conda |
| 36 | + run: echo ::set-output name=installed::$CONDA |
| 37 | + |
| 38 | + # Miniconda is installed by default in the ubuntu-latest, however not in the act-image to run it locally |
| 39 | + - name: Install Miniconda |
| 40 | + if: steps.check_conda.outputs.installed == '' |
| 41 | + run: | |
| 42 | + wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh -O ~/miniconda.sh |
| 43 | + bash ~/miniconda.sh -b -p $HOME/miniconda |
| 44 | + echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV |
| 45 | +
|
| 46 | + - name: Install bootstrap prerequisites |
| 47 | + run: | |
| 48 | + export PATH="$(pwd)/build/bin:$PATH" |
| 49 | + SYSTEM=$(sage-guess-package-system) |
| 50 | + eval $(sage-print-system-package-command $SYSTEM --sudo install $(sage-get-system-packages $SYSTEM _bootstrap)) |
| 51 | +
|
| 52 | + # Create conda environment file |
| 53 | + - name: Bootstrap |
| 54 | + run: ./bootstrap |
| 55 | + |
| 56 | + - name: Cache conda packages |
| 57 | + uses: actions/cache@v2 |
| 58 | + with: |
| 59 | + path: ~/conda_pkgs_dir |
| 60 | + key: |
| 61 | + ${{ runner.os }}-conda-${{ hashFiles('src/environment.yml') }} |
| 62 | + |
| 63 | + - name: Setup Conda |
| 64 | + uses: conda-incubator/setup-miniconda@v2 |
| 65 | + with: |
| 66 | + python-version: ${{ matrix.python }} |
| 67 | + mamba-version: "*" |
| 68 | + channels: conda-forge,defaults |
| 69 | + channel-priority: true |
| 70 | + activate-environment: sage-build |
| 71 | + environment-file: src/${{ matrix.conda-env }}.yml |
| 72 | + |
| 73 | + - name: Print Conda environment |
| 74 | + shell: bash -l {0} |
| 75 | + run: | |
| 76 | + conda info |
| 77 | + conda list |
| 78 | +
|
| 79 | + - name: Configure |
| 80 | + shell: bash -l {0} |
| 81 | + continue-on-error: true |
| 82 | + run: | |
| 83 | + echo "::add-matcher::.github/workflows/configure-systempackage-problem-matcher.json" |
| 84 | + ./configure --enable-build-as-root --with-python=$CONDA_PREFIX/bin/python --prefix=$CONDA_PREFIX $(for pkg in $(./sage -package list :standard: --has-file spkg-configure.m4 --has-file distros/conda.txt); do echo --with-system-$pkg=force; done) |
| 85 | + echo "::remove-matcher owner=configure-system-package-warning::" |
| 86 | + echo "::remove-matcher owner=configure-system-package-error::" |
| 87 | +
|
| 88 | + - name: Build |
| 89 | + shell: bash -l {0} |
| 90 | + run: | |
| 91 | + pip install --no-build-isolation -v -v -e pkgs/sage-conf pkgs/sage-setup |
| 92 | + pip install --no-build-isolation -v -v -e src |
| 93 | + env: |
| 94 | + SAGE_NUM_THREADS: 2 |
| 95 | + |
| 96 | + - name: Test |
| 97 | + shell: bash -l {0} |
| 98 | + run: ./sage -t --all -p0 |
| 99 | + |
| 100 | + - name: Print logs |
| 101 | + run: | |
| 102 | + for file in $(find . -type f -name "*.log"); do |
| 103 | + echo "::group::$file" |
| 104 | + cat "$file" |
| 105 | + echo "::endgroup::" |
| 106 | + done |
| 107 | + if: always() |
0 commit comments