From 04073787b0642f4eb11d92ddd1bbf793f1a9e833 Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 02:13:07 -0500 Subject: [PATCH 1/9] change Test action so it runs on every PR --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index baf34dd5a3b..53508333d29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ name: Tests -on: push +on: [pull_request, push] jobs: tests: runs-on: ubuntu-latest From 6d1ad0a8df0c15b2de5c6171eed7cc180afc1e0b Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 02:13:40 -0500 Subject: [PATCH 2/9] change tests to run on windows and mac. --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53508333d29..62ddc1cf2f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,10 +2,12 @@ name: Tests on: [pull_request, push] jobs: tests: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: python-version: ['3.6.13', '3.7', '3.8'] + os: [ubuntu-latest, macos-latest, windows-latest] name: Python ${{ matrix.python-version }} steps: - name: Checkout Code From 29a4f8952fbd3748ad09584bdcf794d28fabe229 Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 02:37:24 -0500 Subject: [PATCH 3/9] fix windows test --- .github/workflows/test.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62ddc1cf2f8..93b204eeecb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,12 +3,15 @@ on: [pull_request, push] jobs: tests: runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash strategy: fail-fast: false matrix: - python-version: ['3.6.13', '3.7', '3.8'] + python-version: ['3.6', '3.7', '3.8'] os: [ubuntu-latest, macos-latest, windows-latest] - name: Python ${{ matrix.python-version }} + name: ${{ matrix.os}} Python ${{ matrix.python-version }} steps: - name: Checkout Code uses: actions/checkout@v2 @@ -36,9 +39,12 @@ jobs: if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root + - name: Install Package + run: poetry install --no-interaction + - name: Run tests env: MPLBACKEND: Agg run: | - source .venv/bin/activate + source $VENV pytest tests/ From 6f20d6cf0d637851ee02d9233c5f0272b6295820 Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 04:07:35 -0500 Subject: [PATCH 4/9] refactored github actions --- .github/workflows/lint_python.yml | 20 -------- .github/workflows/test.yml | 82 ++++++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/lint_python.yml diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml deleted file mode 100644 index 3365e5f3f6b..00000000000 --- a/.github/workflows/lint_python.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: lint_python -on: [pull_request, push] -jobs: - lint_python: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety - - run: bandit -r . || true - - run: black --check . || true - - run: codespell --ignore-words-list="mape" --quiet-level=2 # --skip="" - - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - - run: isort --check-only --profile black . || true - - run: pip install -r requirements.txt || true - - run: mypy --ignore-missing-imports . || true - - run: pytest . || true - - run: pytest --doctest-modules . || true - - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - - run: safety check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 93b204eeecb..9af512b8f14 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,17 +1,87 @@ name: Tests on: [pull_request, push] jobs: + linting: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Setup Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: "3.8" + architecture: x64 + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-lint + restore-keys: ${{ runner.os }}-lint + + - run: pip install bandit black codespell flake8 isort mypy pyupgrade safety + - run: bandit -r . || true + - run: black --check . || true + - run: codespell --ignore-words-list="mape" --quiet-level=2 # --skip="" + - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - run: isort --check-only --profile black . || true + - run: pip install -r requirements.txt || true + - run: mypy --ignore-missing-imports . || true + - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true + - run: safety check + test: + name: ubuntu-latest - Python 3.8 + needs: linting + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Setup Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: "3.8" + architecture: x64 + + - name: Install Poetry + uses: snok/install-poetry@v1.1.1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + + - name: Install Package + run: poetry install --no-interaction + + - name: Run tests + env: + MPLBACKEND: Agg + run: | + source $VENV + pytest tests/ tests: + needs: test runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash strategy: - fail-fast: false + fail-fast: true matrix: python-version: ['3.6', '3.7', '3.8'] - os: [ubuntu-latest, macos-latest, windows-latest] - name: ${{ matrix.os}} Python ${{ matrix.python-version }} + os: [ubuntu-latest, macos-latest] + exclude: + - os: ubuntu-latest + python-version: '3.8' + name: ${{ matrix.os}} - Python ${{ matrix.python-version }} steps: - name: Checkout Code uses: actions/checkout@v2 From 3b4cf432487d9f4eb73231b7e4455ee78514cd51 Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 04:09:24 -0500 Subject: [PATCH 5/9] fix yaml format --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9af512b8f14..3260ac31c77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Tests on: [pull_request, push] jobs: - linting: + linting: name: Linting runs-on: ubuntu-latest steps: From d0ef5223d90cc7c410ac52f53b2db32289764a5b Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 04:10:24 -0500 Subject: [PATCH 6/9] fix matrix exclude --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3260ac31c77..7373d0c32d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,9 +78,9 @@ jobs: matrix: python-version: ['3.6', '3.7', '3.8'] os: [ubuntu-latest, macos-latest] - exclude: - - os: ubuntu-latest - python-version: '3.8' + exclude: + - os: ubuntu-latest + python-version: '3.8' name: ${{ matrix.os}} - Python ${{ matrix.python-version }} steps: - name: Checkout Code From 1ed531b7cad576578a7708066f8df2e140caafa8 Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Wed, 3 Mar 2021 04:14:23 -0500 Subject: [PATCH 7/9] remove package install from linting --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7373d0c32d5..831a0a6cda5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,8 +17,8 @@ jobs: - uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-lint - restore-keys: ${{ runner.os }}-lint + key: ${{ runner.os }}-linting + restore-keys: ${{ runner.os }}-linting - run: pip install bandit black codespell flake8 isort mypy pyupgrade safety - run: bandit -r . || true @@ -26,7 +26,6 @@ jobs: - run: codespell --ignore-words-list="mape" --quiet-level=2 # --skip="" - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - run: isort --check-only --profile black . || true - - run: pip install -r requirements.txt || true - run: mypy --ignore-missing-imports . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check From 4b12fe6a05a4fc745d1ab0749611a0c0bb45c3cb Mon Sep 17 00:00:00 2001 From: Levi Date: Wed, 3 Mar 2021 19:01:12 +0530 Subject: [PATCH 8/9] Update .github/workflows/test.yml Co-authored-by: Christian Clauss --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 831a0a6cda5..698039aff9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python 3.8 - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: "3.8" architecture: x64 From 598a9ab18f40cdc2703ad74158ebf3cdb0767e96 Mon Sep 17 00:00:00 2001 From: Levi Date: Wed, 3 Mar 2021 19:35:31 +0530 Subject: [PATCH 9/9] Apply suggestions from code review Co-authored-by: Christian Clauss --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 698039aff9a..49dcf5a5c68 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python 3.8 - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: "3.8" architecture: x64