Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeodor committed May 3, 2024
0 parents commit 3b1637d
Show file tree
Hide file tree
Showing 245 changed files with 37,496 additions and 0 deletions.
191 changes: 191 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: cicd

env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

on:
push:
paths:
- "python/**"
- "cli/**"
- ".github/workflows/cicd.yml"

permissions:
id-token: write
contents: write

jobs:
lint-sdk:
name: Lint python SDK
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install .[dev]
- run: python -m ruff check ./python
- run: python -m mypy --strict ./python
test-sdk:
name: Unit test python SDK
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -e .[dev]
- run: coverage run -m pytest -vv ./python/tests/
- run: coverage report | grep 'TOTAL' | awk '{print "COVERAGE_PCT=" $4}' >> $GITHUB_ENV
- name: Publish SDK test coverage
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_ACCESS_TOKEN }}
gistID: a9b9bfdfa0620696fba9e76223790f53
filename: sdk-coverage.json
label: SDK coverage
message: ${{ env.COVERAGE_PCT }}
minColorRange: 50
maxColorRange: 80
valColorRange: ${{ env.COVERAGE_PCT }}
build:
timeout-minutes: 15
runs-on: ubuntu-latest
name: Build package
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- run: python3 -m pip install build>=1.2.1
- run: make package
- uses: actions/upload-artifact@v4
with:
name: package
path: ./dist/*
test-cli-windows:
name: Test CLI on windows
needs:
- build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- uses: actions/download-artifact@v4
id: download
with:
name: package
path: ./dist
- run: cmd /r dir /b /a-d dist > files.txt
- run: |
$files = Get-Content files.txt
foreach ($file in $files) {
pip install dist/$file
}
- run: numerous --help
lint-cli:
name: Lint CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- name: Lint (golangci-lint)
uses: golangci/golangci-lint-action@v4
with:
version: v1.56.2
working-directory: cli
args: --config=../.golangci.yml --verbose
- name: Install gofumpt
shell: bash
run: |
wget https://github.com/mvdan/gofumpt/releases/download/v0.6.0/gofumpt_v0.6.0_linux_amd64
mv gofumpt_v0.6.0_linux_amd64 gofumpt
chmod +x gofumpt
mv gofumpt /usr/local/bin
- name: Check gofumpt formatting
shell: bash
run: |
unformatted_files=$(gofumpt -l .)
if [[ "$unformatted_files" != "" ]]; then
echo "Some files do not adhere to gofumpt formatting:"
echo "$unformatted_files"
exit 1
fi
test-cli:
name: Unit test CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- name: Tests
working-directory: cli
run: go test -coverprofile=c.out ./...
- name: Extract Test Coverage Percentage
working-directory: cli
run: go tool cover -func c.out | fgrep total | awk '{print "COVERAGE_PCT=" $3}' >> $GITHUB_ENV
- name: Publish Test Coverage
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_ACCESS_TOKEN }}
gistID: a9b9bfdfa0620696fba9e76223790f53
filename: cli-coverage.json
label: CLI coverage
message: ${{ env.COVERAGE_PCT }}
minColorRange: 50
maxColorRange: 80
valColorRange: ${{ env.COVERAGE_PCT }}
release:
timeout-minutes: 15
runs-on: ubuntu-latest
name: Release
needs:
- lint-cli
- test-cli
- test-sdk
- lint-sdk
- build
- test-cli-windows
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- uses: actions/download-artifact@v4
id: download
with:
name: package
path: ./dist
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- run: pip install python-semantic-release==9.6.0 twine==5.0.0
- run: semantic-release version --commit --tag --push
- run: semantic-release publish
- run: twine upload --non-interactive dist/*
178 changes: 178 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# 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
cli/build/

# 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/
lcov.info


# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# 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

# SageMath parsed files
*.sage.py

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# 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/

# Editor specific files
.vscode

# Makefile rules
.lint-*.txt

# Autogenerated documentation sources
docs/source/api

# CLI codebase
cli/build
!cli/internal/gql/build
cli/cli.db
cli/c.out
27 changes: 27 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# https://golangci-lint.run/usage/configuration/
run:
timeout: 5m

linters-settings:
nlreturn:
block-size: 2
testifylint:
disable:
- require-error

linters:
enable:
- gocritic
- gomnd
- misspell
- nlreturn
- perfsprint
- predeclared
- stylecheck
- testifylint
- thelper
- usestdlibvars
- whitespace

issues:
max-same-issues: 10
Loading

0 comments on commit 3b1637d

Please sign in to comment.