Skip to content

Commit a79b5cc

Browse files
committed
ckanext-pycharm-debugger initial commit
0 parents  commit a79b5cc

23 files changed

+1704
-0
lines changed

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[report]
2+
omit =
3+
*/site-packages/*
4+
*/python?.?/*
5+
ckan/*

.flake8

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[flake8]
2+
# @see https://flake8.pycqa.org/en/latest/user/configuration.html?highlight=.flake8
3+
4+
exclude =
5+
ckan
6+
build
7+
node_modules
8+
9+
# Extended output format.
10+
format = pylint
11+
12+
# Show the source of errors.
13+
show_source = True
14+
statistics = True
15+
count = True
16+
17+
max-complexity = 10
18+
max-line-length = 127
19+
20+
# List ignore rules one per line.
21+
ignore =
22+
C901
23+
E501
24+
W503

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
registries:
3+
python-index-pypi-org:
4+
type: python-index
5+
url: https://pypi.org/
6+
replaces-base: true
7+
username: "${{secrets.PYTHON_INDEX_PYPI_ORG_USERNAME}}"
8+
password: "${{secrets.PYTHON_INDEX_PYPI_ORG_PASSWORD}}"
9+
10+
updates:
11+
- package-ecosystem: pip
12+
directory: "/"
13+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#insecure-external-code-execution
14+
# PIP needs this flag.
15+
insecure-external-code-execution: allow
16+
schedule:
17+
interval: daily
18+
# time: "08:00"
19+
# timezone: "Australia/Brisbane"
20+
open-pull-requests-limit: 10
21+
registries:
22+
- python-index-pypi-org

.github/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .github/release.yml
2+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
3+
# https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels
4+
5+
changelog:
6+
categories:
7+
- title: Breaking Changes 🛠
8+
labels:
9+
- Semver-Major
10+
- breaking-change
11+
12+
- title: 🏕 Features
13+
labels:
14+
- '*'
15+
exclude:
16+
labels:
17+
- dependencies
18+
- bug
19+
- Semver-Major
20+
- breaking-change
21+
authors:
22+
- dependabot[bot]
23+
24+
- title: 🐛 Bug Fixes
25+
labels:
26+
- bug
27+
28+
- title: 👒 Dependencies
29+
labels:
30+
- dependencies
31+
authors:
32+
- dependabot[bot]

.github/workflows/flake8.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
on:
3+
# pull_request:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.10'
18+
- name: Install requirements
19+
run: pip install flake8 pycodestyle flake8-logging-format
20+
- name: Check syntax
21+
# Stop the build if there are Python syntax errors or undefined names
22+
run: flake8 --count --statistics --show-source

.github/workflows/publish.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
name: Publish to pypi
3+
on:
4+
push:
5+
#On versioned releases
6+
tags:
7+
- '*.*.*'
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
inputs:
11+
force:
12+
type: choice
13+
description: Retry Publish Version
14+
options:
15+
- No
16+
- Yes
17+
environment:
18+
description: 'Deployment environment'
19+
required: true
20+
default: 'pypi'
21+
type: choice
22+
options:
23+
- pypi
24+
- testpypi
25+
dryRun:
26+
description: 'Dry Run deployment (set to false to deploy)'
27+
required: true
28+
type: boolean
29+
default: true
30+
31+
32+
33+
jobs:
34+
35+
validateVersion:
36+
runs-on: ubuntu-latest
37+
if: github.repository == 'duttonw/ckanext-pycharm-debugger'
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.10'
44+
45+
- name: Validate tag version
46+
if: ${{ startsWith(github.ref, 'refs/tags') }}
47+
run: |
48+
TAG_VALUE=${GITHUB_REF/refs\/tags\//}
49+
PYTHON_VERSION=$(grep -E '\bversion\s?=\s?"[^"]+"' pyproject.toml | awk -F '"' '{print $2}')
50+
echo "Tag version is [$TAG_VALUE], Python version is [$PYTHON_VERSION]"
51+
if [ "$TAG_VALUE" != "$PYTHON_VERSION" ]; then
52+
echo "Version mismatch; tag version is [$TAG_VALUE] but Python version is [$PYTHON_VERSION]" >> $GITHUB_STEP_SUMMARY
53+
exit 1
54+
fi
55+
56+
test:
57+
needs: validateVersion
58+
name: Test
59+
uses: ./.github/workflows/test.yml # Call the reusable workflow
60+
61+
publishSkipped:
62+
if: github.repository != 'duttonw/ckanext-pycharm-debugger'
63+
runs-on: ubuntu-latest
64+
steps:
65+
- run: |
66+
echo "## Skipping PyPI publish on downstream repository" >> $GITHUB_STEP_SUMMARY
67+
68+
publish:
69+
needs: test
70+
permissions:
71+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
72+
name: Publish Package
73+
runs-on: ubuntu-latest
74+
environment:
75+
name: ${{ github.event.inputs.environment || 'pypi' }}
76+
url: ${{ steps.version.outputs.url }}
77+
concurrency:
78+
group: ${{ github.event.inputs.environment }}-deployment
79+
cancel-in-progress: false
80+
env:
81+
ENVIRONMENT: ${{ github.event.inputs.environment || 'pypi' }}
82+
steps:
83+
- name: Get Git Tag and set url from environment
84+
id: version
85+
run: |
86+
#!/bin/bash
87+
88+
TAG_VALUE=${GITHUB_REF/refs\/tags\//}
89+
echo "version=${TAG_VALUE}" >> $GITHUB_OUTPUT
90+
91+
# Extract the repository name (minus the owner/org)
92+
reponame=$(basename $GITHUB_REPOSITORY)
93+
echo "reponame=${reponame}" >> $GITHUB_OUTPUT
94+
95+
if [ "$env.ENVIRONMENT" == "testpypi" ]; then
96+
url="https://test.pypi.org/project/$reponame/$TAG_VALUE/"
97+
echo "environment=${env.ENVIRONMENT}" >> $GITHUB_OUTPUT
98+
else
99+
url="https://pypi.org/project/$reponame/$TAG_VALUE/"
100+
echo "environment=pypi" >> $GITHUB_OUTPUT
101+
fi
102+
103+
echo "url=${url}" >> $GITHUB_OUTPUT
104+
105+
- name: Checkout repository
106+
uses: actions/checkout@v4
107+
108+
- name: Build package ${{ steps.version.outputs.reponame }} @ ${{ steps.version.outputs.version }}
109+
run: |
110+
pip install build
111+
pip install twine
112+
python -m build
113+
- name: Publish package distributions to PyPI
114+
if: ${{ startsWith(github.ref, 'refs/tags') && steps.version.outputs.environment == 'pypi' && github.event.inputs.dryRun != 'true' }}
115+
uses: pypa/gh-action-pypi-publish@release/v1
116+
# with:
117+
# skip-existing: true
118+
# verbose: true
119+
# print-hash: true
120+
- name: Test Publish package distributions to PyPI
121+
if: ${{ startsWith(github.ref, 'refs/tags') && steps.version.outputs.environment == 'testpypi' && github.event.inputs.dryRun == 'true' }}
122+
uses: pypa/gh-action-pypi-publish@release/v1
123+
with:
124+
repository-url: https://test.pypi.org/legacy/
125+
# skip-existing: true
126+
# verbose: true
127+
# print-hash: true
128+
- name: Summary output
129+
if: ${{ startsWith(github.ref, 'refs/tags') && github.event.inputs.dryRun != 'true' }}
130+
run:
131+
echo "Published ${{ steps.version.outputs.repo_name }} @ ${{ steps.version.outputs.version }} to ${{ steps.version.outputs.url }}" >> $GITHUB_STEP_SUMMARY
132+
133+
- name: (TEST RUN) Test Publish package distributions to PyPI
134+
if: ${{ github.event.inputs.dryRun == 'true' }}
135+
run:
136+
echo "Dry run deployment, did not publish" >> $GITHUB_STEP_SUMMARY

.github/workflows/pyright.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Check types
2+
on:
3+
# pull_request:
4+
workflow_call:
5+
workflow_dispatch:
6+
env:
7+
NODE_VERSION: '18'
8+
PYTHON_VERSION: '3.9'
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
typecheck:
15+
strategy:
16+
matrix:
17+
include: #ckan-image see https://github.com/ckan/ckan-docker-base, ckan-version controls other image tags
18+
- ckan-version: "dev-v2.11"
19+
experimental: false
20+
- ckan-version: "dev-v2.10"
21+
experimental: false
22+
- ckan-version: "master"
23+
experimental: true # master is unstable, good to know if we are compatible or not
24+
fail-fast: false
25+
26+
name: ${{ matrix.experimental && '**Fail_Ignored** ' || '' }} Check types ${{ matrix.ckan-version }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: checkout ckan
31+
uses: actions/checkout@v4
32+
with:
33+
repository: ckan/ckan
34+
ref: ${{ matrix.ckan-version }}
35+
path: ckan
36+
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: ${{ env.PYTHON_VERSION }}
40+
cache: 'pip'
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: ${{ env.NODE_VERSION }}
44+
cache: 'npm'
45+
46+
- name: Install python deps
47+
continue-on-error: ${{ matrix.experimental }}
48+
run: |
49+
pip list
50+
pip install -r ckan/requirements.txt -r ckan/dev-requirements.txt ckan/.
51+
pip install -e".[test]"
52+
53+
- name: Install node deps
54+
continue-on-error: ${{ matrix.experimental }}
55+
run: npm ci
56+
57+
- name: Check types
58+
continue-on-error: ${{ matrix.experimental }}
59+
run: |
60+
npx pyright

0 commit comments

Comments
 (0)