Skip to content

Commit 3a0e6fe

Browse files
authored
Merge pull request #53 from ocefpaf/GHA
Move to GitHub Actions
2 parents 963fefd + 5a3be2f commit 3a0e6fe

File tree

6 files changed

+59
-66
lines changed

6 files changed

+59
-66
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
2+
3+
version: 2
4+
updates:
5+
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"
10+
labels:
11+
- "Bot"

.github/workflows/tests.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Default Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
run:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
13+
os: [windows-latest, ubuntu-latest, macos-latest]
14+
fail-fast: false
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Micromamba ${{ matrix.python-version }}
20+
uses: mamba-org/setup-micromamba@v1
21+
with:
22+
environment-name: TEST
23+
init-shell: bash
24+
create-args: >-
25+
python=${{ matrix.python-version }} pip
26+
--file requirements.txt
27+
--file requirements-dev.txt
28+
--channel conda-forge
29+
30+
- name: Install compliance-checker
31+
shell: bash -l {0}
32+
run: |
33+
python -m pip install -e . --no-deps --force-reinstall
34+
35+
- name: Default Tests
36+
shell: bash -l {0}
37+
run: pytest -s -rxs -v cc_plugin_ncei

.travis.yml

-54
This file was deleted.

cc_plugin_ncei/tests/resources.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
from pkg_resources import resource_filename
2-
import sh
1+
from pathlib import Path
2+
import subprocess
33
import os
44

55

66
def get_filename(path):
77
'''
88
Returns the path to a valid dataset
99
'''
10-
filename = resource_filename('cc_plugin_ncei', path)
10+
resource_filename = Path(__file__).parent.parent
11+
filename = resource_filename.joinpath(path)
1112
if not os.path.exists(filename):
12-
cdl_path = filename.replace('.nc', '.cdl')
13+
cdl_path = filename.with_suffix('.cdl')
1314
generate_dataset(cdl_path, filename)
1415
return filename
1516

1617

1718
def generate_dataset(cdl_path, nc_path):
18-
sh.ncgen('-o', nc_path, cdl_path)
19+
subprocess.run(["ncgen", '-o', nc_path, cdl_path])
1920

2021

2122
STATIC_FILES = {

cc_plugin_ncei/util.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
31
'''
42
cc_plugin_ncei/util.py
53
'''
6-
from pkg_resources import resource_filename
4+
from pathlib import Path
75
import json
86
from lxml import etree
97
from pkgutil import get_data
@@ -18,9 +16,10 @@ def get_unitless_standard_names():
1816
Returns a list of valid standard_names that are allowed to be unitless
1917
'''
2018
global _UNITLESS_DB
19+
resource_filename = Path(__file__).parent
2120
if _UNITLESS_DB is None:
22-
with open(resource_filename('cc_plugin_ncei', 'data/unitless.json'), 'r') as f:
23-
_UNITLESS_DB = json.load(f)
21+
f = resource_filename.joinpath('data/unitless.json').read_text()
22+
_UNITLESS_DB = json.loads(f)
2423
return _UNITLESS_DB
2524

2625

requirements-dev.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ flake8-comprehensions
44
flake8-mutable
55
flake8-print
66
pytest
7-
pytest-flake8
8-
sh
7+
pytest-flake8

0 commit comments

Comments
 (0)