-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init change from poetry to hatch * fix quality * fix quality and tests * fix CI * remove alignment * quality:format * move project to src folder * simplify docker for deploy * update usage information * fix ci * fix tests * authorize python from 3.8 to 3.11 * remove old alignment deps * clean up unused utility functions * release v0.5.0
- Loading branch information
Thomas Chaigneau
authored
Sep 1, 2023
1 parent
d303ac0
commit 631e078
Showing
53 changed files
with
457 additions
and
6,208 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,171 +1,66 @@ | ||
name: Quality Checks | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- "wordcab_transcribe/**" | ||
- "tests/**" | ||
workflow_dispatch: | ||
- .github/workflows/ci-cd.yaml | ||
- src/** | ||
- tests/** | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
quality: | ||
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
include: | ||
- { python: "3.9", os: "ubuntu-latest", session: "pre-commit" } | ||
env: | ||
NOXSESSION: ${{ matrix.session }} | ||
FORCE_COLOR: "1" | ||
PRE_COMMIT_COLOR: "always" | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip --version | ||
- name: Upgrade pip in virtual environments | ||
shell: python | ||
run: | | ||
import os | ||
import pip | ||
with open(os.environ["GITHUB_ENV"], mode="a") as io: | ||
print(f"VIRTUALENV_PIP={pip.__version__}", file=io) | ||
- name: Install Poetry | ||
run: | | ||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry | ||
poetry --version | ||
- name: Install Nox | ||
run: | | ||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox | ||
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry | ||
nox --version | ||
- name: Compute pre-commit cache key | ||
if: matrix.session == 'pre-commit' | ||
id: pre-commit-cache | ||
shell: python | ||
run: | | ||
import hashlib | ||
import sys | ||
python = "py{}.{}".format(*sys.version_info[:2]) | ||
payload = sys.version.encode() + sys.executable.encode() | ||
digest = hashlib.sha256(payload).hexdigest() | ||
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) | ||
print("::set-output name=result::{}".format(result)) | ||
- name: Restore pre-commit cache | ||
uses: actions/cache@v3 | ||
if: matrix.session == 'pre-commit' | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }} | ||
restore-keys: | | ||
${{ steps.pre-commit-cache.outputs.result }}- | ||
- name: Run Nox | ||
run: | | ||
nox --python=${{ matrix.python }} | ||
tests: | ||
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
needs: [quality] | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
include: | ||
- { python: "3.9", os: "ubuntu-latest", session: "tests" } | ||
env: | ||
NOXSESSION: ${{ matrix.session }} | ||
FORCE_COLOR: "1" | ||
PRE_COMMIT_COLOR: "always" | ||
WORDCAB_API_KEY: ${{ secrets.WORDCAB_API_KEY }} | ||
check-quality: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
- name: setup-python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
python-version: 3.8 | ||
|
||
- name: Upgrade pip | ||
- name: install-dependencies | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip --version | ||
- name: Upgrade pip in virtual environments | ||
shell: python | ||
run: | | ||
import os | ||
import pip | ||
with open(os.environ["GITHUB_ENV"], mode="a") as io: | ||
print(f"VIRTUALENV_PIP={pip.__version__}", file=io) | ||
- name: Install Poetry | ||
run: | | ||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry | ||
poetry --version | ||
- name: Install Nox | ||
run: | | ||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox | ||
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry | ||
nox --version | ||
- name: Run Nox | ||
python -m pip install --upgrade pip | ||
pip install ".[quality]" | ||
- name: check-quality | ||
run: | | ||
nox --python=${{ matrix.python }} | ||
- name: Upload coverage data | ||
if: always() && matrix.session == 'tests' | ||
uses: "actions/upload-artifact@v3" | ||
with: | ||
name: coverage-data | ||
path: ".coverage.*" | ||
black --check --diff --preview src tests | ||
ruff src tests | ||
run-tests: | ||
needs: check-quality | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
needs: tests | ||
|
||
steps: | ||
- name: Check out the repository | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
- name: setup-python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
python-version: 3.8 | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip --version | ||
- name: Install Poetry | ||
- name: install-dependencies | ||
run: | | ||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry | ||
poetry --version | ||
- name: Install Nox | ||
run: | | ||
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox | ||
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry | ||
nox --version | ||
- name: Download coverage data | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage-data | ||
python -m pip install --upgrade pip | ||
pip install ".[tests]" | ||
- name: Combine coverage data and display human readable report | ||
run: | | ||
nox --session=coverage | ||
- name: Create coverage report | ||
run: | | ||
nox --session=coverage -- xml | ||
- name: run-tests | ||
run: pytest --cov=wordcab_transcribe --cov-report=term-missing tests/ -s --durations 0 |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,21 @@ | ||
repos: | ||
- repo: local | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: "v4.3.0" | ||
hooks: | ||
- id: black | ||
name: black | ||
entry: black | ||
language: system | ||
types: [python] | ||
require_serial: true | ||
- id: check-added-large-files | ||
name: Check for added large files | ||
entry: check-added-large-files | ||
language: system | ||
- id: check-toml | ||
name: Check Toml | ||
entry: check-toml | ||
language: system | ||
types: [toml] | ||
- id: check-yaml | ||
name: Check Yaml | ||
entry: check-yaml | ||
language: system | ||
types: [yaml] | ||
- id: end-of-file-fixer | ||
name: Fix End of Files | ||
entry: end-of-file-fixer | ||
language: system | ||
types: [text] | ||
stages: [commit, push, manual] | ||
- id: flake8 | ||
name: flake8 | ||
entry: flake8 | ||
language: system | ||
types: [python] | ||
require_serial: true | ||
args: [--darglint-ignore-regex, .*] | ||
- id: isort | ||
name: isort | ||
entry: isort | ||
require_serial: true | ||
language: system | ||
types_or: [cython, pyi, python] | ||
args: ["--filter-files"] | ||
- id: pyupgrade | ||
name: pyupgrade | ||
description: Automatically upgrade syntax for newer versions. | ||
entry: pyupgrade | ||
language: system | ||
types: [python] | ||
args: [--py37-plus] | ||
- id: trailing-whitespace | ||
name: Trim Trailing Whitespace | ||
entry: trailing-whitespace-fixer | ||
language: system | ||
types: [text] | ||
stages: [commit, push, manual] | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.6.0 | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
args: ["--preview"] | ||
language_version: python3 | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: "v0.0.263" | ||
hooks: | ||
- id: prettier | ||
- id: ruff | ||
args: [--fix] | ||
exclude: ^notebooks/ |
Oops, something went wrong.