Skip to content

Commit

Permalink
(Fix) Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lbesnard committed May 2, 2024
1 parent 091984a commit 4409030
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 46 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/test-mamba.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: aodn_cloud_optimised mamba

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: AodnCloudOptimised
environment-file: environment.yml

- name: Install dependencies
shell: bash -el {0}
run: |
conda install --yes mamba
mamba env update --name AodnCloudOptimised --file environment.yml
- name: Activate Conda environment
shell: bash -el {0}
run: |
conda init
conda activate AodnCloudOptimised
- name: Run pytest and coverage
run: |
pytest
coverage run -m pytest
coverage report --fail-under=60
coverage xml -o coverage.xml
- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage.xml
51 changes: 51 additions & 0 deletions .github/workflows/test-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: aodn_cloud_optimised package build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -e {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install package dependencies
run: |
pip install .
- name: Install additional dependencies
run: |
pip install pytest coverage
- name: Run setup.py install
run: |
python setup.py install
- name: Run tests with coverage
run: |
pytest
coverage run -m pytest
coverage report --fail-under=60
coverage xml -o coverage.xml
- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage.xml

40 changes: 0 additions & 40 deletions .github/workflows/test.yml

This file was deleted.

8 changes: 4 additions & 4 deletions aodn_cloud_optimised/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import importlib.resources
from collections import OrderedDict
from importlib.resources import path


def load_variable_from_file(file_path, variable_name) -> str:
Expand All @@ -24,10 +25,9 @@ def load_variable_from_file(file_path, variable_name) -> str:


def load_variable_from_config(variable_name) -> str:
# Construct the path to common.py relative to the current directory
common_config_path = str(importlib.resources.path("aodn_cloud_optimised.config", "common.json"))

return load_variable_from_file(common_config_path, variable_name)
# Obtain the file path using the context manager
with path("aodn_cloud_optimised.config", "common.json") as common_config_path:
return load_variable_from_file(str(common_config_path), variable_name)


def load_dataset_config(config_path) -> dict:
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ dependencies:
- pyarrow==15.0.0
- rechunker
- s3fs
- yaml
- xarray[complete]
- zarr
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
'numpy',
'pandas',
'python-dateutil',
'jsonschema',
'h5py',
'scipy',
'boto3',
'pyarrow==15.0.0',
'rechunker',
's3fs',
'shapely',
'xarray[complete]',
'zarr'
]

PACKAGE_DATA = {
Expand Down Expand Up @@ -79,7 +82,7 @@
tests_require=TESTS_REQUIRE,
extras_require=EXTRAS_REQUIRE,
zip_safe=False,
python_requires='>=3.8',
python_requires='==3.10',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand Down

0 comments on commit 4409030

Please sign in to comment.