Skip to content

🔄 synced file(s) with conda/infrastructure #896

🔄 synced file(s) with conda/infrastructure

🔄 synced file(s) with conda/infrastructure #896

Workflow file for this run

name: Tests
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
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
jobs:
run_test_suite:
name: ${{ matrix.os }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
CONDA_NUMBER_CHANNEL_NOTICES: 0
PYTHONUNBUFFERED: 1
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-13
python-version: "3.11"
- os: macos-13
python-version: "3.10"
- os: macos-13
python-version: "3.9"
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
with:
fetch-depth: 0
- name: Add Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get install libfile-mimeinfo-perl desktop-file-utils
echo "XDG_UTILS_DEBUG_LEVEL=2" >> $GITHUB_ENV
echo "XDG_CURRENT_DESKTOP=GNOME" >> $GITHUB_ENV
- name: Install miniforge
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca #v3.0.4
with:
miniforge-version: latest
- name: Add dependencies
shell: bash -el {0}
run: |
conda install -yq --solver libmamba \
--file tests/requirements.txt \
python=${{ matrix.python-version }}
- shell: bash -el {0}
name: Conda info
run: |
conda info
conda list
- shell: bash -el {0}
name: Install menuinst
run: |
python -m pip install -vv .
conda list
- shell: bash -el {0}
name: Run test suite
run: |
python -I -m pytest tests/ --cov-append --cov-report=xml --cov=menuinst -vvv
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 #v4.5.0
with:
name: ${{ matrix.os }}-py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }} # required
# canary builds
build:
name: Canary Build
needs: [run_test_suite]
# only build canary build if
# - prior steps succeeded,
# - this is the main repo, and
# - we are on the main, feature, or release branch
if: >-
always()
&& !github.event.repository.fork
&& (
github.ref_name == 'main'
|| startsWith(github.ref_name, 'feature/')
|| endsWith(github.ref_name, '.x')
)
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
subdir: linux-64
- runner: macos-13
subdir: osx-64
- runner: macos-14
subdir: osx-arm64
- 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@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
# Explicitly use Python 3.11 since each of the OSes has a different default Python
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f #v5.1.1
with:
python-version: "3.11"
- name: Detect label
shell: python
run: |
from pathlib import Path
from re import match
from os import environ
if "${{ github.ref_name }}" == "main":
# main branch commits are uploaded to the dev label
label = "dev"
elif "${{ github.ref_name }}".startswith("feature/"):
# feature branch commits are uploaded to a custom label
label = "${{ github.ref_name }}"
else:
# release branch commits are added to the rc label
# see https://github.com/conda/infrastructure/issues/760
_, name = "${{ github.repository }}".split("/")
label = f"rc-{name}-${{ github.ref_name }}"
Path(environ["GITHUB_ENV"]).write_text(f"ANACONDA_ORG_LABEL={label}")
- name: Create and upload canary build
uses: conda/actions/canary-release@976289d0cfd85139701b26ddd133abdd025a7b5f #v24.5.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: ${{ env.ANACONDA_ORG_LABEL }}
anaconda-org-token: ${{ secrets.ANACONDA_ORG_CONDA_CANARY_TOKEN }}
conda-build-arguments: "--override-channels -c conda-forge -c defaults"