Skip to content

Commit

Permalink
Used Exasol Python Toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Apr 3, 2024
1 parent 9b7c143 commit d66bbf0
Show file tree
Hide file tree
Showing 16 changed files with 2,163 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build & Publish

on:
workflow_call:
secrets:
PYPI_TOKEN:
required: true

jobs:

cd-job:
name: Continues Delivery
runs-on: ubuntu-latest
steps:

- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]

- name: Build Artifacts
run: poetry build

- name: PyPi Release
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__"
POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}"
run: poetry publish

- name: GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create ${GITHUB_REF_NAME}
--title ${GITHUB_REF_NAME}
dist/*
21 changes: 21 additions & 0 deletions .github/workflows/check-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Release Tag

on: workflow_call

jobs:

check-tag-version-job:

name: Check Tag Version
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]

- name: Check Tag Version
# make sure the pushed/created tag matched the project version
run: "[[ `poetry version --short` == ${{ github.ref_name }} ]]"
101 changes: 101 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Checks

on: workflow_call

jobs:

version-check-job:
name: Version Check
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]

- name: Check Version(s)
run: poetry run version-check exasol/toolbox/version.py

build-documentation-job:
name: Build Documentation
needs: [version-check-job]
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]

- name: Build Documentation
run: |
poetry run python -m nox -s build-docs
lint-job:
name: Linting (Python-${{ matrix.python-version }})
needs: [version-check-job]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Run Tests
run: poetry run nox -s lint

type-check-job:
name: Type Checking (Python-${{ matrix.python-version }})
needs: [version-check-job]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Run Tests
run: poetry run nox -s type-check

tests-job:
name: Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}})
needs: [build-documentation-job, lint-job, type-check-job]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
exasol-version: ["7.1.9"]

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Run Tests
run: poetry run nox -s coverage -- -- --db-version ${{ matrix.exasol-version }}
28 changes: 28 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI/CD

on:
push:
tags:
- '**'

jobs:

check-tag-version-job:
name: Check Release Tag
uses: exasol/python-toolbox/.github/workflows/[email protected]

ci-job:
name: Checks
needs: [ check-tag-version-job ]
uses: exasol/python-toolbox/.github/workflows/[email protected]

cd-job:
name: Continues Delivery
needs: [ ci-job ]
uses: exasol/python-toolbox/.github/workflows/[email protected]
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

metrics:
needs: [ ci-job ]
uses: exasol/python-toolbox/.github/workflows/[email protected]
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches-ignore:
- "github-pages/*"
- "gh-pages/*"
- "main"
- "master"
pull_request:
types: [opened, reopened]
schedule:
# “At 00:00 on every 7th day-of-month from 1 through 31.” (https://crontab.guru)
- cron: "0 0 1/7 * *"

jobs:

ci-job:
name: Checks
uses: exasol/python-toolbox/.github/workflows/[email protected]

metrics:
needs: [ ci-job ]
uses: exasol/python-toolbox/.github/workflows/[email protected]
27 changes: 27 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Documentation

on: workflow_call

jobs:

documentation-job:
runs-on: ubuntu-latest

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]

- name: Build Documentation
run: |
poetry run python -m nox -s build-docs
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: .html-documentation
git-config-name: Github Action
git-config-email: [email protected]
21 changes: 21 additions & 0 deletions .github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: PR-Merge

on:
push:
branches:
- 'main'
- 'master'

jobs:

ci-job:
name: Checks
uses: exasol/python-toolbox/.github/workflows/[email protected]

publish-docs:
name: Publish Documentation
uses: exasol/python-toolbox/.github/workflows/[email protected]

metrics:
needs: [ ci-job ]
uses: exasol/python-toolbox/.github/workflows/[email protected]
53 changes: 53 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Status Report

on:
workflow_call:
secrets:
ALTERNATIVE_GITHUB_TOKEN:
required: false

jobs:

report:
name: Generate Status Report
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.ALTERNATIVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

steps:
- name: SCM Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]

- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts

- name: Copy Artifacts into Root Folder
working-directory: ./artifacts
run: |
cp .coverage/.coverage ../
cp .lint.txt/.lint.txt ../
- name: Generate Report
run: poetry run nox -s report -- -- --format json | tee metrics.json

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: metrics.json
path: metrics.json

- name: Generate GitHub Summary
run: |
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
poetry run nox -s report -- -- --format markdown >> $GITHUB_STEP_SUMMARY
echo -e "\n\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
poetry run coverage report -- --format markdown >> $GITHUB_STEP_SUMMARY
echo -e "\n\n# Static Code Analysis\n" >> $GITHUB_STEP_SUMMARY
cat .lint.txt >> $GITHUB_STEP_SUMMARY
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.html-documentation
/__pycache__
3 changes: 3 additions & 0 deletions error_code_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
error-tags:
SAPIPY:
highest-index: 0
Empty file added exasol/saas/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions noxconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from dataclasses import dataclass
from pathlib import Path
from typing import Iterable

ROOT_DIR = Path(__file__).parent


@dataclass(frozen=True)
class Config:
root: Path = ROOT_DIR
doc: Path = ROOT_DIR / "doc"
version_file: Path = ROOT_DIR / "version.py"
path_filters: Iterable[str] = ("dist", ".eggs", "venv")


PROJECT_CONFIG = Config()
7 changes: 7 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import nox

# imports all nox task provided by the toolbox
from exasol.toolbox.nox.tasks import *

# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = ["fix"]
Loading

0 comments on commit d66bbf0

Please sign in to comment.