-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add cd workflow with pip & conda deploy, etc. #27
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
channels: | ||
- conda-forge | ||
- accessnri | ||
- default | ||
|
||
dependencies: | ||
- anaconda-client | ||
- conda-build | ||
- conda-verify |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -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/[email protected] | ||||||||||||||||||||
|
||||||||||||||||||||
- name: Set up Python 3.11 | ||||||||||||||||||||
uses: actions/setup-python@v5 | ||||||||||||||||||||
with: | ||||||||||||||||||||
python-version: 3.11 | ||||||||||||||||||||
Comment on lines
+17
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although not super critical, you can cache the installation of later python packages by adding the
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
- 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' | ||||||||||||||||||||
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just so I understand, is it the intention that the Currently it will only run if: always() && (needs.pypi.result == 'success' || needs.pypi.result == 'skipped') If you do want it to run only |
||||||||||||||||||||
runs-on: "ubuntu-latest" | ||||||||||||||||||||
|
||||||||||||||||||||
steps: | ||||||||||||||||||||
- name: Checkout source | ||||||||||||||||||||
uses: actions/[email protected] | ||||||||||||||||||||
|
||||||||||||||||||||
- 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/[email protected] | ||||||||||||||||||||
with: | ||||||||||||||||||||
meta_yaml_dir: .conda | ||||||||||||||||||||
python-version: 3.11 | ||||||||||||||||||||
user: accessnri | ||||||||||||||||||||
label: main | ||||||||||||||||||||
token: ${{ secrets.anaconda_token }} | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It running
on.push
without specifying any branches might be overly broad. Is this deployment to PyPi supposed to be for only pushes tomain
? If so, it can be updated to: