From 681949bb43751117b009ce54869b443a9c6c61b9 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Wed, 20 Jul 2022 14:31:43 +0100 Subject: [PATCH] Add CI/CD GitHub Workflows --- .github/workflows/cd.yml | 45 ++++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..a97397f --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,45 @@ +name: cd + +on: + push: + tags: + - "v*" + +jobs: + tagged-release: + name: Tagged Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10.x' + - name: Install Poetry + uses: abatilo/actions-poetry@v2.1.0 + with: + poetry-version: '1.1.11' + - name: Configure poetry + run: poetry config virtualenvs.in-project true + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + poetry install + - name: Build a wheel + run: poetry build + - name: Upload wheel + uses: actions/upload-artifact@v2.2.4 + with: + name: Python Wheel + path: "dist/*.whl" + - name: Deploy release + uses: marvinpinto/action-automatic-releases@latest + with: + prerelease: false + repo_token: "${{ secrets.GITHUB_TOKEN }}" + files: | + dist/*.whl + - name: Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + run: poetry publish diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bcaa899 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: ci + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10'] + poetry-version: [1.1.11] + + 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 poetry + uses: abatilo/actions-poetry@v2.1.0 + with: + poetry-version: ${{ matrix.poetry-version }} + - name: Install project + run: | + poetry install --no-dev + python -m pip install flake8 pytest + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + # - name: Test with pytest + # run: | + # pytest + + - name: Build project + run: poetry build