diff --git a/.conda/environment.yml b/.conda/environment.yml new file mode 100644 index 0000000..5064f64 --- /dev/null +++ b/.conda/environment.yml @@ -0,0 +1,9 @@ +channels: + - conda-forge + - accessnri + - default + +dependencies: + - anaconda-client + - conda-build + - conda-verify diff --git a/.conda/meta.yaml b/.conda/meta.yaml new file mode 100644 index 0000000..2ca6e40 --- /dev/null +++ b/.conda/meta.yaml @@ -0,0 +1,37 @@ +{% set data = load_setup_py_data(setup_file='../setup.py', from_recipe_dir=True) %} +{% set version = data.get('version') %} + +package: + name: access-py-telemetry + version: "{{ version }}" + +source: + url: "https://pypi.io/packages/source/a/access-py-telemetry/access_py_telemetry-{{ version }}.tar.gz" + +build: + noarch: python + number: 0 + script: "{{ PYTHON }} -m pip install . -vv" + +requirements: + host: + - python + - pip + - versioneer + run: + - python >=3.10 + - ipython>=7.0.0 + - pydantic>=2.0.0 + - pyyaml>=6.0.0 + - httpx>=0.28.0 + +about: + home: https://github.com/ACCESS-NRI/access-py-telemetry + license: Apache Software + license_family: APACHE + summary: "Tools to add telemetry data to Python package usage" + # doc_url: https://access-py-telemetry-catalog.readthedocs.io/en/latest/ + +extra: + recipe-maintainers: + - charles-turner-1 diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..f465c6b --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,62 @@ +name: CD + +on: [push, pull_request] + +jobs: + pypi: + name: build and deploy to PyPI + if: github.repository == 'ACCESS-NRI/access-py-telemetry' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + runs-on: "ubuntu-latest" + permissions: + id-token: write + + steps: + - name: Checkout source + uses: actions/checkout@v4.2.2 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install build dependencies + run: python -m pip install build twine + + - name: Build distributions + shell: bash -l {0} + run: | + git clean -xdf + pyproject-build + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + conda: + name: build and deploy to conda + needs: pypi + if: always() && needs.pypi.result == 'success' + runs-on: "ubuntu-latest" + + steps: + - name: Checkout source + uses: actions/checkout@v4.2.2 + + - name: Setup conda environment + uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + python-version: 3.11 + environment-file: .conda/environment.yml + auto-update-conda: false + auto-activate-base: false + show-channel-urls: true + + - name: Build and upload the conda package + uses: uibcdf/action-build-and-upload-conda-packages@v1.4.0 + with: + meta_yaml_dir: .conda + python-version: 3.11 + user: accessnri + label: main + token: ${{ secrets.anaconda_token }} +