Skip to content

Commit 2f2634b

Browse files
authored
Merge pull request #1 from sonatype-nexus-community/features/initial-port-of-v1.1-generation-from-jake
Initial port of library code to new library
2 parents 60e975c + bb6bb24 commit 2f2634b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+14546
-26
lines changed

.circleci/config.yml

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,26 @@
1515
version: 2.1
1616

1717
executors:
18-
python:
18+
python36:
19+
docker:
20+
- image: circleci/python:3.6
21+
python37:
1922
docker:
2023
- image: circleci/python:3.7
24+
python38:
25+
docker:
26+
- image: circleci/python:3.8
27+
python39:
28+
docker:
29+
- image: circleci/python:3.9
2130

2231
jobs:
2332
publish:
24-
executor: python
33+
parameters:
34+
executor:
35+
type: executor
36+
default: python39
37+
executor: << parameters.executor >>
2538
environment:
2639
PIPENV_VENV_IN_PROJECT: true
2740
steps:
@@ -39,42 +52,52 @@ jobs:
3952
# TODO: perform publish steps, maybe using python-semantic-release
4053
4154
build:
42-
executor: python
55+
parameters:
56+
executor:
57+
type: executor
58+
default: python39
59+
executor: << parameters.executor >>
4360
environment:
4461
PIPENV_VENV_IN_PROJECT: true
4562
steps:
4663
- checkout
4764
- run:
48-
name: Setup Python environment
65+
name: Install Tox & Coverage
66+
command: |
67+
pip install tox coverage
68+
- run:
69+
name: Run tox
4970
command: |
50-
# TODO: do stuff, like setup .venv, poetry, pip etc.
71+
tox --result-json=.tox/results.json
5172
- run:
52-
name: Run tests
73+
name: Generate Coverage Reports
5374
command: |
54-
# TODO: maybe run pylint and run those tests
75+
coverage report && coverage xml -o test-reports/coverage.xml && coverage html -d test-reports
5576
- run:
5677
name: Run self scan
5778
command: |
5879
# TODO: audit with jake maybe?
59-
- store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
60-
path: test-results
61-
- store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
62-
path: test-results
63-
destination: tr1
80+
- store_artifacts:
81+
path: .tox/results.json
82+
destination: tox-logs
83+
- store_artifacts:
84+
path: test-reports
85+
destination: test-reports
86+
- store_test_results:
87+
path: test-reports
6488

6589
workflows:
6690
version: 2
6791
build_and_test_and_publish:
6892
jobs:
69-
- build
70-
# TODO: enable to publish after successful build
71-
# - publish:
72-
# filters:
73-
# branches:
74-
# only: main
75-
# context: pypi
76-
# requires:
77-
# - build
93+
- build:
94+
executor: python36
95+
- build:
96+
executor: python37
97+
- build:
98+
executor: python38
99+
- build:
100+
executor: python39
78101

79102
build_nightly:
80103
triggers:
@@ -84,4 +107,11 @@ workflows:
84107
branches:
85108
only: main
86109
jobs:
87-
- build
110+
- build:
111+
executor: python36
112+
- build:
113+
executor: python37
114+
- build:
115+
executor: python38
116+
- build:
117+
executor: python39

.github/dependabot.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
3+
version: 2
4+
updates:
5+
- package-ecosystem: 'pip'
6+
directory: '/'
7+
schedule:
8+
interval: 'weekly'
9+
day: 'saturday'
10+
allow:
11+
- dependency-type: 'all'
12+
versioning-strategy: 'auto'
13+
labels: [ 'dependencies' ]
14+
commit-message:
15+
## prefix maximum string length of 15
16+
prefix: 'poetry'
17+
include: 'scope'
18+
open-pull-requests-limit: 999
19+
- package-ecosystem: 'github-actions'
20+
directory: '/'
21+
schedule:
22+
interval: 'weekly'
23+
day: 'saturday'
24+
labels: [ 'dependencies' ]
25+
commit-message:
26+
## prefix maximum string length of 15
27+
prefix: 'gh-actions'
28+
include: 'scope'
29+
open-pull-requests-limit: 999

.github/workflows/poetry.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# For details of what checks are run for PRs please refer below
2+
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
3+
name: Python CI
4+
5+
on:
6+
push:
7+
branches: ["master"]
8+
pull_request:
9+
workflow_dispatch:
10+
schedule:
11+
# schedule weekly tests, since dependencies are not intended to be pinned
12+
# this means: at 23:42 on Fridays
13+
- cron: '42 23 * * 5'
14+
15+
env:
16+
REPORTS_DIR: CI_reports
17+
18+
jobs:
19+
coding-standards:
20+
name: Linting & Coding Standards
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
# see https://github.com/actions/checkout
25+
uses: actions/checkout@v2
26+
- name: Setup Python Environment
27+
# see https://github.com/actions/setup-python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: 3.9
31+
architecture: 'x64'
32+
- name: Install poetry
33+
# see https://github.com/marketplace/actions/setup-poetry
34+
uses: Gr1N/setup-poetry@v7
35+
with:
36+
poetry-version: 1.1.8
37+
- uses: actions/cache@v2
38+
with:
39+
path: ~/.cache/pypoetry/virtualenvs
40+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
41+
- name: Install dependencies
42+
run: poetry install
43+
- name: Run tox
44+
run: poetry run tox -e flake8
45+
46+
build-and-test:
47+
name: Build & Test (Python ${{ matrix.python-version }}
48+
runs-on: ubuntu-latest
49+
env:
50+
REPORTS_ARTIFACT: tests-reports
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
python-version:
55+
- "3.9" # highest supported
56+
- "3.8"
57+
- "3.7"
58+
- "3.6" # lowest supported
59+
timeout-minutes: 30
60+
steps:
61+
- name: Checkout
62+
# see https://github.com/actions/checkout
63+
uses: actions/checkout@v2
64+
- name: Create reports directory
65+
run: mkdir ${{ env.REPORTS_DIR }}
66+
- name: Setup Python Environment
67+
# see https://github.com/actions/setup-python
68+
uses: actions/setup-python@v2
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
architecture: 'x64'
72+
- name: Install poetry
73+
# see https://github.com/marketplace/actions/setup-poetry
74+
uses: Gr1N/setup-poetry@v7
75+
with:
76+
poetry-version: 1.1.8
77+
- uses: actions/cache@v2
78+
with:
79+
path: ~/.cache/pypoetry/virtualenvs
80+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
81+
- name: Install dependencies
82+
run: poetry install
83+
- name: Ensure build successful
84+
run: poetry build
85+
- name: Run tox
86+
run: poetry run tox -e py${{ matrix.python-version }}
87+
- name: Generate coverage reports
88+
run: >
89+
poetry run coverage report &&
90+
poetry run coverage xml -o ${{ env.REPORTS_DIR }}/coverage.xml &&
91+
poetry run coverage html -d ${{ env.REPORTS_DIR }}
92+
- name: Artifact reports
93+
if: ${{ ! cancelled() }}
94+
# see https://github.com/actions/upload-artifact
95+
uses: actions/upload-artifact@v2
96+
with:
97+
name: ${{ env.REPORTS_ARTIFACT }}
98+
path: ${{ env.REPORTS_DIR }}
99+
if-no-files-found: error

.gitignore

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
1+
# Exlude python build & distribution directories
2+
build/
3+
dist/
4+
*.egg-info*
5+
6+
# Exlude *.pyc
7+
*.pyc
8+
9+
# Exclude test-related items
10+
.tox/*
11+
12+
# Exclude coverage
13+
.coverage
14+
test-reports
15+
16+
# Exclude Python Virtual Environment
17+
venv/*
18+
19+
# Exlude IDE related files
20+
.idea/*
21+
.vscode/*
22+
123
# ci config for local ci build
2-
/.circleci/local-config.yml
24+
/.circleci/local-config.yml

MAINFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include README.md
2+
include VERSION
3+
include cyclonedx/schema/*

0 commit comments

Comments
 (0)