Skip to content

Restore CTRL-C handling by setting new flag in libmamba #970

Restore CTRL-C handling by setting new flag in libmamba

Restore CTRL-C handling by setting new flag in libmamba #970

Workflow file for this run

# this is the sibling workflow to docs.yml, it is required to work around
# the skipped but required checks issue:
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Upstream tests # CONDA-LIBMAMBA-SOLVER CHANGE
on:
# NOTE: github.event context is push payload:
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
push:
branches:
- main
- feature/**
# NOTE: github.event context is pull_request payload:
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
pull_request:
# CONDA-LIBMAMBA-SOLVER CHANGE
schedule:
- cron: "15 7 * * 1-5" # Mon to Fri, 7:15am
# /CONDA-LIBMAMBA-SOLVER CHANGE
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
# see https://github.com/conda/conda-libmamba-solver/pull/159
MINIO_RELEASE: 'archive/minio.RELEASE.2023-03-13T19-46-17Z'
jobs:
# detect whether any code changes are included in this PR
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v3
# dorny/paths-filter needs git clone for push events
# https://github.com/marketplace/actions/paths-changes-filter#supported-workflows
# CONDA-LIBMAMBA-SOLVER CHANGE
if: github.event_name != 'pull_request'
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
id: filter
with:
# CONDA-LIBMAMBA-SOLVER CHANGE
# changed some paths:
filters: |
code:
- 'conda_libmamba_solver/**'
- 'tests/**'
- '*.py'
- 'recipe/**'
- '.github/workflows/upstream_tests.yml'
# /CONDA-LIBMAMBA-SOLVER CHANGE
# windows test suite
windows:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name == 'schedule'
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
default-channel: ['defaults', 'conda-forge']
python-version: ['3.8', '3.9', '3.10']
conda-subdir: ['win-64']
test-type: ['unit', 'integration']
test-group: ['1', '2', '3']
exclude:
# exclude all but one Python version for conda-forge
- default-channel: 'conda-forge'
python-version: '3.9'
- default-channel: 'conda-forge'
python-version: '3.10'
env:
OS: Windows
PYTHON: ${{ matrix.python-version }}
CONDA_SUBDIR: ${{ matrix.conda-subdir }}
TEST_SPLITS: 3
TEST_GROUP: ${{ matrix.test-group }}
steps:
- name: Checkout conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
path: conda # CONDA-LIBMAMBA-SOLVER CHANGE
# CONDA-LIBMAMBA-SOLVER CHANGE
- name: Checkout conda-libmamba-solver
uses: actions/checkout@v3
with:
fetch-depth: 0
path: conda-libmamba-solver
# /CONDA-LIBMAMBA-SOLVER CHANGE
# for cache
- if: ${{ runner.os == 'Windows' }}
name: Use GNU tar
shell: cmd
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- name: Cache conda packages
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 3
with:
# setup.bat makes a directory junction from \conda_bin to
# C:\Miniconda; cache on top of the C:\Miniconda directory that exists
# at this stage.
path: C:\Miniconda\envs\conda-test-env\pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-py${{ env.PYTHON }}-${{ matrix.default-channel }}-${{
hashFiles('recipe/meta.yaml', 'dev/windows/setup.bat', 'tests/requirements.txt') }}
- name: Cache minio
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 3
with:
path: minio.exe
key:
${{ runner.os }}-${{ env.MINIO_RELEASE && env.MINIO_RELEASE || 'minio' }}-${{ env.CACHE_NUMBER }}
- 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
# CONDA-LIBMAMBA-SOLVER CHANGE
working-directory: conda
env:
CONDA_CHANNELS: ${{ matrix.default-channel }}
CONDA_CHANNEL_PRIORITY: ${{ matrix.default-channel == 'conda-forge' && 'strict' || 'flexible' }}
run: |
:: extend conda requirements with our own
type "%GITHUB_WORKSPACE%\conda-libmamba-solver\dev\requirements.txt" >> .\tests\requirements.txt
if errorlevel 1 exit 1
:: initialize conda dev (original logic)
call .\dev\windows\setup.bat
if errorlevel 1 exit 1
call .\dev-init.bat
if errorlevel 1 exit 1
:: /original logic
:: Install test collection plugin
python -m pip install -vv "%GITHUB_WORKSPACE%\conda-libmamba-solver\dev\collect_upstream_conda_tests"
if errorlevel 1 exit 1
:: Install conda-libmamba-solver
python -m pip install --no-deps -vv "%GITHUB_WORKSPACE%\conda-libmamba-solver"
if errorlevel 1 exit 1
python -c "from importlib.metadata import version; print('libmambapy', version('libmambapy'))"
if errorlevel 1 exit 1
call conda info -a
if errorlevel 1 exit 1
# /CONDA-LIBMAMBA-SOLVER CHANGE
- name: Python ${{ matrix.python-version }} on ${{ matrix.default-channel }}, ${{ matrix.conda-subdir }}, ${{ matrix.test-type }} tests, group ${{ matrix.test-group }}
working-directory: conda # CONDA-LIBMAMBA-SOLVER CHANGE
shell: cmd
env:
CONDA_SOLVER: libmamba # CONDA-LIBMAMBA-SOLVER CHANGE
run: |
call .\dev\windows\${{ matrix.test-type }}.bat
- uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.test-type }}
env_vars: OS,PYTHON
- 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 }}-${{ matrix.conda-subdir }}-${{ matrix.test-type }}-${{ matrix.test-group }}
# CONDA-LIBMAMBA-SOLVER CHANGE: need to prepend conda/ to the paths
path: |
conda/.coverage
conda/.test_durations_${OS}
conda/test-report.xml
retention-days: 1
# linux test suite
linux:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name == 'schedule'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
default-channel: ['defaults', 'conda-forge']
python-version: ['3.8', '3.9', '3.10']
test-type: ['unit', 'integration']
test-group: ['1', '2', '3']
exclude:
# exclude all but one Python version for conda-forge
- default-channel: 'conda-forge'
python-version: '3.8'
- default-channel: 'conda-forge'
python-version: '3.9'
env:
OS: Linux
PYTHON: ${{ matrix.python-version }}
TEST_SPLITS: 3
TEST_GROUP: ${{ matrix.test-group }}
steps:
- name: Checkout conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
path: conda # CONDA-LIBMAMBA-SOLVER CHANGE
# CONDA-LIBMAMBA-SOLVER CHANGE
- name: Checkout conda-libmamba-solver
uses: actions/checkout@v3
with:
fetch-depth: 0
path: conda-libmamba-solver
# /CONDA-LIBMAMBA-SOLVER CHANGE
- name: Python ${{ matrix.python-version }} on ${{ matrix.default-channel }}, ${{ matrix.test-type }} tests, group ${{ matrix.test-group }}
env:
CONDA_SOLVER: libmamba # CONDA-LIBMAMBA-SOLVER CHANGE;
# we also added '-e CONDA_SOLVER' to the docker options below
# changes the paths to the volume(s) (plural, we also need conda-libmamba-solver)
# and changed the script being run to our vendored copy (last line)
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' || '' }}
/opt/conda-libmamba-solver-src/dev/linux/upstream_${{ matrix.test-type }}.sh
- uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.test-type }}
env_vars: OS,PYTHON
- 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 }}-${{ matrix.test-type }}-${{ matrix.test-group }}
# CONDA-LIBMAMBA-SOLVER CHANGE: need to prepend conda/ to the paths
path: |
conda/.coverage
conda/.test_durations_${OS}
conda/test-report.xml
retention-days: 1
# linux-qemu test suite
linux-qemu:
# only run test suite if there are code changes
needs: changes
if: false # needs.changes.outputs.code == 'true' # CONDA-LIBMAMBA-SOLVER CHANGE
# Run one single fast test per docker+qemu emulated linux platform to test that
# test execution is possible there (container+tools+dependencies work). Can be
# changed / extended to run specific tests in case there are platform related
# things to test. Running more tests is time consuming due to emulation
# (factor 2-10x slower).
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
default-channel: ['defaults', 'conda-forge']
python-version: ['3.10']
platform: ['arm64', 'ppc64le']
env:
OS: linux-${{ matrix.platform }}
PYTHON: ${{ matrix.python-version }}
steps:
- name: Checkout conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
path: conda # CONDA-LIBMAMBA-SOLVER CHANGE
# CONDA-LIBMAMBA-SOLVER CHANGE
- name: Checkout conda-libmamba-solver
uses: actions/checkout@v3
with:
fetch-depth: 0
path: conda-libmamba-solver
# /CONDA-LIBMAMBA-SOLVER CHANGE
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# Equivalent to locally run:
# `docker run --privileged --rm tonistiigi/binfmt --install all`
# CONDA-LIBMAMBA-SOLVER CHANGE
# - export CONDA_SOLVER
# -
- name: Python linux-${{ matrix.platform }} on ${{ matrix.default-channel }}, ${{ matrix.python-version }} tests
run: >
docker run
--rm
-v ${PWD}:/opt/conda-src
-v ${GITHUB_WORKSPACE}/conda-libmamba-solver:/opt/conda-libmamba-solver-src
--platform linux/${{ matrix.platform }}
-e TEST_SPLITS
-e TEST_GROUP
ghcr.io/conda/conda-ci:main-linux-python${{ matrix.python-version }}${{ matrix.default-channel == 'conda-forge' && '-conda-forge' || '' }}
bash -c "source /opt/conda/etc/profile.d/conda.sh; \
pytest --cov=conda -k test_DepsModifier_contract"
- 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 }}-linux-${{ matrix.platform }}-qemu-${{ matrix.default-channel }}-${{ matrix.python-version }}
# CONDA-LIBMAMBA-SOLVER CHANGE: need to prepend conda/ to the paths
path: |
conda/.coverage
conda/test-report.xml
retention-days: 1
# macos test suite
macos:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name == 'schedule'
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
default-channel: ['defaults', 'conda-forge']
python-version: ['3.9']
test-type: ['unit', 'integration']
test-group: ['1', '2', '3']
# fewer test splits for quicker unit tests, keep 3 splits for integration
test-splits: [2, 3]
exclude:
- test-type: unit
test-group: '3'
- test-type: unit
test-splits: 3
- test-type: integration
test-splits: 2
# odd choice kept for parity with previous commit
- test-type: integration
default-channel: 'conda-forge'
- test-type: unit
default-channel: 'defaults'
env:
OS: macOS
PYTHON: ${{ matrix.python-version }}
TEST_SPLITS: ${{ matrix.test-splits }}
TEST_GROUP: ${{ matrix.test-group }}
steps:
- name: Checkout conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: conda/conda # CONDA-LIBMAMBA-SOLVER CHANGE
path: conda # CONDA-LIBMAMBA-SOLVER CHANGE
# CONDA-LIBMAMBA-SOLVER CHANGE
- name: Checkout conda-libmamba-solver
uses: actions/checkout@v3
with:
fetch-depth: 0
path: conda-libmamba-solver
# /CONDA-LIBMAMBA-SOLVER CHANGE
- name: Cache conda packages
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 4
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-py${{ env.PYTHON }}-${{ matrix.default-channel }}-${{
hashFiles('recipe/meta.yaml', 'dev/macos/setup.sh', 'tests/requirements.txt') }}
- name: Cache minio
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 3
with:
path: minio
key:
${{ runner.os }}-${{ env.MINIO_RELEASE && env.MINIO_RELEASE || 'minio' }}-${{ env.CACHE_NUMBER }}
- 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
working-directory: conda # CONDA-LIBMAMBA-SOLVER CHANGE
shell: bash -el {0}
timeout-minutes: 15
run: |
# CONDA-LIBMAMBA-SOLVER CHANGE
cat ../conda-libmamba-solver/dev/requirements.txt >> tests/requirements.txt
# original setup
./dev/macos/setup.sh
# /original setup
python -c "from importlib.metadata import version; print('libmambapy', version('libmambapy'))"
python -m pip install ../conda-libmamba-solver/dev/collect_upstream_conda_tests -vv
python -m pip install ../conda-libmamba-solver -vv --no-deps
conda info -a
# /CONDA-LIBMAMBA-SOLVER CHANGE
- name: Python ${{ matrix.python-version }} on ${{ matrix.default-channel }}, ${{ matrix.test-type }} tests, group ${{ matrix.test-group }}
shell: bash -el {0}
working-directory: conda # CONDA-LIBMAMBA-SOLVER CHANGE
env:
CONDA_SOLVER: libmamba # CONDA-LIBMAMBA-SOLVER CHANGE
run: |
./dev/macos/${{ matrix.test-type }}.sh
- uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.test-type }}
env_vars: OS,PYTHON
- 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 }}-${{ matrix.test-type }}-${{ matrix.test-group }}
# CONDA-LIBMAMBA-SOLVER CHANGE: need to prepend conda/ to the paths
path: |
conda/.coverage
conda/.test_durations_${OS}
conda/test-report.xml
retention-days: 1
# aggregate and upload
aggregate:
# only aggregate test suite if there are code changes
needs: [changes, windows, linux, linux-qemu, macos]
if: needs.changes.outputs.code == 'true' || github.event_name == 'schedule'
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 }}-all
path: test-results-${{ github.sha }}-*
retention-days: 90 # 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, linux-qemu, 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) }}
# CONDA-LIBMAMBA-SOLVER CHANGE
- 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 upstream tests failed"
with:
filename: .github/TEST_FAILURE_REPORT_TEMPLATE.md
update_existing: true
# /CONDA-LIBMAMBA-SOLVER CHANGE
# canary builds
build:
name: Canary Build
needs: [analyze]
# only build canary build if
# - prior steps succeeded,
# - this is the main repo, and
# - event triggered by push, and # CONDA-LIBMAMBA-SOLVER CHANGE
# - we are on the main (or feature) branch
if: >-
success()
&& !github.event.repository.fork
&& github.event_name == 'push'
&& (
github.ref_name == 'main'
|| startsWith(github.ref_name, 'feature/')
)
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: linux-64
- runner: macos-latest
subdir: osx-64
- runner: windows-latest
subdir: win-64
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/canary-release@v22.10.0
env:
# Run conda-build in isolated activation to properly package conda
_CONDA_BUILD_ISOLATED_ACTIVATION: 1
with:
package-name: ${{ github.event.repository.name }}
subdir: ${{ matrix.subdir }}
anaconda-org-channel: conda-canary
anaconda-org-label: ${{ github.ref_name == 'main' && 'dev' || github.ref_name }}
anaconda-org-token: ${{ secrets.ANACONDA_ORG_CONDA_CANARY_TOKEN }}