From 74f26e027e20bae19963d4a6fc34eabd80db922f Mon Sep 17 00:00:00 2001 From: "ilker.sigirci" Date: Wed, 15 Feb 2023 19:07:39 +0300 Subject: [PATCH 1/3] initial github action test --- .github/workflows/test.yaml | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..5747cf6 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,54 @@ +name: Python package + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + specific-python-version: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + # Semantic version range syntax or exact version of a Python version + python-version: '3.8' + # Optional - x64 or x86 architecture, defaults to x64 + architecture: 'x64' + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + + test: + # needs: NOTHING + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11'] + os: [ubuntu-20.04, macOS-11] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Display Python version + run: python -c "import sys; print(sys.version)" + + - name: Install the module and its dependencies + run: | + make install + - name: Show dependencies + run: python -m pip list + + - name: Run tests + run: make test-parallel + + - name: Publish code coverage + uses: codecov/codecov-action@v3 From 61be6658eacab2b75cc721a10223678a76d1556c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20SI=C4=9EIRCI?= Date: Wed, 15 Feb 2023 23:23:46 +0300 Subject: [PATCH 2/3] lint && doc github actions added --- .github/workflows/doc.yaml | 26 ++++++++++++++++++++++++++ .github/workflows/lint.yaml | 30 ++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 31 +++++-------------------------- .gitlab-ci.yml | 2 +- pyproject.toml | 7 +++++-- 5 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/doc.yaml create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/doc.yaml b/.github/workflows/doc.yaml new file mode 100644 index 0000000..5a02341 --- /dev/null +++ b/.github/workflows/doc.yaml @@ -0,0 +1,26 @@ +name: Docs via GitHub Pages + +on: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Pip updated + run: | + pip install --upgrade pip + - name: Doc installation + run: | + make install-doc + - name: Documenting + run: | + make doc diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..8a4af0c --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,30 @@ +name: Lint the module + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + # needs: NOTHING + lint: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Pip updated + run: | + pip install --upgrade pip + - name: Lint installation + run: | + make install-lint + - name: Linting + run: | + make lint diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5747cf6..60c5022 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: Python package +name: Test the module on: push: @@ -9,46 +9,25 @@ on: - main jobs: - specific-python-version: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - # Semantic version range syntax or exact version of a Python version - python-version: '3.8' - # Optional - x64 or x86 architecture, defaults to x64 - architecture: 'x64' - # You can test your matrix by printing the current Python version - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - test: - # needs: NOTHING + tests: strategy: matrix: python-version: ['3.8', '3.9', '3.10', '3.11'] - os: [ubuntu-20.04, macOS-11] - runs-on: ${{ matrix.os }} + # os: [ubuntu-20.04, ubuntu-22.04] + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - name: Install the module and its dependencies run: | make install - name: Show dependencies run: python -m pip list - - name: Run tests run: make test-parallel - - name: Publish code coverage uses: codecov/codecov-action@v3 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7da2c24..0723e34 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,7 +50,7 @@ pages: echo "*********** Pip updated ***********" make install-doc echo "*********** Docs dependencies installed ***********" - mkdocs build + make doc echo "*********** Successfully builded the project documentation ***********" # only: # - main diff --git a/pyproject.toml b/pyproject.toml index b1606e2..4d08ca0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "python_template" version = "0.0.0" description = "Python Template" -requires-python = ">=3.8,<3.9" +requires-python = ">=3.8,<3.12" authors = [ {name = "template", email = "template@github.com"}, @@ -28,6 +28,9 @@ classifiers = [ "Operating System :: Unix", "Operating System :: MacOS", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ] dependencies = [ @@ -173,7 +176,7 @@ combine-as-imports = true # mypy section # Read more here: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file [tool.mypy] -python_version = "3.8" +# python_version = "3.8" files = ["python_template"] # exclude = ['^tests/'] strict = true From 49140f553b116efa408de69ce7a24155829e71ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20SI=C4=9EIRCI?= Date: Wed, 15 Feb 2023 23:28:18 +0300 Subject: [PATCH 3/3] black installation added to makefile --- Makefile | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 68aa7a1..3f8e938 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ install-test: ## Install only test version of the package pip install .[test] install-lint: - pip install ruff==0.0.193 + pip install black[d]==23.1.0 ruff==0.0.246 install-build: pip install -U build diff --git a/pyproject.toml b/pyproject.toml index 4d08ca0..a60c090 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,9 +54,9 @@ doc = [ ] dev = [ - "black[d]", - "pre-commit", + "black[d]==23.1.0", "ruff==0.0.246", + "pre-commit", "mypy", "build", ]