fix: mann_kendall_trend_yxt mypy error #173
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Code Checks | |
on: | |
push: | |
pull_request: | |
jobs: | |
pyenv: | |
runs-on: ubuntu-20.04 | |
outputs: | |
cache-key: ${{ steps.cfg.outputs.cache-key }} | |
cache-path: ${{ steps.cfg.outputs.cache-path }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: cfg | |
id: cfg | |
run: | | |
cache_path="${{ env.pythonLocation }}" | |
cache_key="${cache_path}-${{ hashFiles('requirements.txt', 'requirements_dev.txt') }}" | |
echo "cache-key=${cache_key}" >> $GITHUB_OUTPUT | |
echo "cache-path=${cache_path}" >> $GITHUB_OUTPUT | |
- name: cache deps | |
uses: actions/cache@v4 | |
id: py_cache | |
with: | |
path: ${{ steps.cfg.outputs.cache-path }} | |
key: ${{ steps.cfg.outputs.cache-key }} | |
restore-keys: | | |
${{ steps.cfg.outputs.cache-path }}- | |
- name: install dependencies | |
if: steps.py_cache.outputs.cache-hit != 'true' | |
run: | | |
pip install \ | |
--upgrade --upgrade-strategy eager \ | |
-r requirements.txt \ | |
-r requirements_dev.txt | |
pip freeze | |
- name: dump | |
run: | | |
echo $LD_LIBRARY_PATH | |
echo "$PATH" | |
which python | |
python --version | |
black: | |
needs: | |
- pyenv | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Python Env from Cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ needs.pyenv.outputs.cache-key }} | |
path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Update PATH | |
run: | | |
echo "${py_path}/bin" >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=${py_path}/lib" >> $GITHUB_ENV | |
env: | |
py_path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: run black | |
run: | | |
black --version | |
black --check --diff hdc tests | |
linting: | |
needs: | |
- pyenv | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Python Env from Cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ needs.pyenv.outputs.cache-key }} | |
path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Update PATH | |
run: | | |
echo "${py_path}/bin" >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=${py_path}/lib" >> $GITHUB_ENV | |
env: | |
py_path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: pylint | |
run: pylint hdc | |
- name: pydocstyle | |
run: pydocstyle hdc | |
- name: mypy | |
run: mypy hdc | |
wheels: | |
needs: | |
- pyenv | |
- black | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Python Env from Cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ needs.pyenv.outputs.cache-key }} | |
path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Update PATH | |
shell: bash | |
run: | | |
echo "${py_path}/bin" >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=${py_path}/lib" >> $GITHUB_ENV | |
env: | |
py_path: ${{ needs.pyenv.outputs.cache-path }} | |
- uses: actions/cache@v4 | |
id: wheels_cache | |
with: | |
path: ./wheels | |
key: wheels-${{ github.sha }} | |
- name: build wheels unpatched | |
run: | | |
mkdir -p wheels | |
pip wheel \ | |
--verbose \ | |
--no-input \ | |
--no-deps \ | |
--exists-action w \ | |
--wheel-dir wheels \ | |
. | |
python setup.py sdist -d wheels | |
- name: patch version | |
run: | | |
python ./scripts/patch_version.py ${GITHUB_RUN_NUMBER:-0} ./hdc/algo/_version.py | |
- name: build wheels patched version | |
run: | | |
pip wheel \ | |
--verbose \ | |
--no-input \ | |
--no-deps \ | |
--exists-action w \ | |
--wheel-dir wheels \ | |
. | |
python setup.py sdist -d wheels | |
- name: Upload results (artifact) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: wheels | |
if-no-files-found: error | |
tests: | |
needs: | |
- pyenv | |
- black | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Python Env from Cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ needs.pyenv.outputs.cache-key }} | |
path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Update PATH | |
shell: bash | |
run: | | |
echo "${py_path}/bin" >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=${py_path}/lib" >> $GITHUB_ENV | |
env: | |
py_path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Run test with coverage | |
run: | | |
python -m pytest -s \ | |
--cov \ | |
--cov-report=term \ | |
tests/ | |
test-wheel: | |
needs: | |
- pyenv | |
- black | |
- wheels | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Python Env from Cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ needs.pyenv.outputs.cache-key }} | |
path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Update PATH | |
shell: bash | |
run: | | |
echo "${py_path}/bin" >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=${py_path}/lib" >> $GITHUB_ENV | |
env: | |
py_path: ${{ needs.pyenv.outputs.cache-path }} | |
- name: Get Wheels | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels | |
path: wheels | |
- name: Install dev wheel | |
run: | | |
find wheels/ -type f -name "*.dev*.whl" | head -1 | xargs python -m pip install | |
- name: Test Code from the wheel | |
run: | | |
cd tests/ | |
python -m pytest -s . |