Skip to content

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

🔄 synced file(s) with conda/infrastructure

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

Workflow file for this run

name: Tests
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:
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:
linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10']
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: defaults
activate-environment: test_env
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Source Scripts
run: |
conda install conda-build pip
# pip >=22 is required for pip install -e conda-index
pip install --upgrade pip
pip install -e .[test]
conda info -a
pytest --cov
analyze:
name: Analyze test results
needs: [linux]
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 }}-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
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
build:
name: Canary Build
needs: [analyze]
# 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/')
)
runs-on: ubuntu-latest
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
with:
package-name: ${{ github.event.repository.name }}
subdir: noarch
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 }}