-
Notifications
You must be signed in to change notification settings - Fork 32
134 lines (130 loc) · 5.09 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
130
131
132
133
134
name: ci-build
on:
pull_request:
branches:
- master
jobs:
# lint is handled by pre-commit ci conf
generate-api:
runs-on: ubuntu-latest
env:
FLIT_ROOT_INSTALL: 1
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install build tools
run: pip install --upgrade pip flit
- name: Install icclim and dev requirements (dev, test and doc)
run: flit install --deps develop
- name: call fun extractor
run: python ./tools/extract_icclim_funs.py
- name: run ruff format on generated module
run: |
ruff format src/icclim/_generated/
ruff check src/icclim/_generated/ --fix
- name: create local ref
run: |
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
- name: setup git config
run: |
# setup the username and email.
git config user.name "GitHub Actions Bot - API updater"
git config user.email "<>"
- name: commit
run: |
# Stage the file, commit and push
git add src/icclim/_generated
# Ignore error cases
git commit -m "MAINT: Update generated API" || true
git push origin ${{ github.head_ref }}
test:
runs-on: ubuntu-latest
env:
FLIT_ROOT_INSTALL: 1
steps:
# actions/checkout@v2 checkouts to a new merge commit
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install build tools
run: pip install --upgrade pip flit
- name: Install icclim and dev requirements (dev, test and doc)
run: flit install --deps develop
- name: Build coverage file
run: pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=icclim tests/ | tee pytest-coverage.txt; ( exit ${PIPESTATUS[0]} )
- name: Pytest coverage comment
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
title: Report
badge-title: Coverage
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
junitxml-path: ./pytest.xml
junitxml-title: Test results
- name: create local ref
run: |
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
- name: Update Readme with Coverage Html
run: |
sed -i '/ Pytest Coverage Comment:Begin/,/ Pytest Coverage Comment:End/c\ Pytest Coverage Comment:Begin\n\n.. |coverage| image:: https://img.shields.io/badge/Coverage-${{ steps.coverageComment.outputs.coverage }}25-${{ steps.coverageComment.outputs.color }}.svg\n :target: https://github.com/cerfacs-globc/icclim/blob/master/README.rst#code-coverage\n :alt: Code coverage\n\n..\n Pytest Coverage Comment:End' ./README.rst
- name: setup git config
run: |
# setup the username and email.
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: commit
run: |
# Stage the file, commit and push
git add README.rst
# Ignore error cases with `|| true`
git commit -m "[skip ci] DOC: Update coverage" || true
git push origin ${{ github.head_ref }}
logo-update:
runs-on: ubuntu-latest
env:
FLIT_ROOT_INSTALL: 1
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install build tools
run: pip install --upgrade pip flit
- name: Install icclim and dev requirements (dev, test and doc)
run: flit install --deps develop
- name: Generate logos
run: |
python ./tools/update_logo_version.py ./doc/source/_static/logo_icclim_colored__base.svg ./doc/source/_static/logo_icclim_colored__displayed.svg
python ./tools/update_logo_version.py ./doc/source/_static/logo_icclim_grey__base.svg ./doc/source/_static/logo_icclim_grey__displayed.svg
python ./tools/update_logo_version.py ./doc/source/_static/logo_icclim_white__base.svg ./doc/source/_static/logo_icclim_white__displayed.svg
- name: create local ref
run: |
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
- name: setup git config
run: |
# setup the username and email.
git config user.name "GitHub Actions Bot - logo updater"
git config user.email "<>"
- name: commit
run: |
# Stage the file, commit and push
git add doc/source/_static/*__displayed.svg
# Ignore error cases with `|| true`
git commit -m "MAINT: Update logos" || true
git push origin ${{ github.head_ref }}