chore(config): migrate renovate config #111
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: Tests | |
on: | |
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#push | |
push: | |
branches: | |
- main | |
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request | |
pull_request: | |
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch | |
workflow_dispatch: | |
# no payload | |
schedule: | |
# https://crontab.guru/#37_18_*_*_* | |
- cron: 37 18 * * * | |
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: | |
# https://conda.github.io/conda-libmamba-solver/user-guide/configuration/#advanced-options | |
CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED: true | |
jobs: | |
# detect whether any code changes are included in this PR | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
# necessary to detect changes | |
# https://github.com/dorny/paths-filter#supported-workflows | |
pull-requests: read | |
contents: read | |
outputs: | |
code: ${{ steps.filter.outputs.code }} | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
# dorny/paths-filter needs git clone for non-PR events | |
# https://github.com/dorny/paths-filter#supported-workflows | |
if: github.event_name != 'pull_request' | |
- name: Filter Changes | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: | | |
code: | |
- 'conda_anaconda_telemetry/**' | |
- 'tests/**' | |
- '*.py' | |
- 'conda.recipe/**' | |
- '.github/workflows/tests.yml' | |
tests: | |
needs: changes | |
if: needs.changes.outputs.code == 'true' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.12"] | |
os: ["macos-latest", "ubuntu-latest", "windows-latest"] | |
steps: | |
# Clean checkout of specific git ref needed for package metadata version | |
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR: | |
- name: Checkout Source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.ref }} | |
clean: true | |
fetch-depth: 0 | |
- name: Hash + Timestamp | |
run: echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ matrix.python-version }}-$(date -u "+%Y%m")" >> $GITHUB_ENV | |
- name: Cache Conda | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 | |
with: | |
path: ~/conda_pkgs_dir | |
key: cache-${{ env.HASH }} | |
- uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3 | |
name: Setup Miniconda | |
with: | |
python-version: ${{ matrix.python-version }} | |
channels: defaults | |
run-post: false # skip post cleanup | |
- name: Conda Install | |
run: > | |
conda install | |
--name test | |
--yes | |
--file tests/requirements.txt | |
--file tests/requirements-ci.txt | |
python=${{ matrix.python-version }} | |
# TODO: how can we remove this step? | |
- name: Install Self | |
run: conda run --name test pip install --no-build-isolation --no-deps e . | |
- name: Conda Info | |
run: conda info --verbose | |
- name: Conda Config | |
run: conda config --show-sources | |
- name: Conda List | |
run: conda list --show-channel-urls --name test | |
- name: Run Tests | |
# Windows is sensitive to long paths, using `--basetemp=${{ runner.temp }} to | |
# keep the test directories shorter | |
run: > | |
conda run --name test | |
pytest | |
--doctest-modules | |
--cov=conda_anaconda_telemetry | |
--basetemp=${{ runner.temp }} | |
-n auto | |
build: | |
needs: [tests] | |
# only build canary build if | |
# - prior steps succeeded, | |
# - this is the main branch | |
if: >- | |
success() | |
&& !github.event.repository.fork | |
strategy: | |
matrix: | |
include: | |
- runner: ubuntu-latest | |
subdir: noarch | |
python-version: 3.12 | |
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: | |
- name: Checkout Source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.ref }} | |
clean: true | |
fetch-depth: 0 | |
- name: Hash + Timestamp | |
run: echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ matrix.python-version }}-$(date -u "+%Y%m")" >> $GITHUB_ENV | |
- name: Cache Conda | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 | |
with: | |
path: ~/conda_pkgs_dir | |
key: cache-${{ env.HASH }} | |
- uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3 | |
name: Setup Miniconda | |
with: | |
python-version: ${{ matrix.python-version }} | |
channels: defaults | |
run-post: false # skip post cleanup | |
# conda not preinstalled in arm64 runners | |
miniconda-version: ${{ runner.arch == 'ARM64' && 'latest' || null }} | |
architecture: ${{ runner.arch }} | |
- name: Build package | |
# make sure we don't run on forks | |
if: github.repository_owner == 'anaconda' | |
id: build | |
shell: bash -l {0} | |
env: | |
# Run conda-build in isolated activation to properly package the software | |
_CONDA_BUILD_ISOLATED_ACTIVATION: 1 | |
run: | | |
set -euo pipefail | |
conda activate test | |
conda install --yes --quiet conda-build anaconda-client | |
# git needs to be installed after conda-build | |
# see https://github.com/conda/conda/issues/11758 | |
# see https://github.com/conda/actions/pull/47 | |
conda install --yes --quiet git | |
conda info | |
conda config --show-sources | |
conda list | |
conda build --croot=${{ runner.temp }}/pkgs --override-channels -c conda-canary/label/dev -c defaults recipe | |
- name: Set variables | |
id: set-vars | |
run: | | |
echo "PACKAGE_LABEL=${{ github.ref_name == 'main' && 'dev' || format('{0}-{1}', github.event.repository.name, github.ref_name) }}" >> $GITHUB_ENV | |
echo "PACKAGE_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV | |
- name: Upload package | |
# make sure we don't run in branches | |
if: github.ref_name == 'main' | |
id: upload | |
shell: bash -l {0} | |
run: | | |
echo "::group::Uploading package" | |
anaconda \ | |
--token="${{ secrets.ANACONDA_ORG_TOKEN }}" \ | |
upload \ | |
--force \ | |
--register \ | |
--no-progress \ | |
--user="distribution-plugins" \ | |
--label="$PACKAGE_LABEL" \ | |
${{ runner.temp }}/pkgs/${{ matrix.subdir }}/$PACKAGE_NAME-*.tar.bz2 | |
echo "Uploaded the following files:" | |
basename -a ./pkgs/${{ matrix.subdir }}/$PACKAGE_NAME-*.tar.bz2 | |
echo "::endgroup::" | |
echo "Use this command to try out the build:" | |
echo "conda install -c distribution-plugins/label/$PACKAGE_LABEL $PACKAGE_NAME" |