Adjust mypy no-type check #68
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: fmu-tools | |
on: | |
push: | |
pull_request: | |
branches: | |
- master | |
types: [created, synchronize] | |
release: | |
types: | |
- published | |
schedule: | |
# Run CI every night and check that tests are working with latest dependencies | |
- cron: "0 0 * * *" | |
jobs: | |
fmu-tools: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.6", "3.7", "3.8", "3.9"] | |
pandas-version: ["0.21.0", "1.*"] | |
exclude: | |
- python-version: "3.9" | |
pandas-version: "0.21.0" | |
- python-version: "3.8" | |
pandas-version: "0.21.0" | |
- python-version: "3.7" | |
pandas-version: "0.21.0" | |
steps: | |
- name: Checkout commit locally | |
uses: actions/checkout@v2 | |
- name: Checkout tags | |
# This seems necessary for setuptools_scm to be able to infer | |
# the correct version. | |
run: git fetch --unshallow --tags | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install requirements | |
run: | | |
pip install pip -U | |
pip install .[docs,tests] | |
pip install pandas==${{ matrix.pandas-version }} | |
- name: List all installed packages | |
run: pip freeze | |
- name: Check code style | |
run: | | |
black --check . | |
flake8 . | |
- name: Enforce static typing | |
run: | | |
pip install mypy | |
pip install types-dataclasses | |
mypy src/fmu/tools | |
- name: Where am i? | |
run: | | |
pwd | |
- name: Run tests | |
run: | | |
git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata | |
pytest ./tests | |
# Check that repository is untainted by test code: | |
git status --porcelain | |
test -z "$(git status --porcelain)" | |
- name: Syntax check on documentation | |
run: rstcheck -r docs | |
- name: Build documentation | |
run: | | |
sphinx-apidoc -f -H "API for fmu.tools" -o docs src | |
python setup.py build_sphinx | |
- name: Update GitHub pages | |
if: github.repository_owner == 'equinor' && github.ref == 'refs/heads/master' && matrix.python-version == '3.6' && matrix.pandas-version != '0.21' | |
run: | | |
cp -R ./build/sphinx/html ../html | |
git config --local user.email "fmu-tools-github-action" | |
git config --local user.name "fmu-tools-github-action" | |
git fetch origin gh-pages | |
git checkout --track origin/gh-pages | |
git clean -f -f -d -x # Double -f is intentional. | |
git rm -r * | |
cp -R ../html/* . | |
touch .nojekyll # If not, github pages ignores _* directories. | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "No changes in documentation. Skip documentation deploy." | |
else | |
git commit -m "Update Github Pages" | |
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages | |
fi | |
- name: Build python package and publish to pypi | |
if: github.event_name == 'release' && matrix.python-version == '3.6' && matrix.pandas-version != '0.21' | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.fmu_tools_pypi_token }} | |
run: | | |
python -m pip install --upgrade setuptools wheel twine | |
python setup.py sdist bdist_wheel | |
twine upload dist/* |