forked from ecmwf/pyfdb
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (142 loc) · 4.25 KB
/
check-publish.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Check and publish
on:
push:
branches:
- '**'
tags:
- '**'
pull_request: ~
workflow_dispatch: ~
jobs:
quality:
name: Code QA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: pip install black flake8 isort
- run: black --version
- run: isort --check .
- run: black --check .
- run: flake8 .
checks:
strategy:
matrix:
name:
include:
- name: [email protected]
os: ubuntu-20.04
compiler: gnu-10
compiler_cc: gcc-10
compiler_cxx: g++-10
compiler_fc: gfortran-10
- name: [email protected]
os: ubuntu-20.04
compiler: clang-12
compiler_cc: clang-12
compiler_cxx: clang++-12
compiler_fc: gfortran-10
- name: [email protected]
os: ubuntu-18.04
compiler: gnu-10
compiler_cc: gcc-10
compiler_cxx: g++-10
compiler_fc: gfortran-10
- name: [email protected]
os: ubuntu-18.04
compiler: clang-9
compiler_cc: clang-9
compiler_cxx: clang++-9
compiler_fc: gfortran-9
- name: [email protected]
os: macos-10.15
compiler: gnu-10
compiler_cc: gcc-10
compiler_cxx: g++-10
compiler_fc: gfortran-10
# Xcode compiler requires empty environment variables, so we pass null (~) here
- name: [email protected]
os: macos-10.15
compiler: clang-12
compiler_cc: ~
compiler_cxx: ~
compiler_fc: gfortran-10
runs-on: ${{ matrix.os }}
name: Pytests on ${{ matrix.name }}
needs: quality
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
id: install-dependencies
uses: ecmwf-actions/build-package@v2
with:
self_build: false
dependencies: |
ecmwf/ecbuild@refs/tags/2021.08.0
ecmwf/eccodes@refs/tags/2.24.2
ecmwf/eckit@refs/tags/1.18.7
ecmwf/metkit@refs/tags/1.8.10
ecmwf/fdb@refs/tags/5.10.2
dependency_branch: develop
- name: General set up
run: |
mkdir -p $HOME/data/fdb
chmod -R o+rw $HOME/data
chmod -R o+rw .
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install pyfdb
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install pyeccodes
pip install -e .
- name: Unit tests
env:
LD_LIBRARY_PATH: ${{ steps.install-dependencies.outputs.lib_path }}
shell: bash -eux {0}
run: |
cwd=$(pwd)
export FDB5_CONFIG='{"type":"local","engine":"toc","schema":"'"$cwd"'/tests/default_fdb_schema","spaces":[{"handler":"Default","roots":[{"path":"'"$HOME"'/data/fdb"}]}]}'
cd tests
DYLD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }} python3 test.py
- name: Documentation
run: |
pip install sphinx ipykernel nbsphinx sphinx_rtd_theme
make clean
make html
working-directory: docs
deploy:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Upload to Pypi
needs: checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Check version
run: |
release=${GITHUB_REF##*/}
version=$(python setup.py --version)
test "$release" == "$version"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*