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

DAS-2180 extract lib #28

Merged
merged 40 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c974fba
DAS-2180: allows run_tests.sh to run from command line.
flamingbear Jun 25, 2024
0d4305f
DAS-2180: Extracts harmony_service_entry.
flamingbear Jun 25, 2024
0e62f89
DAS-2180: Adds pyproject.toml skeleton
flamingbear Jun 26, 2024
fb3a1a7
DAS-2180: Move service utilities to service entry.
flamingbear Jun 26, 2024
bf4a010
DAS-2180: Renames directory before fixing imports
flamingbear Jun 26, 2024
f885f45
DAS-2180: renames harmony_browse_image_generator -> hybig
flamingbear Jun 26, 2024
55eb7f0
DAS-2180: Adds empty init for mypy
flamingbear Jun 26, 2024
daec460
DAS-2180: Separate exceptions into hybig and hybig-service
flamingbear Jun 26, 2024
7125cfd
DAS-2180: Bump version on github actions
flamingbear Jun 26, 2024
1758dee
DAS-2180: includes harmony_service_entry in pylint.
flamingbear Jun 26, 2024
ccec6a0
DAS-2180: Ruff Auto-fixes.
flamingbear Jun 26, 2024
87b5d52
DAS-2180: Ensure all py files adhere to PEP8
flamingbear Jun 26, 2024
a9169e0
DAS-2180: This is definitely a v2 of this library.
flamingbear Jun 26, 2024
40385f6
DAS-2180: update README.md for service and lib.
flamingbear Jun 26, 2024
1c182f7
DAS-2180: Stab at updating workflow to publish to testpypi.
flamingbear Jun 27, 2024
6cf3d6b
DAS-2180: renames harmony_service_entry -> harmony_service
flamingbear Jul 3, 2024
2ecae0e
DAS-2180: Adds create_browse library function
flamingbear Jul 3, 2024
ab3f730
DAS-2180: tweaks the README.md for clarity.
flamingbear Jul 8, 2024
23d8aac
DAS-2180: Adds first lib test
flamingbear Jul 8, 2024
2852316
DAS-2180: Add test to get remote color palette.
flamingbear Jul 15, 2024
f0548ba
DAS-2180: Point to real PyPI, choose major version.
flamingbear Jul 19, 2024
489d852
DAS-2180: updates CHANGELOG.md
flamingbear Jul 19, 2024
f27bcea
DAS-2180: Adds matrix of library tests to CI
flamingbear Jul 19, 2024
d1e3750
DAS-2180: Don't use an empty dict as default value.
flamingbear Jul 19, 2024
88bea96
DAS-2180: Cleans up science and service tests.
flamingbear Jul 22, 2024
61689dd
Merge branch 'main' into mhs/DAS-2180/extract-lib
flamingbear Jul 22, 2024
d721a57
DAS-2180: Clarify why the test gdal is different from the docker one
flamingbear Jul 30, 2024
aff9d35
DAS-2180: Break up run on sentence.
flamingbear Jul 30, 2024
e383bf4
DAS-2180: Thanks Claude
flamingbear Jul 30, 2024
21a8643
DAS-2180: Clarify releases.
flamingbear Jul 30, 2024
2e126b3
DAS-2180: extention -> extension
flamingbear Jul 30, 2024
7b2c903
DAS-2180: use correct library name
flamingbear Jul 30, 2024
bdde01e
DAS-2180: Explain self-consistent grids.
flamingbear Jul 30, 2024
257a462
DAS-2180: Extracts get_harmony_message_from_params
flamingbear Jul 30, 2024
fe1f557
DAS-2180: Sorts imports, cleans pyproject.toml
flamingbear Jul 30, 2024
12c3df3
DAS-2180: updates comments on the run_tests.sh script
flamingbear Jul 30, 2024
8a70fe3
DAS-2180: really only export create_browse
flamingbear Jul 30, 2024
8c18fb8
DAS-2180: update notes on service.Dockerfile
flamingbear Jul 30, 2024
c455ebf
DAS-2180: Add notice of gdal requirements.
flamingbear Jul 31, 2024
e8c8c4c
DAS-2180: kick off tests again.
flamingbear Jul 31, 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,12 +1,13 @@
# This workflow will run when changes are detected in the `main` branch, which
# must include an update to the `docker/service_version.txt` file. The workflow
# can also be manually triggered by a repository maintainer. This workflow will
# first trigger the reusable workflow in `.github/workflows/run_tests.yml`,
# first trigger the reusable workflow in `.github/workflows/run_service_tests.yml`,
# which runs the `unittest` suite. If that workflow is successful, the latest
# version of the service Docker image is pushed to ghcr.io, a tag is added to
# the latest git commit, and a GitHub release is created with the release notes
# from the latest version of HyBIG.
name: Publish Harmony Browse Image Generator (HyBIG) Docker image
# version of the service Docker image is pushed to ghcr.io, a library package
# is built and published to PyPI, a tag is added to the latest git commit, and
# a GitHub release is created with the release notes from the latest version of
# HyBIG.
name: Publish Harmony Browse Image Generator (HyBIG)

on:
push:
Expand All @@ -19,11 +20,14 @@ env:
REGISTRY: ghcr.io

jobs:
run_tests:
uses: ./.github/workflows/run_tests.yml
run_service_tests:
uses: ./.github/workflows/run_service_tests.yml

build_and_publish_image:
needs: run_tests
run_lib_tests:
uses: ./.github/workflows/run_lib_tests.yml

build_and_publish:
needs: [run_service_tests, run_lib_tests]
runs-on: ubuntu-latest
environment: release
permissions:
Expand All @@ -36,7 +40,7 @@ jobs:

steps:
- name: Checkout harmony-browse-image-generator repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
lfs: true

Expand Down Expand Up @@ -74,6 +78,17 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Build hybig-py package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Publish GitHub release
uses: ncipollo/release-action@v1
with:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/run_lib_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will run the appropriate library tests across a python matrix of versions.
name: Run Python library tests

on:
workflow_call

jobs:
build_and_test_lib:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']

steps:
- name: Checkout harmony-browse-image-generator repository
uses: actions/checkout@v4
with:
lfs: true

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

- name: Install GDAL
run: |
# Install packaged version of GDAL.
sudo apt-get update
sudo apt-get install -y libgdal-dev

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -r pip_requirements.txt
# Use the gdal version that was installed
pip install GDAL==$(gdal-config --version)
owenlittlejohns marked this conversation as resolved.
Show resolved Hide resolved
pip install -r tests/pip_test_requirements.txt

- name: Run science tests while excluding the service tests.
run: |
pytest tests --ignore tests/test_service
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# test results and code coverage as artefacts. It will be called by the
# workflow that run tests against new PRs and as a first step in the workflow
# that publishes new Docker images.
name: Run Python unit tests
name: Run Python tests

on:
workflow_call

jobs:
build_and_test:
build_and_test_service:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: Checkout harmony-browse-image-generator repository
uses: actions/checkout@v3
uses: actions/checkout@v4
flamingbear marked this conversation as resolved.
Show resolved Hide resolved
with:
lfs: true

Expand All @@ -30,13 +30,13 @@ jobs:
run: ./bin/run-test

- name: Archive test results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Test results
path: test-reports/

- name: Archive coverage report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Coverage report
path: coverage/*
9 changes: 6 additions & 3 deletions .github/workflows/run_tests_on_pull_requests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will run when a PR is opened against the `main` branch. It will
# trigger the reusable workflow in `.github/workflows/run_tests.yml`, which
# trigger the reusable workflow in `.github/workflows/run_service_tests.yml`, which
# builds the service and test Docker images, and runs the `unittest` suite in a
# Docker container built from the test image.
name: Run Python unit tests for pull requests against main
Expand All @@ -9,5 +9,8 @@ on:
branches: [ main ]

jobs:
build_and_test:
uses: ./.github/workflows/run_tests.yml
build_and_test_service:
uses: ./.github/workflows/run_service_tests.yml

run_lib_tests:
uses: ./.github/workflows/run_lib_tests.yml
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ HyBIG follows semantic versioning. All notable changes to this project will be
documented in this file. The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).

## [v2.0.0] - 2024-07-19

**DAS-2180** - Adds pip installable library.

This release is a refactor that extracts browse image generation logic from the
harmony service code. There are no user visible changes to the existing
functionality. The new library,
[hybig-py](https://pypi.org/project/hybig-py/), provides the `create_browse`
function to generate browse images, see the README.md for details.

## [v1.2.2] - 2024-06-18

### Changed
Expand Down Expand Up @@ -52,7 +62,8 @@ outlined by the NASA open-source guidelines.
For more information on internal releases prior to NASA open-source approval,
see legacy-CHANGELOG.md.

[unreleased]:https://github.com/nasa/harmony-browse-image-generator/compare/1.2.2..HEAD
[unreleased]:https://github.com/nasa/harmony-browse-image-generator/compare/2.0.0..HEAD
[v2.0.0]:https://github.com/nasa/harmony-browse-image-generator/compare/1.2.2..2.0.0
[v1.2.2]: https://github.com/nasa/harmony-browse-image-generator/compare/1.2.1..1.2.2
[v1.2.1]: https://github.com/nasa/harmony-browse-image-generator/compare/1.2.0..1.2.1
[v1.2.0]: https://github.com/nasa/harmony-browse-image-generator/compare/1.1.0..1.2.0
Expand Down
Loading