-
Notifications
You must be signed in to change notification settings - Fork 40
98 lines (93 loc) · 3.28 KB
/
python-request.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python on pull request
on:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 1 * *'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.11]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up mamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 'latest'
environment-file: environment.yml
init-shell: bash
environment-name: pyTMD
cache-environment: true
post-cleanup: 'all'
create-args: >-
blas
boto3
python=${{ matrix.python-version }}
flake8
pytest
pytest-cov
cython
geopandas
jplephem
pyarrow
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: "Check if repository secrets are accessible"
id: secrets
run: |
if [ "${{ secrets.EARTHDATA_USERNAME }}" == '' ] ; then
echo "accessible=false" >> $GITHUB_OUTPUT;
echo "::debug::GitHub secrets unavailable for Actions";
else
echo "accessible=true" >> $GITHUB_OUTPUT;
echo "::debug::GitHub secrets available for Actions";
fi
- name: Checkout Matlab TMD Toolbox
if: steps.secrets.outputs.accessible == 'true'
uses: actions/checkout@v4
with:
repository: EarthAndSpaceResearch/TMD_Matlab_Toolbox_v2.5
path: TMD_Matlab_Toolbox
ref: master
- name: Test with pytest
if: steps.secrets.outputs.accessible == 'true'
run: |
pip install --no-deps .
pytest --verbose --capture=no --cov=./ --cov-report=xml \
--username=${{ secrets.EARTHDATA_USERNAME }} \
--password=${{ secrets.EARTHDATA_PASSWORD }} \
--aws-access=${{ secrets.AWS_ACCESS_KEY_ID }} \
--aws-secret=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
--aws-region=${{ secrets.AWS_REGION_NAME }}
- name: Upload coverage to Codecov
if: steps.secrets.outputs.accessible == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
- name: Archive code coverage results
if: steps.secrets.outputs.accessible == 'true'
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: ./coverage.xml