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

Update to packaging tools and logic #403

Merged
merged 26 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
81cd400
move to pyproject.toml
dougiesquire Jan 16, 2024
5366367
add versioneer support
dougiesquire Jan 16, 2024
d47c473
remove bin and tools directories
dougiesquire Jan 16, 2024
e2d2419
build conda dist from PyPI dist
dougiesquire Jan 17, 2024
0cd93ae
fix dynamic versioning in meta.yaml
dougiesquire Jan 17, 2024
dc445a1
update requirements in meta.yaml
dougiesquire Jan 17, 2024
0c672cd
fix pylint issues
dougiesquire Jan 17, 2024
2c1a4d7
add pip, setuptools to conda host reqs
dougiesquire Jan 17, 2024
14bba8c
get conda build dependencies from pyproject.toml
dougiesquire Jan 17, 2024
b8e93a0
add full test build workflow to CI
dougiesquire Jan 17, 2024
fbbe71c
fix typo
dougiesquire Jan 17, 2024
631c414
tidy up workflows
dougiesquire Jan 17, 2024
2fcf5a2
fix typo
dougiesquire Jan 17, 2024
78f81ee
update pypi-publish action
dougiesquire Jan 18, 2024
1590ee5
give up on testing PyPI upload, conda build from local
dougiesquire Jan 18, 2024
ec29f7c
go back to vendored versioneer
dougiesquire Jan 18, 2024
02f576c
add versioneer back to conda host deps
dougiesquire Jan 18, 2024
b292ad1
add entry_points back into meta.yml to be safe
dougiesquire Jan 18, 2024
2e9a440
non-vendored versioneer, pylint skip versioneer file
dougiesquire Jan 18, 2024
47997b5
use full commit hash for 3rd-party actions
dougiesquire Jan 19, 2024
a53f8f2
add "release" github environment with PY_VERSION
dougiesquire Jan 19, 2024
95cb974
try using repository variable
dougiesquire Jan 19, 2024
63582b9
change configuration variable name
dougiesquire Jan 19, 2024
5e41cb1
just use workflow-level env variables for PY_VERSION
dougiesquire Jan 19, 2024
9196406
remove versioneer tag_prefix
dougiesquire Jan 19, 2024
e094ac4
Remove redundant pypi-publish if condition
dougiesquire Jan 22, 2024
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
payu/_version.py export-subst
75 changes: 39 additions & 36 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,24 @@
name: CD

on: [push, pull_request]
on:
push:
tags:
- '*'

jobs:
conda:
name: build and deploy to conda
if: github.repository == 'payu-org/payu' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
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 }}
env:
PY_VERSION: 3.11

jobs:
pypi-build:
name: Build package for PyPI
if: github.repository == 'payu-org/payu' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
if: github.repository == 'payu-org/payu'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: ${{ env.PY_VERSION }}

- run: |
python3 -m pip install --upgrade build && python3 -m build
Expand All @@ -54,7 +31,6 @@ jobs:
# Split build and publish to restrict trusted publishing to just this workflow
needs: ['pypi-build']
name: Publish to PyPI.org
if: github.repository == 'payu-org/payu' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
Expand All @@ -65,7 +41,34 @@ jobs:
path: artifact/

- name: Publish package distributions to PyPI
# This is version v1.8.10
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
with:
packages-dir: artifact/

dougiesquire marked this conversation as resolved.
Show resolved Hide resolved
conda:
name: Build with conda and upload
if: github.repository == 'payu-org/payu'
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
packages_dir: artifact/
miniconda-version: "latest"
python-version: ${{ env.PY_VERSION }}
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@c6e7a90ad5e599d6cde76e130db4ee52ad733ecf # v1.2.0
with:
meta_yaml_dir: conda
python-version: ${{ env.PY_VERSION }}
user: accessnri
label: main
token: ${{ secrets.anaconda_token }}
40 changes: 28 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,50 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
PY_VERSION: 3.11

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
pypa-build:
name: PyPA build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: ${{ env.PY_VERSION }}

- run: |
python3 -m pip install --upgrade build && python3 -m build

- uses: actions/upload-artifact@v3
with:
path: ./dist

conda-build:
name: Conda Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a # v3.0.1
with:
miniconda-version: "latest"
python-version: 3.11
python-version: ${{ env.PY_VERSION }}
environment-file: conda/environment.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true

- name: Run conda build
shell: bash -el {0}
# For the build, these environment variables would usually be set based on repo tags,
# but they can be these defaults instead since we don't use the build
env:
GIT_DESCRIBE_TAG: test
GIT_DESCRIBE_NUMBER: 0
run: conda build . --no-anaconda-upload
dougiesquire marked this conversation as resolved.
Show resolved Hide resolved

build:
tests:
name: Tests
runs-on: ubuntu-latest

# Run the job for different versions of python
Expand Down Expand Up @@ -76,18 +92,18 @@ jobs:
PYTHONPATH=. pytest --cov=payu -s test;

- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
uses: AndreMiras/coveralls-python-action@f5fd5c309b39d01599fb92c72d4f7409ea78aec9 # v20201129
with:
parallel: true

- name: Make docs
run: cd docs && make html

coveralls_finish:
needs: build
name: Coveralls Finished
needs: tests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
- uses: AndreMiras/coveralls-python-action@f5fd5c309b39d01599fb92c72d4f7409ea78aec9 # v20201129
with:
parallel-finished: true
5 changes: 5 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[MAIN]

# Files or directories to be skipped. They should be base names, not
# paths.
ignore=_version.py
4 changes: 0 additions & 4 deletions bin/payu

This file was deleted.

4 changes: 0 additions & 4 deletions bin/payu-collate

This file was deleted.

4 changes: 0 additions & 4 deletions bin/payu-profile

This file was deleted.

4 changes: 0 additions & 4 deletions bin/payu-run

This file was deleted.

4 changes: 0 additions & 4 deletions bin/payu-sync

This file was deleted.

1 change: 1 addition & 0 deletions conda/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dependencies:
- anaconda-client
- conda-build
- conda-verify
- versioneer
56 changes: 25 additions & 31 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,45 @@
{% set data = load_setup_py_data(setup_file='../setup.py', from_recipe_dir=True) %}
{% set version = data.get('version') %}
{% set pyproj = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
{% set project = pyproj.get('project') %}

package:
name: payu
version: {{ GIT_DESCRIBE_TAG }}
version: "{{ version }}"

build:
noarch: python
number: {{ GIT_DESCRIBE_NUMBER }}
script: "{{ PYTHON }} -m pip install . --no-deps"
number: 0
script: "{{ PYTHON }} -m pip install . -vv"
entry_points:
- payu = payu.cli:parse
- payu-run = payu.subcommands.run_cmd:runscript
- payu-collate = payu.subcommands.collate_cmd:runscript
- payu-profile = payu.subcommands.profile_cmd:runscript
- payu-sync = payu.subcommands.sync_cmd:runscript
- payu-branch = payu.subcommands.branch_cmd:runscript
- payu-clone = payu.subcommands.clone_cmd:runscript
- payu-checkout = payu.subcommands.checkout_cmd:runscript
{% for name, script in project.get('scripts', {}).items() %}
- {{ name }} = {{ script }}
{% endfor %}

source:
git_url: ../
path: ../

requirements:
build:
- python <=3.11
- pbr
- setuptools
host:
- python
- pip
- setuptools >=61.0.0
- versioneer
run:
- python <=3.11
- f90nml >=0.16
- yamanifest >=0.3.4
- PyYAML
- python-dateutil
- tenacity
- requests
- cftime
# The following two requirements are from the security
# extra for the pypi package
- pyOpenSSL >=0.14
- cryptography>=1.3.4
- GitPython >=3.1.40
- ruamel.yaml >=0.18.5
- python >=3.9
{% for dep in project.get('dependencies', []) %}
- {{ dep }}
{% endfor %}

test:
imports:
- payu
commands:
- payu list


about:
home: https://github.com/payu-org/payu/
license: Apache Software
license_family: APACHE
summary: "A climate model workflow manager for supercomputing environments"
doc_url: https://payu.readthedocs.io/en/latest/
3 changes: 2 additions & 1 deletion payu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
:copyright: Copyright 2011 Marshall Ward, see AUTHORS for details.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
__version__ = '1.0.19'
from . import _version
__version__ = _version.get_versions()['version']
Loading
Loading