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

lint alchemist configs #1177

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions .github/workflows/alchemist-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Alchemist CFG Lint Check

on:
push:
branches: [ master ]
paths:
- 'dev/services/alchemist/**'
- 'prod/services/alchemist/**'
- .github/workflows/alchemist-lint.yaml
pull_request:
branches: [ master ]
paths:
- 'dev/services/alchemist/**'
- 'prod/services/alchemist/**'
- .github/workflows/alchemist-lint.yaml

jobs:
build:

runs-on: ubuntu-latest
strategy:
# You can use PyPy versions in python-version.
# For example, pypy-2.7 and pypy-3.8
matrix:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
docker run -t -v ${PWD}:/code/dea-config opendatacube/datacube-alchemist:latest python /code/dea-config/alchemist_lint.py
19 changes: 19 additions & 0 deletions alchemist_lint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from datacube_alchemist.worker import Alchemist
import os
from fnmatch import fnmatch

alchemist_service_paths = [
'./dev/services/alchemist',
'./prod/services/alchemist'
]

alchemist_config_file_extensions = [
'*.yaml',
'*.yml'
]
for alchemist_path in alchemist_service_paths:
for path, subdirs, files in os.walk(alchemist_path):
for name in files:
if any(fnmatch(name, file_extension) for \
file_extension in alchemist_config_file_extensions):
alchemist = Alchemist(config_file=os.path.join(path, name))