Skip to content
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
50 changes: 0 additions & 50 deletions .github/workflows/release-test-conda.yml

This file was deleted.

63 changes: 60 additions & 3 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
name: Package Release Test
name: Package Release Test (TestPyPi and Anaconda)

on:
workflow_dispatch:
inputs:
deploy_testpypi:
description: Publish to TestPyPI
type: boolean
default: false
deploy_anaconda:
description: Publish to Anaconda.org (test label)
type: boolean
default: false

jobs:
build:
name: Build distribution
if: inputs.deploy_testpypi
runs-on: ubuntu-latest

steps:
Expand All @@ -30,11 +40,12 @@ jobs:

publish-to-testpypi:
needs: build
if: inputs.deploy_testpypi
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/switcher_client
url: https://test.pypi.org/p/switcher-client

permissions:
id-token: write
Expand All @@ -48,4 +59,50 @@ jobs:
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

publish-to-anaconda:
if: inputs.deploy_anaconda
runs-on: ubuntu-latest

environment:
name: anaconda
url: https://anaconda.org/switcherapi/switcher-client

steps:
- uses: actions/checkout@v6

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.12"
channels: conda-forge
channel-priority: strict
conda-remove-defaults: true

- name: Install build tools
shell: bash -el {0}
run: conda install -y conda-build anaconda-client

- name: Get package version
shell: bash -el {0}
run: |
PKG_VER=$(grep '__version__' switcher_client/version.py | cut -d'"' -f2)
echo "PKG_VERSION=$PKG_VER" >> $GITHUB_ENV
printf "pkg_version:\n - $PKG_VER\n" > conda.recipe/conda_build_config.yaml

- name: Build conda package
shell: bash -el {0}
run: conda build --no-test conda.recipe/ --output-folder dist/ -c conda-forge

- name: Publish distribution to Anaconda.org
shell: bash -el {0}
run: |
anaconda \
--token ${{ secrets.ANACONDA_TOKEN }} \
upload \
--user switcherapi \
--label test \
--force \
$(find dist/ -name "*.tar.bz2" -o -name "*.conda")
74 changes: 73 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,35 @@ on:
types: [ created ]

jobs:
test:
name: Test - Python ${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Git checkout
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev

- name: Test
run: pipenv run pytest -v

build:
name: Build distribution
needs: test
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -35,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/switcher_client
url: https://pypi.org/p/switcher-client
permissions:
id-token: write

Expand All @@ -47,3 +74,48 @@ jobs:
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-anaconda:
needs:
- build
runs-on: ubuntu-latest
environment:
name: anaconda
url: https://anaconda.org/switcherapi/switcher-client

steps:
- uses: actions/checkout@v6

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.12"
channels: conda-forge
channel-priority: strict
conda-remove-defaults: true

- name: Install build tools
shell: bash -el {0}
run: conda install -y conda-build anaconda-client

- name: Get package version
shell: bash -el {0}
run: |
PKG_VER=$(grep '__version__' switcher_client/version.py | cut -d'"' -f2)
echo "PKG_VERSION=$PKG_VER" >> $GITHUB_ENV
printf "pkg_version:\n - $PKG_VER\n" > conda.recipe/conda_build_config.yaml

- name: Build conda package
shell: bash -el {0}
run: conda build --no-test conda.recipe/ --output-folder dist/ -c conda-forge

- name: Publish distribution to Anaconda.org
shell: bash -el {0}
run: |
anaconda \
--token ${{ secrets.ANACONDA_TOKEN }} \
upload \
--user switcherapi \
--label main \
$(find dist/ -name "*.tar.bz2" -o -name "*.conda")
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.projectKey=switcherapi_switcher-client-py
sonar.projectName=switcher-client-py
sonar.organization=switcherapi
sonar.projectVersion=0.1.1
sonar.projectVersion=0.1.2
sonar.links.homepage=https://github.com/switcherapi/switcher-client-py

sonar.sources=switcher_client
Expand Down
2 changes: 1 addition & 1 deletion switcher_client/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.1"
__version__ = "0.1.2"