Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to latest version of PTB and created workflow files #10

Merged
merged 21 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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}
--notes-file doc/changes/changes_${GITHUB_REF_NAME}.md
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 }} ]]"
113 changes: 113 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
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 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.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 Linter
run: poetry run nox -s lint

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .lint.txt
path: .lint.txt

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.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 Type check
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.9"]
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: Calculate Test Coverage
run: poetry run nox -s coverage -- -- --db-version ${{ matrix.exasol-version }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .coverage
path: .coverage
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: ./.github/workflows/check-release-tag.yml

ci-job:
name: Checks
needs: [ check-tag-version-job ]
uses: ./.github/workflows/checks.yml

cd-job:
name: Continuous Delivery
needs: [ ci-job ]
uses: ./.github/workflows/build-and-publish.yml
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

metrics:
needs: [ ci-job ]
uses: ./.github/workflows/report.yml
39 changes: 14 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,22 @@ name: CI
on:
push:
branches-ignore:
- "github-pages/*"
- "gh-pages/*"
ckunki marked this conversation as resolved.
Show resolved Hide resolved
- "main"
- "master"
ckunki marked this conversation as resolved.
Show resolved Hide resolved
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:
tests-job:
name: Tests (Python-${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v2
- name: Install Poetry
run: |
pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache-dependency-path: poetry.lock
- uses: abatilo/[email protected]
with:
poetry-version: 1.2.2
ci-job:
name: Checks
uses: ./.github/workflows/checks.yml

- name: Install Project
run: poetry install

- name: Run Tests
run: poetry run pytest tests
metrics:
needs: [ ci-job ]
uses: ./.github/workflows/report.yml
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: ./.github/workflows/checks.yml

publish-docs:
name: Publish Documentation
uses: ./.github/workflows/gh-pages.yml

metrics:
needs: [ ci-job ]
uses: ./.github/workflows/report.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
dist
__pycache__/
/TAGS
/.coverage
/.lint.json
/.lint.txt
/.html-documentation/
File renamed without changes.
1 change: 1 addition & 0 deletions doc/changes/changes_0.0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ This release adds the initial implementation of the secret store
* #4: Added python toolbox
* #7: Refactored secret store to store simple key/value pairs
* #5: Added test case to verify that plain access to secret store fails
* #8: Updated exasol python toolbox to version 0.5.0
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading