[pre-commit.ci] pre-commit autoupdate #104
Workflow file for this run
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: "[CI] conda-tui" | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: v[0-9]+.[0-9]+.[0-9]+* | |
merge_group: | |
jobs: | |
build: | |
name: Build package | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout code and setup miniconda with build dependencies | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- uses: conda-incubator/setup-miniconda@3b0f2504dd76ef23b6d31f291f4913fb60ab5ff3 # v2 | |
with: | |
miniconda-version: latest | |
python-version: "3.10" | |
channels: conda-forge | |
activate-environment: build-env | |
environment-file: etc/build-environment.yml | |
auto-activate-base: false | |
# Build the package and copy the output into ./conda-bld | |
- name: conda build | |
shell: bash -l {0} | |
run: | | |
VERSION=`python -m setuptools_scm` conda build conda.recipe | |
mv $CONDA_PREFIX/conda-bld . | |
- name: Upload the build artifact | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 | |
with: | |
name: package-${{ github.sha }} | |
path: conda-bld | |
test: | |
name: Test, Python ${{ matrix.python-version }} | |
runs-on: | |
labels: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
# Checkout code and setup miniconda with test dependencies | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- uses: conda-incubator/setup-miniconda@3b0f2504dd76ef23b6d31f291f4913fb60ab5ff3 # v2 | |
with: | |
miniconda-version: latest | |
python-version: "${{ matrix.python-version }}" | |
channels: conda-forge | |
activate-environment: test-env | |
environment-file: etc/test-environment.yml | |
auto-activate-base: false | |
# Run the tests in an isolated environment using tox | |
- name: Test with tox | |
shell: bash -l {0} | |
run: tox | |
# This check job runs to ensure all tests and builds have passed, such that we can use it as a "wildcard" | |
# for branch protection to ensure all tests pass before a PR can be merged. | |
check: | |
name: Check all tests passed | |
if: always() | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether all required jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
publish-conda-pkg-to-anaconda-dot-org: | |
name: Publish conda package to Anaconda.org | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' # Only run on push to main branch | |
needs: [check] | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- uses: conda-incubator/setup-miniconda@3b0f2504dd76ef23b6d31f291f4913fb60ab5ff3 # v2 | |
with: | |
miniconda-version: latest | |
activate-environment: publish-env | |
environment-file: etc/publish-environment.yml | |
auto-activate-base: false | |
- name: Download the build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3 | |
with: | |
name: package-${{ github.sha }} | |
path: ~/conda-bld | |
- name: publish | |
shell: bash -l {0} | |
env: | |
TOKEN: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} | |
run: | | |
[[ -z "${TOKEN}" ]] && exit 1 | |
[[ "$GITHUB_REF" =~ ^refs/tags/v ]] || export LABEL="--label dev" | |
anaconda --verbose \ | |
--token $TOKEN \ | |
upload \ | |
--user mattkram \ | |
$LABEL \ | |
--force \ | |
~/conda-bld/noarch/conda-tui-* |