From 01ee7809ef9144edfa7ac4c2d9480e47af5401f4 Mon Sep 17 00:00:00 2001 From: Jacob Bieker Date: Tue, 26 Oct 2021 16:13:34 +0100 Subject: [PATCH] Add reusable workflows --- .bumpversion.cfg | 8 ++++++++ .github/workflows/linters.yaml | 21 ++----------------- .github/workflows/main.yaml | 35 -------------------------------- .github/workflows/release.yaml | 10 +++++++++ .github/workflows/workflows.yaml | 28 +++---------------------- 5 files changed, 23 insertions(+), 79 deletions(-) create mode 100644 .bumpversion.cfg delete mode 100644 .github/workflows/main.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..62fbb4a --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,8 @@ +[bumpversion] +commit = True +tag = True +current_version = 0.0.4 + +[bumpversion:file:setup.py] +search = version="{current_version}" +replace = version="{new_version}" diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index d966d27..092da6a 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -3,22 +3,5 @@ name: Lint Python on: [push] jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pydocstyle - - name: Docstyle linting - run: | - pydocstyle --convention=google --add-ignore=D200,D210,D212,D415 + call-run-python-linters: + uses: openclimatefix/.github/.github/workflows/python-lint.yml@main diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index 629df3f..0000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3b6e961 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,10 @@ +name: Bump version and auto-release +on: + push: + branches: + - main +jobs: + call-run-python-release: + uses: openclimatefix/.github/.github/workflows/python-release.yml@main + secrets: + token: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/workflows.yaml b/.github/workflows/workflows.yaml index ce76aeb..6bd4183 100644 --- a/.github/workflows/workflows.yaml +++ b/.github/workflows/workflows.yaml @@ -1,28 +1,6 @@ -name: Tests +name: Python package on: [push] - jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Install package - run: | - pip install -e . - - name: Test with pytest - run: | - pytest + call-run-python-tests: + uses: openclimatefix/.github/.github/workflows/python-test.yml@main