Skip to content

Commit

Permalink
Merge pull request #1 from sonatype-nexus-community/features/initial-…
Browse files Browse the repository at this point in the history
…port-of-v1.1-generation-from-jake

Initial port of library code to new library
  • Loading branch information
madpah authored Sep 6, 2021
2 parents 60e975c + bb6bb24 commit 2f2634b
Show file tree
Hide file tree
Showing 59 changed files with 14,546 additions and 26 deletions.
74 changes: 52 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,26 @@
version: 2.1

executors:
python:
python36:
docker:
- image: circleci/python:3.6
python37:
docker:
- image: circleci/python:3.7
python38:
docker:
- image: circleci/python:3.8
python39:
docker:
- image: circleci/python:3.9

jobs:
publish:
executor: python
parameters:
executor:
type: executor
default: python39
executor: << parameters.executor >>
environment:
PIPENV_VENV_IN_PROJECT: true
steps:
Expand All @@ -39,42 +52,52 @@ jobs:
# TODO: perform publish steps, maybe using python-semantic-release
build:
executor: python
parameters:
executor:
type: executor
default: python39
executor: << parameters.executor >>
environment:
PIPENV_VENV_IN_PROJECT: true
steps:
- checkout
- run:
name: Setup Python environment
name: Install Tox & Coverage
command: |
pip install tox coverage
- run:
name: Run tox
command: |
# TODO: do stuff, like setup .venv, poetry, pip etc.
tox --result-json=.tox/results.json
- run:
name: Run tests
name: Generate Coverage Reports
command: |
# TODO: maybe run pylint and run those tests
coverage report && coverage xml -o test-reports/coverage.xml && coverage html -d test-reports
- run:
name: Run self scan
command: |
# TODO: audit with jake maybe?
- store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: test-results
- store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: test-results
destination: tr1
- store_artifacts:
path: .tox/results.json
destination: tox-logs
- store_artifacts:
path: test-reports
destination: test-reports
- store_test_results:
path: test-reports

workflows:
version: 2
build_and_test_and_publish:
jobs:
- build
# TODO: enable to publish after successful build
# - publish:
# filters:
# branches:
# only: main
# context: pypi
# requires:
# - build
- build:
executor: python36
- build:
executor: python37
- build:
executor: python38
- build:
executor: python39

build_nightly:
triggers:
Expand All @@ -84,4 +107,11 @@ workflows:
branches:
only: main
jobs:
- build
- build:
executor: python36
- build:
executor: python37
- build:
executor: python38
- build:
executor: python39
29 changes: 29 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'pip'
directory: '/'
schedule:
interval: 'weekly'
day: 'saturday'
allow:
- dependency-type: 'all'
versioning-strategy: 'auto'
labels: [ 'dependencies' ]
commit-message:
## prefix maximum string length of 15
prefix: 'poetry'
include: 'scope'
open-pull-requests-limit: 999
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
day: 'saturday'
labels: [ 'dependencies' ]
commit-message:
## prefix maximum string length of 15
prefix: 'gh-actions'
include: 'scope'
open-pull-requests-limit: 999
99 changes: 99 additions & 0 deletions .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# For details of what checks are run for PRs please refer below
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Python CI

on:
push:
branches: ["master"]
pull_request:
workflow_dispatch:
schedule:
# schedule weekly tests, since dependencies are not intended to be pinned
# this means: at 23:42 on Fridays
- cron: '42 23 * * 5'

env:
REPORTS_DIR: CI_reports

jobs:
coding-standards:
name: Linting & Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v2
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: 'x64'
- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.8
- uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: poetry install
- name: Run tox
run: poetry run tox -e flake8

build-and-test:
name: Build & Test (Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
env:
REPORTS_ARTIFACT: tests-reports
strategy:
fail-fast: false
matrix:
python-version:
- "3.9" # highest supported
- "3.8"
- "3.7"
- "3.6" # lowest supported
timeout-minutes: 30
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v2
- name: Create reports directory
run: mkdir ${{ env.REPORTS_DIR }}
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.8
- uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: poetry install
- name: Ensure build successful
run: poetry build
- name: Run tox
run: poetry run tox -e py${{ matrix.python-version }}
- name: Generate coverage reports
run: >
poetry run coverage report &&
poetry run coverage xml -o ${{ env.REPORTS_DIR }}/coverage.xml &&
poetry run coverage html -d ${{ env.REPORTS_DIR }}
- name: Artifact reports
if: ${{ ! cancelled() }}
# see https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.REPORTS_ARTIFACT }}
path: ${{ env.REPORTS_DIR }}
if-no-files-found: error
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# Exlude python build & distribution directories
build/
dist/
*.egg-info*

# Exlude *.pyc
*.pyc

# Exclude test-related items
.tox/*

# Exclude coverage
.coverage
test-reports

# Exclude Python Virtual Environment
venv/*

# Exlude IDE related files
.idea/*
.vscode/*

# ci config for local ci build
/.circleci/local-config.yml
/.circleci/local-config.yml
3 changes: 3 additions & 0 deletions MAINFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include README.md
include VERSION
include cyclonedx/schema/*
Loading

0 comments on commit 2f2634b

Please sign in to comment.