Skip to content

Commit

Permalink
Simplify lint and docs runs on GHA (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Mar 9, 2022
1 parent cfbd23f commit 30f8c26
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
36 changes: 11 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,6 @@ jobs:
|| steps.scm-version.outputs.dist-version-for-filenames
}}.md')
lint:
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
runs-on: Ubuntu-latest
steps:
- name: Fetch the src snapshot
uses: actions/checkout@v2
with:
fetch-depth: 1
ref: ${{ github.event.inputs.release-commitish }}
- name: Setup node
uses: actions/setup-node@v2
- name: Install dependencies
run: |
python -m pip install --user --upgrade pip
python -m pip install -r test-requirements.txt
npm ci
- name: npm run lint
run: npm run lint

build:
name: Build ${{ needs.pre-setup.outputs.git-tag }}
needs:
Expand Down Expand Up @@ -319,8 +299,8 @@ jobs:
name: npm-package-tarball
path: ${{ needs.pre-setup.outputs.tarball-artifact-name }}

docs:
name: docs
tox:
name: ${{ matrix.toxenv }}

runs-on: ${{ matrix.os }}-latest
strategy:
Expand All @@ -332,12 +312,14 @@ jobs:
3.10
toxenv:
- docs
- lint
fail-fast: false

env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PY_COLORS: 1
TOX_PARALLEL_NO_SPINNER: 1
TOXENV: ${{ matrix.toxenv }}
TOX_PARALLEL_NO_SPINNER: 1

steps:
- name: >-
Expand All @@ -346,6 +328,11 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup node
if: contains(matrix.toxenv, 'lint')
uses: actions/setup-node@v2

- name: >-
Calculate Python interpreter version hash value
for use in the cache key
Expand Down Expand Up @@ -548,8 +535,7 @@ jobs:
if: always()

needs:
- docs
- lint
- tox # lint, docs
- test
# - vscode

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"compile": "tsc -p .",
"coverage": "nyc report --reporter=text-lcov > out/coverage.lcov",
"deps": "ncu -u && npm install",
"lint": "npm ci && pre-commit run -a",
"lint": "pre-commit run -a",
"prepack": "npm ci && npm run compile",
"//prepare": "Prepare is needed for installation from source",
"prepare": "npm run compile",
Expand Down
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# spell-checker:ignore toxinidir passenv usedevelop testenv basepython envpython linkcheck changedir envdir envlist minversion toxworkdir posargs envname
[tox]
envlist =
lint
docs
minversion = 3.21.0
skip_install = true

Expand All @@ -10,6 +12,11 @@ skip_install = true
sphinx_common_args =
-j auto {tty:--color} -a -n -W --keep-going -T -d "{temp_dir}/.doctrees" . "{envdir}/docs_out"

[testenv]
passenv =
CI
GITHUB_ACTIONS

[testenv:docs]
allowlist_externals =
git
Expand Down Expand Up @@ -48,6 +55,16 @@ skip_install = true
usedevelop = false


[testenv:lint]
description = Run all linters
deps =
pre-commit >= 2.17.0
commands =
# Commands are the same as running `npm run lint`:
pre-commit run -a
skip_install = true


[testenv:make-changelog]
basepython = python3
depends =
Expand Down

0 comments on commit 30f8c26

Please sign in to comment.