Skip to content

Tests

Tests #1085

Workflow file for this run

name: Tests
on:
push:
branches:
- main
paths:
- ".github/workflows/tests.yml"
- "conda_libmamba_solver/**"
- "dev/**"
- "recipe/**"
- "tests/**"
- "pyproject.toml"
pull_request:
paths:
- ".github/workflows/tests.yml"
- "conda_libmamba_solver/**"
- "dev/**"
- "recipe/**"
- "tests/**"
- "pyproject.toml"
schedule:
- cron: "15 6 * * 1-5" # Mon to Fri, 6:15am
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CONDA_SOLVER: libmamba
jobs:
linux:
name: Linux, Python ${{ matrix.python-version }}, ${{ matrix.default-channel }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.8"
default-channel: defaults
- python-version: "3.9"
default-channel: defaults
- python-version: "3.10"
default-channel: defaults
- python-version: "3.11"
default-channel: conda-forge
env:
OS: "linux"
PYTHON: ${{ matrix.python-version }}
steps:
- name: Checkout our source
uses: actions/checkout@v3
with:
path: conda-libmamba-solver
fetch-depth: 0
- name: Checkout conda
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda
path: conda
- name: Python ${{ matrix.python-version }}
run: >
docker run
--rm
-v ${GITHUB_WORKSPACE}/conda:/opt/conda-src
-v ${GITHUB_WORKSPACE}/conda-libmamba-solver:/opt/conda-libmamba-solver-src
-e TEST_SPLITS
-e TEST_GROUP
-e CONDA_SOLVER
ghcr.io/conda/conda-ci:main-linux-python${{ matrix.python-version }}${{ matrix.default-channel == 'conda-forge' && '-conda-forge' || '' }}
bash -c "sudo env CONDA_SOLVER=classic \
/opt/conda/condabin/conda install -p /opt/conda \
--repodata-fn=repodata.json --update-specs \
--file /opt/conda-src/tests/requirements.txt \
--file /opt/conda-src/tests/requirements-s3.txt \
--file /opt/conda-libmamba-solver-src/dev/requirements.txt \
--file /opt/conda-libmamba-solver-src/tests/requirements.txt &&
sudo /opt/conda/bin/python -m pip install /opt/conda-libmamba-solver-src --no-deps -vvv &&
source /opt/conda-src/dev/linux/bashrc.sh &&
/opt/conda/bin/python -m pytest /opt/conda-libmamba-solver-src -vv -m 'not slow'"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
# name has to be unique, to not overwrite uploads of other matrix runs. sha1 is optional and only to differentiate
# when locally dowloading and comparing results of different workflow runs.
name: test-results-${{ github.sha }}-${{ runner.os }}-${{ matrix.default-channel }}-${{ matrix.python-version }}-cls
path: |
conda/.coverage
conda/test-report.xml
retention-days: 1
macos:
name: MacOS, Python ${{ matrix.python-version }}, ${{ matrix.default-channel }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.8"
default-channel: "defaults"
- python-version: "3.11"
default-channel: "conda-forge"
env:
OS: "macos"
PYTHON: ${{ matrix.python-version }}
steps:
- name: Checkout our source
uses: actions/checkout@v3
with:
path: conda-libmamba-solver
fetch-depth: 0
- name: Checkout conda
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda
path: conda
- uses: conda-incubator/setup-miniconda@v2
name: Setup miniconda for defaults
if: matrix.default-channel == 'defaults'
env:
CONDA_SOLVER: classic
with:
activate-environment: conda-test-env
miniconda-version: latest
python-version: ${{ matrix.python-version }}
- uses: conda-incubator/setup-miniconda@v2
name: Setup miniconda for conda-forge
if: matrix.default-channel == 'conda-forge'
env:
CONDA_SOLVER: classic
with:
activate-environment: conda-test-env
miniforge-version: latest
python-version: ${{ matrix.python-version }}
- name: Setup environment
shell: bash -el {0}
working-directory: conda
env:
# with 4.12 out, ensure classic is used to install conda-libmamba-solver deps
# otherwise it will error out because it can't be imported yet!
CONDA_SOLVER: classic
run: |
set -euxo pipefail
# restoring the default for changeps1 to have parity with dev
conda config --set changeps1 true
# install all test requirements
conda install --yes \
--file tests/requirements.txt \
--file tests/requirements-s3.txt \
--file ../conda-libmamba-solver/dev/requirements.txt \
--file ../conda-libmamba-solver/tests/requirements.txt \
python=${{ matrix.python-version }}
conda update openssl ca-certificates certifi
conda info
python -c "from importlib.metadata import version; print('libmambapy', version('libmambapy'))"
- name: Install conda-libmamba-solver
shell: bash -el {0}
working-directory: conda-libmamba-solver
run: |
python -m pip install . -vv --no-deps
- name: Python ${{ matrix.python-version }}
shell: bash -el {0}
working-directory: conda
run: |
eval "$(sudo ${CONDA_PREFIX}/bin/python -m conda init bash --dev)"
python -m pytest ${GITHUB_WORKSPACE}/conda-libmamba-solver -vv -m "not slow"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
# name has to be unique, to not overwrite uploads of other matrix runs. sha1 is optional and only to differentiate
# when locally dowloading and comparing results of different workflow runs.
name: test-results-${{ github.sha }}-${{ runner.os }}-${{ matrix.default-channel }}-${{ matrix.python-version }}-cls
path: |
conda/.coverage
conda/test-report.xml
retention-days: 1
windows:
name: Windows, Python ${{ matrix.python-version }}, ${{ matrix.default-channel }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.11"]
default-channel: [conda-forge]
include:
- python-version: "3.9"
default-channel: defaults
env:
OS: "windows"
PYTHON: ${{ matrix.python-version }}
steps:
- name: Checkout our source
uses: actions/checkout@v3
with:
path: conda-libmamba-solver
fetch-depth: 0
- name: Checkout conda
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda
path: conda
- name: Set temp dirs correctly
# https://github.com/actions/virtual-environments/issues/712
run: |
echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
- name: Setup environment
shell: cmd
working-directory: conda
env:
# with 4.12 out, ensure classic is used to install conda-libmamba-solver deps
# otherwise it will error out because it can't be imported yet!
CONDA_SOLVER: classic
CONDA_CHANNELS: ${{ matrix.default-channel }}
CONDA_CHANNEL_PRIORITY: ${{ matrix.default-channel == 'conda-forge' && 'strict' || 'flexible' }}
run: |
:: add mamba to requirements
type ..\conda-libmamba-solver\dev\requirements.txt >> .\tests\requirements.txt
type ..\conda-libmamba-solver\tests\requirements.txt >> .\tests\requirements.txt
if errorlevel 1 exit 1
:: initialize conda dev
call .\dev\windows\setup.bat
if errorlevel 1 exit 1
call .\dev-init.bat
if errorlevel 1 exit 1
python -c "from importlib.metadata import version; print('libmambapy', version('libmambapy'))"
if errorlevel 1 exit 1
conda info -a
if errorlevel 1 exit 1
- name: Install conda-libmamba-solver
shell: cmd
working-directory: conda
run: |
call .\dev-init.bat
if errorlevel 1 exit 1
python -m pip install --no-deps -vv "%GITHUB_WORKSPACE%\conda-libmamba-solver"
if errorlevel 1 exit 1
- name: Python ${{ matrix.python-version }}
shell: cmd
working-directory: conda
run: |
CALL dev-init.bat
if errorlevel 1 exit 1
python -m pytest "%GITHUB_WORKSPACE%\conda-libmamba-solver" -vv -m "not slow" --timeout=600
if errorlevel 1 exit 1
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
# name has to be unique, to not overwrite uploads of other matrix runs. sha1 is optional and only to differentiate
# when locally dowloading and comparing results of different workflow runs.
name: test-results-${{ github.sha }}-${{ runner.os }}-${{ matrix.default-channel }}-${{ matrix.python-version }}-cls
path: |
conda/.coverage
conda/test-report.xml
retention-days: 1
# aggregate and upload
aggregate:
# only aggregate test suite if there are code changes
needs: [windows, linux, macos]
if: always()
runs-on: ubuntu-latest
steps:
- name: Download test results
uses: actions/download-artifact@v3
- name: Upload combined test results
# provides one downloadable archive of all .coverage/test-report.xml files
# of all matrix runs for further analysis.
uses: actions/upload-artifact@v3
with:
name: test-results-${{ github.sha }}-cls-all
path: test-results-${{ github.sha }}-*
retention-days: 30 # default: 90
- name: Test Summary
uses: test-summary/action@v2
with:
paths: ./test-results-${{ github.sha }}-**/test-report*.xml
# required check
analyze:
name: Analyze results
needs: [windows, linux, macos, aggregate]
if: always()
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
id: alls-green # CONDA-LIBMAMBA-SOLVER CHANGE
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
- name: Checkout our source
uses: actions/checkout@v3
if: always() && github.event_name == 'schedule' && steps.alls-green.outputs.result == 'failure'
- name: Report failures
if: always() && github.event_name == 'schedule' && steps.alls-green.outputs.result == 'failure'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.CONDA_LIBMAMBA_SOLVER_ISSUES }}
RUN_ID: ${{ github.run_id }}
TITLE: "Scheduled tests failed"
with:
filename: .github/TEST_FAILURE_REPORT_TEMPLATE.md
update_existing: true
build:
name: Canary Build
needs: [analyze]
# only build canary build if
# only build canary build if
# - prior steps succeeded,
# - this is the main repo, and
# - we are on the main (or feature) branch
if: >-
success()
&& !github.event.repository.fork
&& (
github.ref_name == 'main'
|| startsWith(github.ref_name, 'feature/')
)
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: noarch
env:
CONDA_SOLVER: classic
runs-on: ${{ matrix.runner }}
steps:
# Clean checkout of specific git ref needed for package metadata version
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- name: Create and upload canary build
uses: conda/actions/[email protected]
with:
package-name: ${{ github.event.repository.name }}
subdir: ${{ matrix.subdir }}
anaconda-org-channel: conda-canary
anaconda-org-label: ${{ github.ref_name == 'main' && 'dev' || format('{0}-{1}', github.event.repository.name, github.ref_name) }}
anaconda-org-token: ${{ secrets.CONDA_CANARY_ANACONDA_ORG_TOKEN }}
conda-build-arguments: '--override-channels -c conda-forge -c defaults'