Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/actions/python-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
101 changes: 101 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: moira-build-and-push
on:
workflow_run:
workflows:
- moira-test
types:
- completed
branches:
- 'main'
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_DEPENDENCIES: "build~=0.10.0"
steps:
- uses: actions/checkout@v4
- name: python-build
uses: ./.github/actions/python-build
- name: install-dependencies
run: python3 -m pip install $BUILD_DEPENDENCIES $PUSH_DEPENDENCIES
- name: build
run: |
ls .
python -m build
- name: store-dist
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/moira
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
check-release-exists:
needs:
- publish-to-pypi
runs-on: ubuntu-latest
outputs:
release-exists: ${{ steps.check-release.outputs.release-exists }}
steps:
- uses: actions/checkout@v4
- name: Release Existence Action
id: check-release
uses: insightsengineering/release-existence-action@v1.0.0
with:
release-tag: ${{github.ref_name}}
github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- check-release-exists
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
if: ${{ needs.check-release-exists.outputs.release-exists == 'false' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

67 changes: 50 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,52 @@
name: Python test

on:
push

name: moira-test
on: [push]
env:
TEST_DEPENDENCIES: "tox~=4.15.1"
jobs:
run-tests:
runs-on: ubuntu-22.04
check-project-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python "3.9"
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install dependencies
run: make deps
- name: Test
run: make test
- name: variables
run: |
PROJECT_FILES=(README.md pyproject.toml)
ERROR=0
- name: test
run: |
for file in ${PROJECT_FILES[*]}; do
if ! [ -f $file ]; then
echo "$file not found in project"
ERROR=1
fi
done
exit $ERROR
lint:
runs-on: ubuntu-latest
strategy:
matrix:
linters: [pyproject, lint, format, mypy]
steps:
- uses: actions/checkout@v4
- name: python-build
uses: ./.github/actions/python-build
- name: install-dependencies
run: |
python3 -m pip install --upgrade pip
pip install $TEST_DEPENDENCIES
- name: test
run: tox -e "${{ matrix.linters }}"
test:
runs-on: ubuntu-latest
strategy:
matrix:
minor_versions: [10, 11, 12, 13, 14]
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.${{ matrix.minor_versions }}'
- name: install-dependencies
run: |
python3 -m pip install --upgrade pip
pip install $TEST_DEPENDENCIES
- name: test
run: tox -e "py3${{ matrix.minor_versions }}"
108 changes: 97 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -8,7 +9,6 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -20,9 +20,12 @@ 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
Expand All @@ -37,13 +40,17 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -52,6 +59,8 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -64,29 +73,106 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# IPython Notebook
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version
# IPython
profile_default/
ipython_config.py

# celery beat schedule file
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# dotenv
.env
# SageMath parsed files
*.sage.py

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# IDE
.idea
# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# VS Code
.vscode/
.devcontainer/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# tox envname junit/coverage reports
/.reports
Loading