From 7801a11d3fc06a0968192cb696d018bcd7105884 Mon Sep 17 00:00:00 2001 From: Daniel Herrmann Date: Wed, 3 Jan 2024 17:17:14 +0100 Subject: [PATCH] build: add github workflows --- .github/workflows/pytest.yml | 23 ++++++++++++++ .github/workflows/python-lint.properties.json | 8 +++++ .github/workflows/python-lint.yml | 20 +++++++++++++ .github/workflows/release.yml | 30 +++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 .github/workflows/pytest.yml create mode 100644 .github/workflows/python-lint.properties.json create mode 100644 .github/workflows/python-lint.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..4598ae9 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,23 @@ +name: PyTest Tests + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install Poetry + uses: abatilo/actions-poetry@v2 + with: + poetry-version: 1.6.1 + - name: Install dependencies + run: poetry install --with dev + - name: Run pytest + run: pytest --junitxml=junit/test-results.xml --cov=easyverein --cov-report=xml --cov-report=html diff --git a/.github/workflows/python-lint.properties.json b/.github/workflows/python-lint.properties.json new file mode 100644 index 0000000..ab00556 --- /dev/null +++ b/.github/workflows/python-lint.properties.json @@ -0,0 +1,8 @@ +{ + "name": "Python Linting", + "description": "Workflow that triggers basic linting tasks for commits in the development branch", + "iconName": "demo-icon", + "categories": [ + "Python" + ] +} diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml new file mode 100644 index 0000000..56e1dcc --- /dev/null +++ b/.github/workflows/python-lint.yml @@ -0,0 +1,20 @@ +name: Lint code + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Run pre-commit + uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8d9bbdc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Package Release +on: + push: + tags: + - "v*.*.*" +jobs: + build-test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + - name: Build and publish to pypi + uses: JRubics/poetry-publish@v1.16 + with: + pypi_token: ${{ secrets.TEST_PYPI_TOKEN }} + repository_name: "python-easyverein" + repository_url: "https://test.pypi.org/legacy/" + python_version: "3.11.6" + poetry_version: "==1.6.1" + release: + runs-on: ubuntu-22.04 + environment: production + steps: + - uses: actions/checkout@v2 + - name: Build and publish to pypi + uses: JRubics/poetry-publish@v1.16 + with: + pypi_token: ${{ secrets.PYPI_TOKEN }} + repository_name: "python-easyverein" + python_version: "3.11.3" + poetry_version: "==1.6.1" \ No newline at end of file