Skip to content

chore(deps): update otel/opentelemetry-collector-contrib:latest docke… #220

chore(deps): update otel/opentelemetry-collector-contrib:latest docke…

chore(deps): update otel/opentelemetry-collector-contrib:latest docke… #220

Workflow file for this run

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/webhook-events-and-payloads#merge_group
merge_group:
# 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/**'
- 'docs/**'
- '*.py'
- 'conda.recipe/**'
- '.github/workflows/tests.yml'
tests:
needs: changes
if: github.event_name == 'schedule' || needs.changes.outputs.code == 'true'
defaults:
run:
# https://github.com/conda-incubator/setup-miniconda#use-a-default-shell
shell: bash -el {0} # bash exit immediately on error + login shell
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
exclude:
# Windows: only test lowest and highest Python versions
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.11'
# macOS x86_64: only test lowest Python version
- os: macos-13
python-version: '3.10'
- os: macos-13
python-version: '3.11'
- os: macos-13
python-version: '3.12'
# macOS arm64: only test highest Python version
- os: macos-14
python-version: '3.9'
- os: macos-14
python-version: '3.10'
- os: macos-14
python-version: '3.11'
runs-on: ${{ matrix.os }}
env:
ErrorActionPreference: Stop # powershell exit immediately on error
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@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/conda_pkgs_dir
key: cache-${{ env.HASH }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
run-post: false # skip post cleanup
# conda not preinstalled in arm64 runners
miniconda-version: ${{ runner.arch == 'ARM64' && 'latest' || null }}
architecture: ${{ runner.arch }}
channels: defaults
- name: Conda Install
run: >
conda install
--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: pip install -e .
- name: Conda Info
# view test env info (not base)
run: python -m conda info --verbose
- name: Conda Config
run: conda config --show-sources
- name: Conda List
run: conda list --show-channel-urls
- 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_docs:
needs: changes
if: github.event_name == 'schedule' || needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
run-post: false # skip post cleanup
miniconda-version: latest
channels: defaults
- name: Install Dependencies
run: conda env update --name base --file docs/environment.yml
- name: Build Docs
run: conda run --name base make -C docs html
# required check
analyze:
needs: [tests]
if: '!cancelled()'
runs-on: ubuntu-latest
steps:
- name: Determine Success
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
id: alls-green
with:
# permit jobs to be skipped if there are no code changes (see changes job)
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
- name: Checkout Source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# source code is needed to report failures
if: always() && github.event_name != 'pull_request' && steps.alls-green.outputs.result == 'failure'
- name: Report Failures
if: always() && github.event_name != 'pull_request' && steps.alls-green.outputs.result == 'failure'
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.AUTO_REPORT_TEST_FAILURE }}
RUN_ID: ${{ github.run_id }}
TITLE: Tests failed
with:
filename: .github/TEST_FAILURE_REPORT_TEMPLATE.md
update_existing: false
# canary builds
build:
needs: [analyze]
# only build canary build if
# - prior steps succeeded,
# - this is the main repo, and
# - we are on the main, feature, or release branch
if: >-
!cancelled()
&& !github.event.repository.fork
&& (
github.ref_name == 'main'
|| startsWith(github.ref_name, 'feature/')
|| endsWith(github.ref_name, '.x')
)
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: noarch
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
# Explicitly use Python 3.11 since each of the OSes has a different default Python
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Detect Label
shell: python
run: |
import re
from pathlib import Path
from os import environ
from subprocess import check_output
# unless otherwise specified, commits are uploaded to the dev label
# e.g., `main` branch commits
envs = {"ANACONDA_ORG_LABEL": "dev"}
if "${{ github.ref_name }}".startswith("feature/"):
# feature branch commits are uploaded to a custom label
envs["ANACONDA_ORG_LABEL"] = "${{ github.ref_name }}"
elif re.match(r"\d+(\.\d+)+\.x", "${{ github.ref_name }}"):
# release branch commits are added to the rc label
# see https://github.com/conda/infrastructure/issues/760
_, name = "${{ github.repository }}".split("/")
envs["ANACONDA_ORG_LABEL"] = f"rc-{name}-${{ github.ref_name }}"
# if no releases have occurred on this branch yet then `git describe --tag`
# will misleadingly produce a version number relative to the last release
# and not relative to the current release branch, if this is the case we need
# to override the version with a derivative of the branch name
# override the version if `git describe --tag` does not start with the branch version
last_release = check_output(["git", "describe", "--tag"])
prefix = "${{ github.ref_name }}"[:-1] # without x suffix
if not last_release.startswith(prefix):
envs["VERSION_OVERRIDE"] = "${{ github.ref_name }}"
Path(environ["GITHUB_ENV"]).write_text("\n".join(f"{name}={value}" for name, value in envs.items()))
- name: Create & Upload
uses: conda/actions/canary-release@6e72e0db87e72f0020e493aeb02f864363bd9258 # v24.11.1
with:
package-name: ${{ github.event.repository.name }}
subdir: ${{ matrix.subdir }}
anaconda-org-channel: distribution-plugins
anaconda-org-label: ${{ env.ANACONDA_ORG_LABEL }}
anaconda-org-token: ${{ secrets.ANACONDA_ORG_TOKEN }}