Skip to content

Merge pull request #8 from conda-incubator/project-scaffolding-updates #22

Merge pull request #8 from conda-incubator/project-scaffolding-updates

Merge pull request #8 from conda-incubator/project-scaffolding-updates #22

Workflow file for this run

name: conda-protect tests
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: 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
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v3
# dorny/paths-filter needs git clone for push events
# https://github.com/dorny/paths-filter#supported-workflows
if: github.event_name != 'pull_request'
- uses: dorny/paths-filter@v2.11.1
id: filter
with:
filters: |
code:
- 'conda_auth/**'
- 'tests/**'
- '*.py'
- 'recipe/**'
- '.github/workflows/tests.yml'
tests:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
test-env: ["dev-py38", "dev-py39", "dev-py310", "dev-py311", "dev-py312"]
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v3
- uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.23.0
environments: ${{ matrix.test-env }}
- name: Run test and generate coverage
run: pixi run --environment ${{matrix.test-env}} testcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
flags: ${{ runner.os }},${{ matrix.test-env }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build:
name: Canary Build
needs: [tests]
# only build canary build if
# - prior steps succeeded,
# - this is the main branch
if: >-
success()
&& !github.event.repository.fork
&& github.ref_name == 'main'
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: noarch
env:
CONDA_SOLVER: classic
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
# TODO: If this is ever promoted to conda, we should upload to "conda-canary" organization instead
- name: Create and upload canary build
uses: conda/actions/canary-release@v23.3.0
with:
package-name: ${{ github.event.repository.name }}
subdir: ${{ matrix.subdir }}
anaconda-org-channel: thath
anaconda-org-label: ${{ github.ref_name == 'main' && 'dev' || format('{0}-{1}', github.event.repository.name, github.ref_name) }}
anaconda-org-token: ${{ secrets.ANACONDA_ORG_TOKEN }}
conda-build-arguments: '--override-channels -c defaults'