Skip to content

Commit 49271ed

Browse files
authored
Merge pull request #51 from phoenixnap/release/v2.0.0
Release/v2.0.0
2 parents 9303080 + e9e7f62 commit 49271ed

File tree

612 files changed

+50897
-68845
lines changed

Some content is hidden

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

612 files changed

+50897
-68845
lines changed

.github/workflows/_common.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ jobs:
2020
with:
2121
package-name: ${{ inputs.package-name }}
2222
test:
23-
name: Test ${{ inputs.package-name }}
23+
name: Test ${{ inputs.package-name }} py v ${{ matrix.python-version }}
2424
runs-on: ubuntu-20.04
2525
needs:
2626
- lint
2727
services:
2828
mockserver:
29-
image: mockserver/mockserver:5.13.0
29+
image: mockserver/mockserver:5.15.0
3030
ports:
3131
- 1080:1080
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
python-version: [ '3.6', '3.11' ]
35+
python-version: [ '3.7', '3.12' ]
3636
steps:
3737
- uses: actions/checkout@v3
3838
- uses: ./.github/workflows/composite/test-sdk
@@ -41,4 +41,4 @@ jobs:
4141
test-dir: tests
4242
test-file: ${{ inputs.test-file }}
4343
test-report-dir: tests/test-reports
44-
python-version: ${{ matrix.python-version }}
44+
python-version: ${{ matrix.python-version }}

.github/workflows/_publish_all.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,26 @@ jobs:
101101
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
102102
with:
103103
dry_run: ${{ inputs.dry_run }}
104-
package_to_publish: pnap_location_api
104+
package_to_publish: pnap_location_api
105+
106+
publish-payments-api:
107+
name: Publish Payments API
108+
needs:
109+
- validate-all
110+
uses: ./.github/workflows/_publish.yml
111+
secrets:
112+
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
113+
with:
114+
dry_run: ${{ inputs.dry_run }}
115+
package_to_publish: pnap_payments_api
116+
117+
publish-invoicing-api:
118+
name: Publish Invoicing API
119+
needs:
120+
- validate-all
121+
uses: ./.github/workflows/_publish.yml
122+
secrets:
123+
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
124+
with:
125+
dry_run: ${{ inputs.dry_run }}
126+
package_to_publish: pnap_invoicing_api

.github/workflows/composite/generate-sdk/action.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,34 @@ runs:
2020
- name: Install openapi-generator-cli
2121
shell: bash
2222
run: npm install -g @openapitools/openapi-generator-cli
23+
- name: Cleanup existing files
24+
shell: bash
25+
run: |
26+
echo "Moving version.py file out..."
27+
mv ./${{ inputs.package-name }}/${{ inputs.package-name }}/version.py ./version.py
28+
29+
echo "Cleaning up ${{ inputs.package-name }}..."
30+
rm -rf ./${{ inputs.package-name }}/*
31+
32+
echo "Re-creating folder inside ${{ inputs.package-name }}..."
33+
mkdir ./${{ inputs.package-name }}/${{ inputs.package-name }}
34+
35+
echo "Moving version.py file back in..."
36+
mv ./version.py ./${{ inputs.package-name }}/${{ inputs.package-name }}/version.py
2337
- name: Download spec files
2438
shell: bash
2539
run: wget ${{ inputs.spec-link }} -O ./${{ inputs.package-name }}/${{ inputs.package-name }}.spec.yaml
2640
- name: Generate API
2741
shell: bash
28-
run: openapi-generator-cli generate -i ${{ inputs.spec-link }} -c openapi-generator-config.yaml -o=${{ inputs.package-name }} --additional-properties packageName=${{ inputs.package-name }}
42+
run: |
43+
version=$(./extract-version.sh ./${{ inputs.package-name }}/${{ inputs.package-name }}/version.py)
44+
45+
openapi-generator-cli generate \
46+
-i ${{ inputs.spec-link }} \
47+
-c openapi-generator-config.yaml \
48+
-o=${{ inputs.package-name }} \
49+
--additional-properties packageName=${{ inputs.package-name }} \
50+
--additional-properties packageVersion=$version
2951
- name: Upload Artifacts
3052
uses: actions/upload-artifact@v3
3153
with:

.github/workflows/composite/setup-python/action.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ inputs:
44
python-version:
55
description: 'Version of Python to setup.'
66
required: false
7-
default: '3.6'
7+
default: '3.7'
88
runs:
99
using: "composite"
1010
steps:
1111
- name: Setup Python
1212
uses: actions/setup-python@v4
1313
with:
14-
python-version: ${{ inputs.python-version }}
15-
16-
# Suggested by https://stackoverflow.com/a/70431656 - script will complete the setup for pip, since it's incomplete for some versions.
17-
- name: Fix PIP (for non-3.6 python)
18-
if: inputs.python-version != 3.6
19-
shell: bash
20-
run: curl -sS https://bootstrap.pypa.io/get-pip.py | python${{ inputs.python-version }}
14+
python-version: ${{ inputs.python-version }}

.github/workflows/generate-all.yml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,19 @@ jobs:
7070
with:
7171
spec-link: https://developers.phoenixnap.com/portals/api/sites/phoenixnap-prod-developerportal/liveportal/apis/bmc-location/download_spec
7272
package-name: pnap_location_api
73-
73+
generate-invoicingapi:
74+
needs: prerequisite
75+
uses: ./.github/workflows/_generate.yml
76+
with:
77+
spec-link: https://developers.phoenixnap.com/portals/api/sites/phoenixnap-prod-developerportal/liveportal/apis/invoicing/download_spec
78+
package-name: pnap_invoicing_api
79+
generate-paymentsapi:
80+
needs: prerequisite
81+
uses: ./.github/workflows/_generate.yml
82+
with:
83+
spec-link: https://developers.phoenixnap.com/portals/api/sites/phoenixnap-prod-developerportal/liveportal/apis/payments/download_spec
84+
package-name: pnap_payments_api
85+
7486
# Push generated code
7587
push-changes:
7688
name: Push Changes
@@ -84,23 +96,52 @@ jobs:
8496
- generate-tagapi
8597
- generate-networkstorageapi
8698
- generate-locationapi
99+
- generate-invoicingapi
100+
- generate-paymentsapi
101+
outputs:
102+
CHANGES_FOUND: ${{ steps.commit-step.outputs.CHANGES_FOUND }}
87103
steps:
88104
- name: Check out the repo
89105
uses: actions/checkout@v3
106+
- name: Clean up modules
107+
run: |
108+
rm -rf ./pnap_audit_api \
109+
./pnap_bmc_api \
110+
./pnap_ip_api \
111+
./pnap_location_api \
112+
./pnap_network_api \
113+
./pnap_network_storage_api \
114+
./pnap_rancher_solution_api \
115+
./pnap_tag_api \
116+
./pnap_payment_api \
117+
./pnap_invoice_api
90118
- name: Download Artifacts
91119
uses: actions/download-artifact@v3
92120
- name: Move spec files
93121
run: |
94122
find . -type f -name "*.spec.yaml" -not -path "./specs/*" -print0 | xargs -0 mv -ft ./specs/
95-
- name: Add and Commit files
123+
- id: commit-step
124+
name: Add and Commit files
96125
run: |
97126
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
98127
git config --local user.name "github-actions[bot]"
99128
git add -A
100129
101-
if test "$(git status --porcelain=v1 2>/dev/null | wc -l)" -gt "0" ; then git commit -m "Add changes"; else echo No changes found; fi
130+
if test "$(git status --porcelain=v1 2>/dev/null | wc -l)" -gt "0" ;
131+
then
132+
git commit -m "Add changes";
133+
echo "CHANGES_FOUND=true" >> "$GITHUB_OUTPUT";
134+
else
135+
echo No changes found;
136+
fi
102137
- name: Push changes
103138
uses: ad-m/github-push-action@master
104139
with:
105140
github_token: ${{ secrets.GITHUB_TOKEN }}
106-
branch: ${{ github.ref }}
141+
branch: ${{ github.ref }}
142+
143+
validate-all:
144+
if: ${{ needs.push-changes.outputs.CHANGES_FOUND }}
145+
needs:
146+
- push-changes
147+
uses: ./.github/workflows/validate-all.yml

.github/workflows/validate-all.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ jobs:
4747
with:
4848
package-name: pnap_location_api
4949
test-file: pnap_location_api_test.py
50+
build-and-test-invoicingapi:
51+
uses: ./.github/workflows/_common.yml
52+
with:
53+
package-name: pnap_invoicing_api
54+
test-file: pnap_invoicing_api_test.py
55+
build-and-test-paymentsapi:
56+
uses: ./.github/workflows/_common.yml
57+
with:
58+
package-name: pnap_payments_api
59+
test-file: pnap_payments_api_test.py
5060

5161
publish-test-results:
5262
name: Publish Test Results
@@ -59,6 +69,8 @@ jobs:
5969
- build-and-test-tagapi
6070
- build-and-test-networkstorageapi
6171
- build-and-test-locationapi
72+
- build-and-test-invoicingapi
73+
- build-and-test-paymentsapi
6274
runs-on: ubuntu-20.04
6375
if: always()
6476
steps:

extract-version.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
filename="$1"
4+
5+
# Define the regex pattern
6+
regex='VERSION = "(.*)"'
7+
8+
# Read the contents of the file
9+
contents="$(cat $filename)"
10+
11+
# Check if the contents match the regex
12+
if [[ $contents =~ $regex ]]; then
13+
# Print the matched version
14+
echo "${BASH_REMATCH[1]}"
15+
else
16+
# Print an error message and exit with an error code
17+
echo "Couldn't find a match for ($regex) in $filename."
18+
exit 1
19+
fi

openapitools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
33
"spaces": 2,
44
"generator-cli": {
5-
"version": "6.1.0"
5+
"version": "7.2.0"
66
}
77
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5+
6+
name: pnap_audit_api Python package
7+
8+
on: [push, pull_request]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install flake8 pytest
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
- name: Test with pytest
37+
run: |
38+
pytest
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.github/workflows/python.yml
12
README.md
23
docs/Error.md
34
docs/Event.md
@@ -7,15 +8,15 @@ pnap_audit_api/__init__.py
78
pnap_audit_api/api/__init__.py
89
pnap_audit_api/api/events_api.py
910
pnap_audit_api/api_client.py
10-
pnap_audit_api/apis/__init__.py
11+
pnap_audit_api/api_response.py
1112
pnap_audit_api/configuration.py
1213
pnap_audit_api/exceptions.py
13-
pnap_audit_api/model/__init__.py
14-
pnap_audit_api/model/error.py
15-
pnap_audit_api/model/event.py
16-
pnap_audit_api/model/user_info.py
17-
pnap_audit_api/model_utils.py
1814
pnap_audit_api/models/__init__.py
15+
pnap_audit_api/models/error.py
16+
pnap_audit_api/models/event.py
17+
pnap_audit_api/models/user_info.py
18+
pnap_audit_api/py.typed
1919
pnap_audit_api/rest.py
20+
pyproject.toml
2021
requirements.txt
2122
setup.py

0 commit comments

Comments
 (0)