Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating project scafolding #7

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

111 changes: 89 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: conda-conda_protect tests
name: conda-protect tests

on:
push:
Expand All @@ -8,32 +8,99 @@ on:
branches:
- main

jobs:
build:
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.9", "3.10", "3.11"]
test-env: ["dev-py38", "dev-py39", "dev-py310", "dev-py311", "dev-py312"]
os: ["macos-latest", "ubuntu-latest", "windows-latest"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4

- uses: prefix-dev/[email protected]
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/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies (conda)
run: |
conda update -n base -c defaults conda
conda env update --file environment.yml --name base
conda install --file requirements.dev.txt
- name: Install latz
run: |
pip install -e .
- name: Test with pytest
run: |
pytest --doctest-modules
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'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ dmypy.json

# Local channel build stuff
.channel
# pixi environments
.pixi

Loading
Loading