Add conda native development environment setup #114
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: conda-auth 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/[email protected] | |
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: | |
python-version: ["3.8", "3.11"] | |
os: ["macos-latest", "ubuntu-latest", "windows-latest"] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: prefix-dev/[email protected] | |
with: | |
pixi-version: v0.6.0 | |
cache: true | |
- name: Install dependencies | |
run: | | |
pixi add python=${{ matrix.python-version }} && | |
pixi install | |
- name: Run test and generate coverage | |
run: pixi run testcov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
flags: ${{ runner.os }},${{ matrix.python-version }} | |
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/[email protected] | |
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' |