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

Major Refactor - Faster, Robust Data Schemas #195

Merged
merged 20 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a7ad949
feat(nwp-consumer): Implemented better layout
devsjc Aug 23, 2024
4c5572d
feat(nwp-consumer): Added parameters domain object
devsjc Aug 23, 2024
d2090bb
feat(core): Use joblib for multiprocessing
devsjc Aug 27, 2024
0242a7d
feat(parameters): Add missing parameters
devsjc Aug 27, 2024
fc17d67
feat(core): Enable use of variable dimension
devsjc Aug 27, 2024
131e82f
feat(core): Successfully reduce peak memory below store size
devsjc Aug 28, 2024
e373b24
feat(core): Reduce number of subfolders
devsjc Aug 28, 2024
b1bd691
feat(internal): Transfer internal repr to dataarray
devsjc Aug 28, 2024
0546fd3
feat(internal): Create coordinates object
devsjc Aug 29, 2024
63ce2ec
feat(internal): Add cli handler, update repometadata business logic
devsjc Aug 30, 2024
c560fa0
feat(metoffice): Finish pipeline
devsjc Sep 5, 2024
c8b51b0
feat(main): Rework command and main usage
devsjc Sep 6, 2024
854daa4
feat(notification): Add support for Dagster Pipes
devsjc Sep 10, 2024
f16637f
chore(entities): Move performance montitor to entities
devsjc Sep 12, 2024
dbbcf57
feat(models): Add GFS Model repository
devsjc Oct 31, 2024
f7922a7
feat(repo): Use pdoc for document generation
devsjc Nov 12, 2024
e3c016f
feat(repositories): Add MetOffice DataHub repository
devsjc Nov 14, 2024
b478038
fix(tensorstore): Enable using existing stores
devsjc Nov 19, 2024
cf42210
feat(services): Use contextmanager for performancemonitor
devsjc Nov 22, 2024
bac199d
fix(repo): Remove non-refactor modules
devsjc Nov 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
184 changes: 184 additions & 0 deletions .github/workflows/branch_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# Workflow that runs on pushes to non-default branches

peterdudfield marked this conversation as resolved.
Show resolved Hide resolved
name: Non-Default Branch Push CI (Python)

on:
push:
branches-ignore: ['main']
paths-ignore: ['README.md']

# Specify concurrency such that only one workflow can run at a time
# * Different workflow files are not affected
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Registry for storing Container images
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# Ensure the GitHub token can remove packages
permissions:
packages: write


jobs:

# Job to run a linter and typechecker against the codebase
lint-typecheck:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install editable package and required dependencies
run: uv sync

- name: Lint package
run: uv run ruff check --output-format=github .

- name: Typecheck package
run: uv run mypy .
# TODO: GitHub output when https://github.com/python/mypy/pull/17771 merged

# Job to run unittests
# * Produces a JUnit XML report that can be displayed in the GitHub UI
test-unit:
runs-on: ubuntu-latest
needs: lint-typecheck

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install editable package and required dependencies
run: uv sync

# Run unittests
# * Produce JUnit XML report
- name: Run unit tests
run: uv run python -m xmlrunner discover -s src/nwp_consumer -p "test_*.py" --output-file ut-report.xml

# Create test summary to be visualised on the job summary screen on GitHub
# * Runs even if previous steps fail
- name: Create test summary
uses: test-summary/action@v2
with:
paths: "*t-report.xml"
show: "fail, skip"
if: always()

# Define a job that builds the documentation
# * Surfaces the documentation as an artifact
build-docs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install editable package and required dependencies
run: uv sync

# Pydoctor is ran to find any linking errors in the docs
- name: Build documentation
run: |
uv run pydoctor --html-output=tmpdocs -W -q
PDOC_ALLOW_EXEC=1 uv run pdoc -o docs \
--docformat=google \
--logo="https://cdn.prod.website-files.com/62d92550f6774db58d441cca/6324a2038936ecda71599a8b_OCF_Logo_black_trans.png" \
src/nwp_consumer

- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: docs
path: docs

# Job for building container image
# * Builds and pushes an OCI Container image to the registry defined in the environment variables
# * Only runs if test and lint jobs pass
build-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: ["lint-typecheck", "test-unit"]

steps:
# Do a non-shallow clone of the repo to ensure tags are present
# * This allows setuptools-git-versioning to automatically set the version
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Tag the built image according to the event type
# The event is a branch commit, so use the commit sha
- name: Extract metadata (tags, labels) for Container
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=ref,event=branch

# Build and push the Container image to the registry
# * Creates a multiplatform-aware image
# * Pulls build cache from the registry
- name: Build and push container image
uses: docker/build-push-action@v6
with:
context: .
file: Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache

Loading
Loading