Skip to content

Commit

Permalink
ci: automatically upgrade requirements (#185)
Browse files Browse the repository at this point in the history
* build!: limit to iminuit 1
* ci: upload HTML build folder upon failure
* fix: add matplotlib to doc requirements
  • Loading branch information
redeboer authored Jan 4, 2021
1 parent 7a26936 commit 06f9d51
Show file tree
Hide file tree
Showing 37 changed files with 2,300 additions and 192 deletions.
86 changes: 3 additions & 83 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cspell:ignore bdist noreply prereleased pypa sdist
# cspell:ignore bdist noreply prereleased sdist

name: CD

Expand All @@ -9,90 +9,10 @@ on:
- released

jobs:
test:
name: Run pytest
if: startsWith(github.ref, 'refs/tags')
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-10.15
- ubuntu-18.04
python-version: [3.6, 3.7, 3.8]
exclude:
- os: macos-10.15
python-version: 3.6
- os: macos-10.15
python-version: 3.8
steps:
- 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: |
python -m pip install --upgrade pip
pip install .[test]
- name: Test with pytest
env:
PYTEST_RUN_SLOW_TESTS: YES
run: pytest -n auto

documentation:
name: Build documentation and run notebooks
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[doc]
sudo apt-get -y install pandoc graphviz
- name: Build documentation and run notebooks
working-directory: docs
env:
EXECUTE_NB: YES
run: make html
- name: Test doctests in docstrings
working-directory: docs
run: make ignore-warnings=1 doctest

style:
name: Style checks
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[precommit]
sudo npm install -g cspell pyright
- name: Perform style checks
run: pre-commit run -a
- name: Check spelling
run: cspell $(git ls-files)
- name: Run pyright
run: pyright

push:
name: Push to stable branch
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-18.04
needs:
- documentation
- style
- test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Push to stable branch
Expand All @@ -105,7 +25,7 @@ jobs:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
needs: push
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cspell:ignore unittests, CUDA
# cspell:ignore CUDA unittests

name: CI

Expand All @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04]
os: [ubuntu-20.04]
python-version: [3.7]
steps:
- uses: actions/checkout@master
Expand All @@ -31,7 +31,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
pip install -r reqs/${{ matrix.python-version }}/requirements-test.txt
pip install .
- name: Test with pytest-cov
env:
CUDA_VISIBLE_DEVICES: "-1"
Expand All @@ -49,14 +50,14 @@ jobs:
matrix:
os:
- macos-10.15
- ubuntu-18.04
- ubuntu-20.04
python-version: [3.6, 3.7, 3.8]
exclude:
- os: macos-10.15
python-version: 3.6
- os: macos-10.15
python-version: 3.8
- os: ubuntu-18.04 # coverage job
- os: ubuntu-20.04 # coverage job
python-version: 3.7
steps:
- uses: actions/checkout@v2
Expand All @@ -67,7 +68,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
pip install -r reqs/${{ matrix.python-version }}/requirements-test.txt
pip install .
- name: Test with pytest
env:
CUDA_VISIBLE_DEVICES: "-1"
Expand All @@ -79,7 +81,7 @@ jobs:
documentation:
name: Build documentation and run notebooks
if: github.event.pull_request.draft == false
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
Expand All @@ -89,23 +91,29 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[doc]
pip install -r reqs/3.7/requirements-doc.txt
pip install tensorflow-cpu
pip install .
sudo apt-get -y install pandoc graphviz
- name: Build documentation and run notebooks
working-directory: docs
env:
CUDA_VISIBLE_DEVICES: "-1"
EXECUTE_NB: YES
run: make html
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: html
path: docs/_build/html
- name: Test doctests in docstrings
working-directory: docs
run: make ignore-warnings=1 doctest

style:
name: Style checks
if: github.event.pull_request.draft == false
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
Expand All @@ -115,11 +123,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[precommit]
pip install -r reqs/3.7/requirements-sty.txt
pip install .
sudo npm install -g cspell pyright
- name: Perform style checks
run: pre-commit run -a
- name: Check spelling
run: cspell $(git ls-files)
run: cspell --no-progress $(git ls-files)
- name: Run pyright
run: pyright
7 changes: 5 additions & 2 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cspell:ignore reqs

name: Linkcheck

on:
Expand All @@ -15,7 +17,7 @@ jobs:
check_links:
name: Check external links
if: github.event.pull_request.draft == false
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
Expand All @@ -25,7 +27,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[doc]
pip install -r reqs/3.7/requirements-doc.txt
pip install .
sudo apt-get -y install pandoc
- name: Check external links
working-directory: docs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
check-labels:
name: Check labels
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
Expand All @@ -24,7 +24,7 @@ jobs:

check-title:
name: Check title
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
update_release_draft:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: release-drafter/release-drafter@v5
env:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/requirements-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# cspell:ignore noreply

name: Requirements (scheduled)

on:
schedule:
- cron: "0 2 * * 1"

jobs:
upgrade:
name: Upgrade requirement files
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
- 3.6
- 3.7
- 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pip-tools
- name: Upgrade dependencies
run: bash reqs/upgrade.sh
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.python-version }}
path: reqs/${{ matrix.python-version }}

push:
name: Create PR
runs-on: ubuntu-20.04
needs:
- upgrade
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
- uses: actions/download-artifact@v2
with:
path: reqs
- run: git status -s
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: "ci: upgrade developer dependencies"
committer: GitHub <noreply@github.com>
author:
${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "ci: upgrade developer dependencies"
assignees: ${{ github.actor }}
reviewers: ${{ github.actor }}
labels: |
🖱️ DX
🔨 Maintenance
branch-suffix: timestamp
delete-branch: true
token: ${{ secrets.PAT }}
- name: Print PR info
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
Loading

0 comments on commit 06f9d51

Please sign in to comment.