-
Notifications
You must be signed in to change notification settings - Fork 28
129 lines (105 loc) · 3.24 KB
/
CI.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
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
# Run CI tests
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
pypa-build:
name: PyPA build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: |
python3 -m pip install --upgrade build && python3 -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist
testpypi-publish:
needs: ['pypa-build']
name: Publish to TestPyPI.org
if: github.repository == 'payu-org/payu'
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
path: artifact/
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
with:
packages_dir: artifact/
repository_url: https://test.pypi.org/legacy/
verbose: true
conda-build:
needs: ["testpypi-publish"]
if: always() && needs.testpypi-publish.result == 'success'
name: Conda Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: 3.11
environment-file: conda/environment.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Run conda build
shell: bash -el {0}
env:
PYPI_URL: https://test.pypi.org
run: conda build . --no-anaconda-upload
tests:
name: Tests
runs-on: ubuntu-latest
# Run the job for different versions of python
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out repository code
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r test/requirements_test.txt
- name: Install payu
run: pip install .
- name: Check payu installed correctly
run: payu list
- name: Lint
run: pylint --extension-pkg-whitelist=netCDF4 --ignored-modules=backports -E payu
- name: Run tests
run: |
PYTHONPATH=. pytest --cov=payu -s test;
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
- name: Make docs
run: cd docs && make html
coveralls_finish:
name: Coveralls Finished
needs: tests
runs-on: ubuntu-latest
steps:
- uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true