Skip to content

Commit

Permalink
Update pre-commit config. (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
csadorf committed Jan 17, 2022
1 parent 50a713c commit 275f057
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 147 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
---
# Run basic tests for this app on the latest aiidalab-docker image.

name: continuous-integration

on:
[push, pull_request]
on: [push, pull_request]

jobs:

pre-commit:
pre-commit:
# Adapted from: https://github.com/CasperWA/voila-optimade-client

runs-on: ubuntu-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- uses: pre-commit/action@v2.0.0
- uses: pre-commit/action@v2.0.0

test-app:
test-app:

needs: [pre-commit]
needs: [pre-commit]

runs-on: ubuntu-latest
timeout-minutes: 10
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
tag: [ stable ]
browser: [ chrome, firefox ]
fail-fast: false
strategy:
matrix:
tag: [stable]
browser: [chrome, firefox]
fail-fast: false

steps:
steps:

- name: Check out app
uses: actions/checkout@v2
- name: Check out app
uses: actions/checkout@v2

- name: Test app
uses: aiidalab/aiidalab-test-app-action@v2
with:
image: aiidalab/aiidalab-docker-stack:${{ matrix.tag }}
browser: ${{ matrix.browser }}
- name: Test app
uses: aiidalab/aiidalab-test-app-action@v2
with:
image: aiidalab/aiidalab-docker-stack:${{ matrix.tag }}
browser: ${{ matrix.browser }}
155 changes: 78 additions & 77 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,87 @@
---
name: Publish on Test PyPI and PyPI

on:
push:
branches:
push:
branches:
# Commits pushed to release/ branches are published on Test PyPI if they
# have a new version number.
- "release/**"
tags:
- release/**
tags:
# Tags that start with the "v" prefix are published on PyPI.
- "v*"
- v*

jobs:

build-and-publish-test:

name: Build and publish on TestPyPI
if: startsWith(github.ref, 'refs/heads/release/')

runs-on: ubuntu-latest
environment:
name: Test PyPI
url: https://test.pypi.org/project/aiidalab-widgets-base/

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pypa/build
run: python -m pip install build

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution on Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

build-and-publish:

name: Build and publish on PyPI
if: startsWith(github.ref, 'refs/tags')

runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/aiidalab-widgets-base/

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pypa/build
run: python -m pip install build

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
build-and-publish-test:

name: Build and publish on TestPyPI
if: startsWith(github.ref, 'refs/heads/release/')

runs-on: ubuntu-latest
environment:
name: Test PyPI
url: https://test.pypi.org/project/aiidalab-widgets-base/

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pypa/build
run: python -m pip install build

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution on Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

build-and-publish:

name: Build and publish on PyPI
if: startsWith(github.ref, 'refs/tags')

runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/aiidalab-widgets-base/

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pypa/build
run: python -m pip install build

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
61 changes: 39 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-yaml
- id: check-json
- id: trailing-whitespace
exclude: miscellaneous/structures
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: miscellaneous/structures

- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.1.0
hooks:
- id: yamlfmt

- repo: https://github.com/PyCQA/flake8
rev: '4.0.1'
hooks:
- id: flake8
args: [--count, --show-source, --statistics]
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [--count, --show-source, --statistics]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [--profile, black, --filter-files]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
- id: setup-cfg-fmt

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.9.1
hooks:
- id: check-github-workflows
9 changes: 5 additions & 4 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
max-line-length: 120

ignore-paths:
Expand All @@ -7,13 +8,13 @@ ignore-paths:
- utils

pylint:
run: true
run: true

pyflakes:
run: false
run: false

pep8:
run: false
run: false

mccabe:
run: false
run: false
11 changes: 6 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
build:
image: latest
image: latest
python:
version: 3.7
pip_install: true
extra_requirements:
- "docs"
version: 3.7
pip_install: true
extra_requirements:
- docs
1 change: 0 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ html:

view:
xdg-open $(BUILDDIR)/html/index.html

2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Indices and tables

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* :ref:`search`
2 changes: 1 addition & 1 deletion docs/source/nitpick-exceptions
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ py:class ipywidgets.widgets.widget_string.HTML
py:class ipywidgets.widgets.widget_string.Textarea

# Traitlets.
py:class traitlets.traitlets.HasTraits
py:class traitlets.traitlets.HasTraits

0 comments on commit 275f057

Please sign in to comment.