diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index c8943b9d..6c8a47b2 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -1,4 +1,4 @@ -name: CI to Docker Hub +name: Docker build on: push: @@ -18,7 +18,7 @@ jobs: - name: Test image # Checks we are able to run the container. run: docker compose -f docker-compose.test.yml run sut - build: + build_upload: runs-on: ubuntu-latest needs: test if: github.event_name != 'pull_request' diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml new file mode 100644 index 00000000..12ec03fe --- /dev/null +++ b/.github/workflows/lint-docs.yml @@ -0,0 +1,42 @@ +name: Lint & Docs + +on: + push: + branches: [ 'master', 'stable-*' ] + pull_request: + branches: [ 'master', 'stable-*' ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: 'pip' + cache-dependency-path: '**/pyproject.toml' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox + - name: Run Lint + run: tox -e lint + + test_doc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: 'pip' + cache-dependency-path: '**/pyproject.toml' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox + - name: Check we can generate documentation + run: tox -e docs diff --git a/.github/workflows/test-docs.yml b/.github/workflows/unit-tests.yml similarity index 96% rename from .github/workflows/test-docs.yml rename to .github/workflows/unit-tests.yml index 372ca8ae..067bc923 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/unit-tests.yml @@ -1,4 +1,4 @@ -name: Test & Docs +name: Unit tests on: push: @@ -7,7 +7,7 @@ on: branches: [ 'master', 'stable-*' ] jobs: - build: + test: runs-on: ubuntu-latest @@ -101,6 +101,3 @@ jobs: if: matrix.database == 'mariadb' env: TESTING_SQLALCHEMY_DATABASE_URI: 'mysql+pymysql://root:ihatemoney@localhost:3306/ihatemoney_ci' - - name: Run Lint & Docs - run: tox -e lint_docs - if: matrix.python-version == '3.12' diff --git a/tox.ini b/tox.ini index fe2c9ad9..8a0421fa 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] isolated_build = true -envlist = py312,py311,py310,py39,py38,py37,lint_docs +envlist = py312,py311,py310,py39,py38,py37,lint,docs skip_missing_interpreters = True [testenv] @@ -16,15 +16,21 @@ deps = # To be sure we are importing ihatemoney pkg from pip-installed version changedir = /tmp -[testenv:lint_docs] +[testenv:lint] commands = black --check --target-version=py37 . isort --check --profile black . flake8 ihatemoney vermin --no-tips --violations -t=3.7- . +deps = + -e.[dev] +changedir = {toxinidir} + +[testenv:docs] +commands = sphinx-build -a -n -b html -d docs/_build/doctrees docs docs/_build/html deps = - -e.[dev,doc] + -e.[doc] changedir = {toxinidir} [flake8]