@@ -14,67 +14,211 @@ env:
1414 python_cache_ubuntu_path : |
1515 ~/.cache/pip
1616jobs :
17+ # Check that a news file has been added to this branch when a PR is created
18+ assert-news :
19+ name : Assert news files (See CONTRIBUTING.md)
20+ runs-on : ubuntu-latest
21+ steps :
22+ # Checkout with full history for to allow compare with base branch
23+ - uses : actions/checkout@v2
24+ with :
25+ fetch-depth : 0
26+ - uses : actions/setup-python@v2
27+ - uses : FranzDiebold/github-env-vars-action@v2
28+ - name : Load Python Dependencies from cache
29+ uses : actions/cache@v2
30+ with :
31+ path : ${{ env.python_cache_ubuntu_path }}
32+ key : linux-pip-3-continuous-delivery-scripts
33+ - name : Install CI/CD tools
34+ run : |
35+ python -m pip install --upgrade pip
36+ python -m pip install continuous-delivery-scripts
37+ python -m pip list
38+ - name : Assert news
39+ run : cd-assert-news -b ${CI_ACTION_REF_NAME}
40+ env :
41+ GIT_TOKEN : ${{ secrets.GIT_SECRET }}
42+ - name : Report failure if needed
43+ if : ${{ failure() }}
44+ run : |
45+ echo "::error:: News file missing (See CONTRIBUTING.md guide for details)."
46+
47+
48+ generate-docs :
49+ name : Build Documentation
50+ runs-on : ubuntu-latest
51+ steps :
52+ - uses : actions/checkout@v2
53+ - uses : actions/setup-python@v2
54+ - name : Determine dependencies
55+ # Note
56+ # The below code generates a pip requirements file from the pipenv development requirements (also obtaining the
57+ # normal dependencies from setup.py).
58+ # This code also forces the system to install latest tools as the ones present on the CI system may be too old
59+ # for the process to go through properly.
60+ run : |
61+ python -m pip install --upgrade pip wheel setuptools
62+ python -m pip install flake8 pipenv pytest
63+ python -m pipenv lock --dev -r --pre > dev-requirements.txt
64+ - uses : FranzDiebold/github-env-vars-action@v2
65+ - name : Load Python Dependencies from cache
66+ uses : actions/cache@v2
67+ with :
68+ path : ${{ env.python_cache_ubuntu_path }}
69+ key : linux-pip-3-continuous-delivery-scripts
70+ - name : Install dependencies
71+ # Note
72+ # As a virtual machine is already being used, pipenv
73+ # is superfluous and eliminating pipenv in CI reduces overhead and reduce complexity, while retaining a single
74+ # location for development dependencies.
75+ run : |
76+ python -m pip install -r dev-requirements.txt
77+ python -m pip list
78+ - name : Generate Documentation
79+ run : |
80+ cd-generate-docs --output_dir $(cd-get-config --key DOCUMENTATION_PRODUCTION_OUTPUT_PATH)
81+ - name : Add copyright/licence notice.
82+ run : |
83+ cd-license-files
84+
85+ tpip :
86+ name : Report licences in use (SPDX)
87+ runs-on : ubuntu-latest
88+ steps :
89+ - uses : actions/checkout@v2
90+ - uses : actions/setup-python@v2
91+ - name : Determine dependencies
92+ # Note
93+ # The below code generates a pip requirements file from the pipenv development requirements (also obtaining the
94+ # normal dependencies from setup.py).
95+ # This code also forces the system to install latest tools as the ones present on the CI system may be too old
96+ # for the process to go through properly.
97+ run : |
98+ python -m pip install --upgrade pip wheel setuptools
99+ python -m pip install flake8 pipenv pytest
100+ python -m pipenv lock --dev -r --pre > dev-requirements.txt
101+ - uses : FranzDiebold/github-env-vars-action@v2
102+ - name : Load Python Dependencies from cache
103+ uses : actions/cache@v2
104+ with :
105+ path : ${{ env.python_cache_ubuntu_path }}
106+ key : linux-pip-3-continuous-delivery-scripts
107+ - name : Install dependencies
108+ # Note
109+ # As a virtual machine is already being used, pipenv
110+ # is superfluous and eliminating pipenv in CI reduces overhead and reduce complexity, while retaining a single
111+ # location for development dependencies.
112+ run : |
113+ python -m pip install -r dev-requirements.txt
114+ python -m pip list
115+ - name : Generate SPDX documents
116+ run : |
117+ mkdir -p ./spdx-tmp
118+ cd-generate-spdx --output-dir ./spdx-tmp
119+ - name : Add copyright/licence notice.
120+ run : |
121+ cd-license-files
122+ - uses : actions/upload-artifact@v2
123+ with :
124+ name : spdx
125+ path : ./spdx-tmp
126+
127+ detect-secrets :
128+ name : Check for secrets
129+ runs-on : ubuntu-latest
130+ steps :
131+ - uses : actions/setup-python@v2
132+ - name : Install tools
133+ run : |
134+ python -m pip install --upgrade pip
135+ python -m pip install detect-secrets==1.0.3
136+ python -m pip list
137+ - uses : actions/checkout@v2
138+ with :
139+ fetch-depth : 0
140+ - name : Check for secrets using gitleaks
141+ uses : zricethezav/gitleaks-action@master
142+ with :
143+ config-path : .gitleaks.toml
144+ - name : Check for secrets using detect-secrets
145+ run : |
146+ git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline --exclude-files 'Pipfile\.lock$' --exclude-files '.*\.html$' --exclude-files '.*\.properties$' --exclude-files 'ci.yml' --exclude-files '\.git'
147+ working-directory : .
148+
17149 build-and-test :
18150 strategy :
19151 fail-fast : false
20152 matrix :
21153 os : [ubuntu-latest, macOS-latest, windows-latest]
22- python-version : ["3.8", "3.9", "3.10"]
23- go-module : [utils]
154+ python-version : ["3.7", "3.8", "3.9", "3.10"]
24155 multi-platform :
25156 - ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
157+ # include:
158+ # - os: windows-latest
159+ # cache_path: ${{ env.python_cache_windows_path }}
160+ # - os: macOS-latest
161+ # cache_path: ${{ env.python_cache_macOS_path }}
162+ # - os: ubuntu-latest
163+ # cache_path: ${{ env.python_cache_ubuntu_path }}
26164 exclude :
27165 - os : macOS-latest
28166 multi-platform : false
167+ - os : macOS-latest
168+ python-version : 3.10
169+ - os : macOS-latest
170+ python-version : 3.8
171+ - os : macOS-latest
172+ python-version : 3.7
29173 - os : windows-latest
30174 multi-platform : false
175+
31176 name : Build and test
32- runs-on : ${{ matrix.os }}
177+ runs-on : ${{ matrix.os }}
33178 steps :
34- - uses : actions/checkout@v2
35- - name : Set up Python ${{ matrix.python-version }}
36- uses : actions/setup-python@v2
37- with :
38- python-version : ${{ matrix.python-version }}
39- - name : Determine dependencies [OS:${{ matrix.os }}, Python:${{ matrix.python-version }}]
40- # Note
41- # The below code generates a pip requirements file from the pipenv development requirements (also obtaining the
42- # normal dependencies from setup.py).
43- # This code also forces the system to install latest tools as the ones present on the CI system may be too old
44- # for the process to go through properly.
45- run : |
46- python -m pip install --upgrade pip wheel setuptools
47- python -m pip install flake8 pipenv pytest
48- python -m pipenv lock --dev -r --pre > dev-requirements.txt
49-
50- - if : ${{ startsWith(matrix.os, 'macOS') }}
51- run : echo "CACHE_PATH=${{ env.python_cache_macOS_path }}" >> $GITHUB_ENV
52- - if : ${{ startsWith(matrix.os, 'windows') }}
53- run : echo "CACHE_PATH=${{ env.python_cache_windows_path }}" >> $GITHUB_ENV
54- - if : ${{ startsWith(matrix.os, 'ubuntu') }}
55- run : echo "CACHE_PATH=${{ env.python_cache_ubuntu_path }}" >> $GITHUB_ENV
56- - name : Load Python Dependencies from cache
57- uses : actions/cache@v2
58- with :
59- path : |
60- ${{ env.CACHE_PATH }}
61- ~/go/pkg/mod
62- key : ${{ matrix.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/dev-requirements.txt') }}
63- restore-keys : |
64- ${{ matrix.os }}-pip-${{ matrix.python-version }}
65- - name : Install dependencies
66- # Note
67- # As a virtual machine is already being used, pipenv
68- # is superfluous and eliminating pipenv in CI reduces overhead and reduce complexity, while retaining a single
69- # location for development dependencies.
70- run : |
71- python -m pip install -r dev-requirements.txt
72- python -m pip list
73- - name : Static Analysis - general (flake8)
74- run : |
75- flake8 --count --show-source --statistics
76- - name : Test with pytest
77- run : |
78- pytest
79- - name : Upload coverage reports to Codecov with GitHub Action
80- uses : codecov/codecov-action@v2
179+ - uses : actions/checkout@v2
180+ - name : Set up Python ${{ matrix.python-version }}
181+ uses : actions/setup-python@v2
182+ with :
183+ python-version : ${{ matrix.python-version }}
184+ - name : Determine dependencies [OS:${{ matrix.os }}, Python:${{ matrix.python-version }}]
185+ # Note
186+ # The below code generates a pip requirements file from the pipenv development requirements (also obtaining the
187+ # normal dependencies from setup.py).
188+ # This code also forces the system to install latest tools as the ones present on the CI system may be too old
189+ # for the process to go through properly.
190+ run : |
191+ python -m pip install --upgrade pip wheel setuptools
192+ python -m pip install flake8 pipenv pytest
193+ python -m pipenv lock --dev -r --pre > dev-requirements.txt
194+ - if : ${{ startsWith(matrix.os, 'macOS') }}
195+ run : echo "CACHE_PATH=${{ env.python_cache_macOS_path }}" >> $GITHUB_ENV
196+ - if : ${{ startsWith(matrix.os, 'windows') }}
197+ run : echo "CACHE_PATH=${{ env.python_cache_windows_path }}" >> $GITHUB_ENV
198+ - if : ${{ startsWith(matrix.os, 'ubuntu') }}
199+ run : echo "CACHE_PATH=${{ env.python_cache_ubuntu_path }}" >> $GITHUB_ENV
200+ - name : Load Python Dependencies from cache
201+ uses : actions/cache@v2
202+ with :
203+ path : ${{ env.CACHE_PATH }}
204+ key : ${{ matrix.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/dev-requirements.txt') }}
205+ restore-keys : |
206+ ${{ matrix.os }}-pip-${{ matrix.python-version }}
207+ # env:
208+ # CACHE_PATH: ${{ matrix.cache_path }}
209+ - name : Install dependencies
210+ # Note
211+ # As a virtual machine is already being used, pipenv
212+ # is superfluous and eliminating pipenv in CI reduces overhead and reduce complexity, while retaining a single
213+ # location for development dependencies.
214+ run : |
215+ python -m pip install -r dev-requirements.txt
216+ python -m pip list
217+ - name : Static Analysis - general (flake8)
218+ run : |
219+ flake8 --count --show-source --statistics
220+ - name : Test with pytest
221+ run : |
222+ pytest
223+ - name : Upload coverage reports to Codecov with GitHub Action
224+ uses : codecov/codecov-action@v2
0 commit comments