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

Issue 62 #93

Merged
merged 36 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
28f58d8
Add initial version of publish workflow
eigenbeam Nov 19, 2024
64232b1
Fix publish GHA workflow
eigenbeam Nov 19, 2024
81e6888
Fix publish workflow ref to build job
eigenbeam Nov 19, 2024
5286de7
Add a step to upload the artifact
eigenbeam Nov 19, 2024
fbf95d8
Fix upload artifact step
eigenbeam Nov 19, 2024
0c6697c
Remove build artifact name
eigenbeam Nov 19, 2024
f5f422e
Rename workflow for the pypi project
eigenbeam Nov 20, 2024
07cbab6
Tweak download-artifact step config
eigenbeam Nov 20, 2024
b74e43f
Fix the project name in pyproject
eigenbeam Nov 20, 2024
dc48e0e
Merge branch 'main' into issue-62
eigenbeam Nov 22, 2024
f36dbc9
Load schema & templates using importlib.resources
eigenbeam Nov 22, 2024
c627262
Add a project CHANGELOG
eigenbeam Nov 26, 2024
ebecb77
Add bump-my-version
eigenbeam Nov 26, 2024
76c3f59
Add version attribute to the module
eigenbeam Nov 26, 2024
9c8b336
Configure bump-my-version
eigenbeam Nov 26, 2024
cef73c9
Configure bumpversion to commit & tag
eigenbeam Nov 26, 2024
4a618d4
Bump version: 0.1.0 → 0.2.0
eigenbeam Nov 26, 2024
1acfb3c
Fix bumpversion config for pyproject
eigenbeam Nov 26, 2024
03c2d5f
Bump version: 0.2.0 → 0.3.0
eigenbeam Nov 26, 2024
873c395
Update README with new install & releasing instructions
eigenbeam Nov 26, 2024
ec08642
Try GHA workflow badges
eigenbeam Nov 26, 2024
0b18280
Fix GHA workflow badges
eigenbeam Nov 26, 2024
4d755a5
Experiment with GHA badges
eigenbeam Nov 26, 2024
4a38e4c
Experiment with GHA badges
eigenbeam Nov 26, 2024
1d0f0c3
Cleanup the GHA workflows
eigenbeam Nov 26, 2024
ae12f67
Remove the pull-request trigger for the build-test GHA workflow
eigenbeam Nov 26, 2024
e53ad4f
Bump version: 0.3.0 → 0.4.0
eigenbeam Nov 26, 2024
3e67709
Update the README with complete release instructions
eigenbeam Nov 26, 2024
b877b60
Fix pyproject description
eigenbeam Nov 26, 2024
91e72ad
Fix GHA badges in the README
eigenbeam Nov 26, 2024
bb97084
Fix up the release instructions in the README
eigenbeam Nov 26, 2024
14f5d22
Update README; bump version changes CHANGELOG
eigenbeam Dec 2, 2024
4da6cfd
Modify changelog to have UNRELEASED version
eigenbeam Dec 2, 2024
c28b9d2
Update instructions for pushing release
eigenbeam Dec 2, 2024
b95977d
Merge branch 'main' into issue-62
eigenbeam Dec 2, 2024
021f468
Fix README install instructions
eigenbeam Dec 3, 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
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Build & test
on:
push:
branches: [main]
pull_request:

jobs:
test:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish release to PyPI

on:
release:
types: [released]

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

- uses: actions/setup-python@v5
with:
python-version: 3.12

- name: cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-1.8.3-0

- uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true

- name: cache deps
id: cache-deps
uses: actions/cache@v4
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

- run: poetry install --no-interaction

- run: poetry build

- uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build]
permissions:
id-token: write
attestations: write
contents: read
environment:
name: PyPI
url: https://pypi.org/p/nsidc-metgenc
steps:
- uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v1.4.3
with:
subject-path: "dist/*"

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MetGenC Changelog

## UNRELEASED

This is the Minimum Viable Product (MVP) release of MetGenC. The
features include:

* Provides a prompt-driven means of configuring MetGenC to ingest
a new collection.
* Processing is driven by a configuration file for control of various
aspects of the ingest.
* Generates a UUID and submission time for each granule.
* Creates UMM-G compliant metadata for each source granule.
* The UMM-G includes required attributes, including temporal and
spatial bounds.
* Generates a Cumulus Notification Message (CNM) for each granule.
* Stages the science data files and their UMM-G metadata in
a configurable S3 bucket location.
* Submits the CNM message to a configurable Kinesis stream in
order to trigger a Cumulus workflow.
78 changes: 50 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

# MetGenC

![build & test workflow](https://github.com/nsidc/granule-metgen/actions/workflows/build-test.yml/badge.svg)
![workflow workflow](https://github.com/nsidc/granule-metgen/actions/workflows/publish.yml/badge.svg)

The `MetGenC` toolkit enables Operations staff and data
producers to create metadata files conforming to NASA's Common Metadata Repository UMM-G
specification and ingest data directly to NASA EOSDIS’s Cumulus archive. Cumulus is an
Expand Down Expand Up @@ -31,14 +34,8 @@ or

$ python3 --version

Next, you must also install [Poetry](https://python-poetry.org/) either by using the [official
installer](https://python-poetry.org/docs/#installing-with-the-official-installer)
if you’re comfortable following the instructions, or by using a package
manager (like Homebrew) if this is more familiar to you. When successfully
installed, you should be able to run:

$ poetry --version
Poetry (version 1.8.3)
Next, install the AWS commandline interface (CLI) by [following the appropriate
instructions for your platform](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).

Lastly, you will need to create & setup AWS credentials for yourself. The ways in which
this can be accomplished are detailed in the **AWS Credentials** section below.
Expand All @@ -60,27 +57,11 @@ this can be accomplished are detailed in the **AWS Credentials** section below.

## Installation of MetGenC from GitHub
eigenbeam marked this conversation as resolved.
Show resolved Hide resolved

Make a local directory (i.e., on your computer), and then `cd` into that
directory. Clone the `granule-metgen` repository using ssh if you have [added
ssh keys to your GitHub
account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)
or via https if you haven't:

$ mkdir -p ~/my-projects; cd ~/my-projects
# Install using ssh:
$ git clone git@github.com:nsidc/granule-metgen.git
OR
# Install using https:
$ git clone https://github.com/nsidc/granule-metgen.git

Enter the `granule-metgen` directory and run Poetry to have it install the `granule-metgen` dependencies. Then start a new shell in which you can run the tool:
MetGenC can be installed from [PyPI](https://pypi.org/):

$ cd granule-metgen
$ poetry install
$ poetry shell
$ pip install nsidc-metgenc

With the Poetry shell running, start the metgenc tool JUST to verify that it’s working by requesting its usage options and having them
returned. There’s more to do (detailed in the **Usage** section below) before MetGenC can be run to successfully create ummg files, cnm messages, and stage data to an S3 bucket for ingest!)::
That's it! Now we're ready to run MetGenC and see what it can do:

$ metgenc --help
Usage: metgenc [OPTIONS] COMMAND [ARGS]...
Expand Down Expand Up @@ -221,6 +202,15 @@ TBD
* [Python](https://www.python.org/) v3.12+
* [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer)

You can install [Poetry](https://python-poetry.org/) either by using the [official
installer](https://python-poetry.org/docs/#installing-with-the-official-installer)
if you’re comfortable following the instructions, or by using a package
manager (like Homebrew) if this is more familiar to you. When successfully
installed, you should be able to run:

$ poetry --version
Poetry (version 1.8.3)

### Installing Dependencies

* Use Poetry to create and activate a virtual environment
Expand All @@ -231,14 +221,46 @@ TBD

$ poetry install

### Run tests:
### Run tests

$ poetry run pytest

### Run tests when source changes (uses [pytest-watcher](https://github.com/olzhasar/pytest-watcher)):

$ poetry run ptw . --now --clear

### Releasing

* Update the CHANGELOG to include details of the changes included in the new
release. The version should be the string literal 'UNRELEASED' (without
single-quotes). It will be replaced with the actual version number after
we bump the version below.

* Show the current version and the possible next versions:

$ bump-my-version show-bump
0.3.0 ── bump ─┬─ major ─ 1.0.0
├─ minor ─ 0.4.0
╰─ patch ─ 0.3.1

* Bump the version to the desired number, for example:

$ bump-my-version bump minor
eigenbeam marked this conversation as resolved.
Show resolved Hide resolved

You will see the latest commit & tag by looking at `git log`. You can then
push these to GitHub (`git push --follow-tags`) to trigger the CI/CD
workflow.

* On the [GitHub repository](https://github.com/nsidc/granule-metgen), click
'Releases' and follow the steps documented on the
[GitHub Releases page](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release).
Draft a new Release using the version tag created above. After you have
published the release, the MetGenC Publish GHA workflow will be started.
Check that the workflow succeeds on the
[MetGenC Actions page](https://github.com/nsidc/granule-metgen/actions),
and verify that the
[new MetGenC release is available on PyPI](https://pypi.org/project/nsidc-metgenc/).

## Credit

This content was developed by the National Snow and Ice Data Center with funding from
Expand Down
Loading
Loading