-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (80 loc) · 2.78 KB
/
test-package.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Test package for linter issues and run tests
on:
pull_request:
branches:
- main
- development
paths:
- .github/workflows/test-package.yaml
- setup.py
- MANIFEST.in
- ocean_data_parser/**
- tests/**
push:
branches:
- main
- development
paths:
- setup.py
- MANIFEST.in
- ocean_data_parser/**
- tests/**
jobs:
testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: uv sync --extra geo --dev
- name: ruff check
id: ruff_check
run: uv run ruff check --output-format=github .
continue-on-error: true
- name: ruff import sorting check
id: ruff_imports
run: uv run ruff check --select I --output-format=github .
continue-on-error: true
- name: ruff format
id: ruff_format
run: uv run ruff format --check .
continue-on-error: true
- name: Check for ruff issues
if: steps.ruff_check.outcome == 'failure' || steps.ruff_imports.outcome == 'failure' || steps.ruff_format.outcome == 'failure'
run: |
echo "Some ruff steps failed. Please check the logs for more information.\n"
echo "Some of the issues can be fixed by running the following commands:\n"
echo " uv run ruff check --fix . # for fixing all default issues"
echo " uv run ruff check --fix --select I . # for fixing import sorting issues"
echo " uv run ruff format . # for formatting the code"
exit 1
- name: Review if metadata is updated
uses: dorny/paths-filter@v3
continue-on-error: true
id: changes
with:
base: ${{ github.base_ref }}
ref: ${{ github.ref }}
filters: |
vocabularies:
- 'ocean_data_parser/vocabularies/**'
- 'ocean_data_parser/metatadata/**'
- 'tests/test_metadata.py'
changelog:
- 'CHANGELOG.md'
- name: Run tests with metadata tests
if: steps.changes.outputs.vocabularies == 'true'
run: uv run pytest -W error::UserWarning --nerc-vocab -n auto
- name: Run tests without metadata tests
if: steps.changes.outputs.vocabularies == 'false'
run: uv run pytest -W error::UserWarning -k "not test_metadata" -n auto
- name: Run benchmark
run: uv run pytest tests/run_benchmark.py --benchmark-json output.json
- name: CHANGELOG updated check
if: steps.changes.outputs.changelog == 'false'
run: |
echo "CHANGELOG.md update is required."
exit 1