Skip to content

Commit

Permalink
Merge pull request #16 from canonical/KF-5170-setup-repo-for-librarry
Browse files Browse the repository at this point in the history
Initial repository structure
  • Loading branch information
misohu authored Jan 22, 2024
2 parents cc01363 + 682d89f commit b8c1e8a
Show file tree
Hide file tree
Showing 18 changed files with 711 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/gh-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "tagged-release"

on:
push:
tags:
- "*"

jobs:
tests:
name: Run Tests
uses: ./.github/workflows/tests.yaml

tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-22.04"
needs: tests

steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Validate version in tag
# check that version matches Semantic Versioning
run: |
if ! [[ ${{ github.ref_name }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$|^[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+$ ]]
then
echo "Tag has incorrect format. Valid formats are X.X.X or X.X.X.devX where X is any digit"
exit 1
fi
- name: Check tag and PyPi version
# Compare version of the tag with the latest PyPi published version
run: |
packages=$(pip index versions data-science-stack)
latest=$(echo $packages| grep -oP '(?<=\().+?(?=\))')
dpkg --compare-versions ${{ github.ref_name }} gt $latest
if [ $? -ne 0 ]; then
echo "Version in git tag must be greater than already published"
exit $?
fi
- name: Compare git tag and version in setup.cfg
run: |
versionInFile=$(grep "^version = " setup.cfg | cut -d "=" -f 2 | tr -d '[:space:]')
if [ $versionInFile != ${{ github.ref_name }} ]; then
echo "Version in file does not match version in git tag"
exit 1
fi
- name: Build package
run: python -m build

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
files: |
dist/*
12 changes: 12 additions & 0 deletions .github/workflows/on_pull_request_or_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: On Pull Request

on:
push:
branches:
- main
pull_request:

jobs:
tests:
name: Run Tests
uses: ./.github/workflows/tests.yaml
28 changes: 28 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Upload Python Package

on:
release:
types: [released]

jobs:
deploy:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.GITHUB_SHA }}

- 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/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Tests

on:
workflow_call:

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: python3 -m pip install tox
- name: Run linters
run: tox -e lint
unit-test:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: python -m pip install tox
- name: Run tests
run: tox -e unit
155 changes: 155 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Modified from by https://www.toptal.com/developers/gitignore/api/python

logs/

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# End of https://www.toptal.com/developers/gitignore/api/python

# Jetbrains (pycharm, etc): https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @canonical/kubeflow
Loading

0 comments on commit b8c1e8a

Please sign in to comment.