pkg-40400 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pkg_40400-0.1.0/.github/CODEOWNERS +4 -0
- pkg_40400-0.1.0/.github/ISSUE_TEMPLATE/config.yml +4 -0
- pkg_40400-0.1.0/.github/ISSUE_TEMPLATE/report_problem.md +18 -0
- pkg_40400-0.1.0/.github/ISSUE_TEMPLATE/request_feature.md +16 -0
- pkg_40400-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +9 -0
- pkg_40400-0.1.0/.github/config/hadolint-cfg.yaml +16 -0
- pkg_40400-0.1.0/.github/config/yamllint-cfg.yaml +15 -0
- pkg_40400-0.1.0/.github/dependabot.yml +40 -0
- pkg_40400-0.1.0/.github/labeler.yml +48 -0
- pkg_40400-0.1.0/.github/release.yml +29 -0
- pkg_40400-0.1.0/.github/workflows/cd-production.yaml +107 -0
- pkg_40400-0.1.0/.github/workflows/cd-staging.yaml +173 -0
- pkg_40400-0.1.0/.github/workflows/ci.yaml +149 -0
- pkg_40400-0.1.0/.github/workflows/cron-tasks.yaml +221 -0
- pkg_40400-0.1.0/.github/workflows/reusable-build-test.yaml +143 -0
- pkg_40400-0.1.0/.github/workflows/reusable-dependency-review.yaml +24 -0
- pkg_40400-0.1.0/.github/workflows/reusable-pre-commit.yaml +86 -0
- pkg_40400-0.1.0/.github/workflows/sidecar-pr-target.yaml +52 -0
- pkg_40400-0.1.0/.gitignore +349 -0
- pkg_40400-0.1.0/.pre-commit-config.yaml +92 -0
- pkg_40400-0.1.0/CHANGELOG.md +24 -0
- pkg_40400-0.1.0/CODE_OF_CONDUCT.md +128 -0
- pkg_40400-0.1.0/CONTRIBUTING.md +41 -0
- pkg_40400-0.1.0/Dockerfile +36 -0
- pkg_40400-0.1.0/LICENSE +18 -0
- pkg_40400-0.1.0/Makefile +49 -0
- pkg_40400-0.1.0/PKG-INFO +23 -0
- pkg_40400-0.1.0/README.md +3 -0
- pkg_40400-0.1.0/SECURITY.md +36 -0
- pkg_40400-0.1.0/config/logging.yaml +77 -0
- pkg_40400-0.1.0/mise.toml +15 -0
- pkg_40400-0.1.0/pyproject.toml +130 -0
- pkg_40400-0.1.0/src/pkg_40400/__init__.py +15 -0
- pkg_40400-0.1.0/src/pkg_40400/cli.py +25 -0
- pkg_40400-0.1.0/src/pkg_40400/core/__init__.py +0 -0
- pkg_40400-0.1.0/src/pkg_40400/core/config.py +93 -0
- pkg_40400-0.1.0/src/pkg_40400/core/decorator.py +77 -0
- pkg_40400-0.1.0/src/pkg_40400/core/logger.py +84 -0
- pkg_40400-0.1.0/src/pkg_40400/models/__init__.py +0 -0
- pkg_40400-0.1.0/src/pkg_40400/services/__init__.py +0 -0
- pkg_40400-0.1.0/src/pkg_40400/utils/__init__.py +0 -0
- pkg_40400-0.1.0/tests/__init__.py +0 -0
- pkg_40400-0.1.0/tests/conftest.py +79 -0
- pkg_40400-0.1.0/tests/test_core_config.py +82 -0
- pkg_40400-0.1.0/tests/test_core_decorator.py +121 -0
- pkg_40400-0.1.0/tests/test_core_logger.py +268 -0
- pkg_40400-0.1.0/uv.lock +805 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
# NOTE: Terraform-managed template
|
|
3
|
+
|
|
4
|
+
name: 🐛 Report a bug
|
|
5
|
+
about: Report a bug
|
|
6
|
+
title: "Bug: "
|
|
7
|
+
labels: bug
|
|
8
|
+
assignees: ""
|
|
9
|
+
type: Bug
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
**Summary of the bug**
|
|
13
|
+
|
|
14
|
+
**Steps to Reproduce**
|
|
15
|
+
|
|
16
|
+
**Additional context**
|
|
17
|
+
|
|
18
|
+
**Screenshot**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
# NOTE: Terraform-managed template
|
|
3
|
+
|
|
4
|
+
name: 💡 Request A Feature or Change
|
|
5
|
+
about: Request A Feature or Change
|
|
6
|
+
title: "Feature: "
|
|
7
|
+
labels: enhancement
|
|
8
|
+
assignees: ""
|
|
9
|
+
type: Feature
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
**Summary of the feature request**
|
|
13
|
+
|
|
14
|
+
**Describe the use case**
|
|
15
|
+
|
|
16
|
+
**Additional information**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
# NOTE: Terraform-managed template
|
|
3
|
+
|
|
4
|
+
# https://devtodevops.com/hadolint-dockerfile/
|
|
5
|
+
|
|
6
|
+
failure-threshold: error # error, warning, info, style, ignore, none
|
|
7
|
+
format: tty # tty, json, checkstyle, codeclimate, gitlab_codeclimate
|
|
8
|
+
no-color: false
|
|
9
|
+
no-fail: false
|
|
10
|
+
strict-labels: false
|
|
11
|
+
verbose: false
|
|
12
|
+
ignored:
|
|
13
|
+
- DL3008 # pin version: apt install
|
|
14
|
+
- DL3013 # pin version: pip install
|
|
15
|
+
- DL3025 # use exec (JSON) form for CMD or ENTRYPOINT arguments
|
|
16
|
+
- SC1091 # shellcheck source
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
updates:
|
|
4
|
+
- package-ecosystem: github-actions
|
|
5
|
+
directory: /
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "cron"
|
|
8
|
+
cronjob: "15 0 * * 0"
|
|
9
|
+
open-pull-requests-limit: 1
|
|
10
|
+
rebase-strategy: "disabled"
|
|
11
|
+
groups:
|
|
12
|
+
github-actions:
|
|
13
|
+
patterns:
|
|
14
|
+
- "*"
|
|
15
|
+
commit-message:
|
|
16
|
+
prefix: "[GITHUB-ACTIONS] "
|
|
17
|
+
allow:
|
|
18
|
+
- dependency-type: "direct"
|
|
19
|
+
- dependency-type: "indirect"
|
|
20
|
+
cooldown:
|
|
21
|
+
default-days: 3
|
|
22
|
+
- package-ecosystem: uv
|
|
23
|
+
directory: /
|
|
24
|
+
schedule:
|
|
25
|
+
interval: "cron"
|
|
26
|
+
cronjob: "15 0 * * 0"
|
|
27
|
+
open-pull-requests-limit: 1
|
|
28
|
+
rebase-strategy: "disabled"
|
|
29
|
+
versioning-strategy: increase
|
|
30
|
+
groups:
|
|
31
|
+
uv:
|
|
32
|
+
patterns:
|
|
33
|
+
- "*"
|
|
34
|
+
commit-message:
|
|
35
|
+
prefix: "[UV] "
|
|
36
|
+
allow:
|
|
37
|
+
- dependency-type: "direct"
|
|
38
|
+
- dependency-type: "indirect"
|
|
39
|
+
cooldown:
|
|
40
|
+
default-days: 3
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
# NOTE: Terraform-managed template
|
|
3
|
+
|
|
4
|
+
# release category: New Features
|
|
5
|
+
|
|
6
|
+
feature:
|
|
7
|
+
- head-branch:
|
|
8
|
+
- "^feat"
|
|
9
|
+
|
|
10
|
+
# release category: Change Features
|
|
11
|
+
|
|
12
|
+
enhancement:
|
|
13
|
+
- head-branch:
|
|
14
|
+
- "^perf"
|
|
15
|
+
- "^refactor"
|
|
16
|
+
|
|
17
|
+
# release category: Fixes
|
|
18
|
+
|
|
19
|
+
fix:
|
|
20
|
+
- head-branch:
|
|
21
|
+
- "^bugfix"
|
|
22
|
+
- "^hotfix"
|
|
23
|
+
- "^fix"
|
|
24
|
+
|
|
25
|
+
# release category: Maintenance
|
|
26
|
+
|
|
27
|
+
dependencies:
|
|
28
|
+
- head-branch:
|
|
29
|
+
- "^dep/"
|
|
30
|
+
|
|
31
|
+
# release category: Others
|
|
32
|
+
|
|
33
|
+
build:
|
|
34
|
+
- head-branch:
|
|
35
|
+
- "^build"
|
|
36
|
+
- "^ci"
|
|
37
|
+
|
|
38
|
+
documentation:
|
|
39
|
+
- head-branch:
|
|
40
|
+
- "^doc"
|
|
41
|
+
|
|
42
|
+
style:
|
|
43
|
+
- head-branch:
|
|
44
|
+
- "^style"
|
|
45
|
+
|
|
46
|
+
test:
|
|
47
|
+
- head-branch:
|
|
48
|
+
- "^test"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
# NOTE: Terraform-managed template
|
|
3
|
+
|
|
4
|
+
changelog:
|
|
5
|
+
exclude:
|
|
6
|
+
authors:
|
|
7
|
+
- tagdots-owner
|
|
8
|
+
|
|
9
|
+
categories:
|
|
10
|
+
- title: "🚀 New features"
|
|
11
|
+
labels:
|
|
12
|
+
- feature
|
|
13
|
+
- title: "🎉 Change features"
|
|
14
|
+
labels:
|
|
15
|
+
- enhancement
|
|
16
|
+
- title: "🐛 Fixes"
|
|
17
|
+
labels:
|
|
18
|
+
- fix
|
|
19
|
+
- hotfix
|
|
20
|
+
- bugfix
|
|
21
|
+
- title: "🛠️ Maintenance"
|
|
22
|
+
labels:
|
|
23
|
+
- dependencies
|
|
24
|
+
- title: "👒 Others"
|
|
25
|
+
labels:
|
|
26
|
+
- build
|
|
27
|
+
- documentation
|
|
28
|
+
- style
|
|
29
|
+
- test
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: CD-production
|
|
3
|
+
|
|
4
|
+
on: # yamllint disable-line rule:truthy
|
|
5
|
+
release:
|
|
6
|
+
types:
|
|
7
|
+
- published
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
PROJECT_NAME: pkg-40400
|
|
11
|
+
PACKAGE_NAME: pkg_40400
|
|
12
|
+
PYTHON_VERSION: "3.14.x"
|
|
13
|
+
UV_VERSION: "0.12.3"
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
publish-PyPI:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout source code # https://github.com/marketplace/actions/checkout
|
|
24
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
25
|
+
|
|
26
|
+
- name: Setup Python # https://github.com/marketplace/actions/setup-python
|
|
27
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
30
|
+
|
|
31
|
+
- name: Setup UV # https://github.com/marketplace/actions/astral-sh-setup-uv
|
|
32
|
+
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
|
|
33
|
+
with:
|
|
34
|
+
version: ${{ env.UV_VERSION }}
|
|
35
|
+
|
|
36
|
+
- name: Make build
|
|
37
|
+
shell: bash
|
|
38
|
+
run: make build
|
|
39
|
+
|
|
40
|
+
- name: Publish package distributions to PyPI # https://github.com/marketplace/actions/pypi-publish
|
|
41
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
42
|
+
with:
|
|
43
|
+
attestations: false
|
|
44
|
+
packages-dir: dist/
|
|
45
|
+
password: ${{ secrets.SECRET_PYPI }}
|
|
46
|
+
print-hash: true
|
|
47
|
+
repository-url: https://upload.pypi.org/legacy/
|
|
48
|
+
verbose: true
|
|
49
|
+
verify-metadata: true
|
|
50
|
+
|
|
51
|
+
validate-PyPI:
|
|
52
|
+
needs: [publish-PyPI]
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- name: Validate after short wait to ensure publish is complete
|
|
57
|
+
shell: bash
|
|
58
|
+
run: sleep 15
|
|
59
|
+
|
|
60
|
+
- name: Setup Python # https://github.com/marketplace/actions/setup-python
|
|
61
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
62
|
+
with:
|
|
63
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
64
|
+
|
|
65
|
+
- name: Install package from PyPI and run app to show version
|
|
66
|
+
shell: bash
|
|
67
|
+
env:
|
|
68
|
+
INDEX_URL: "https://pypi.org/simple/"
|
|
69
|
+
run: |
|
|
70
|
+
pip install ${{ env.PROJECT_NAME }}==${{ github.ref_name }}
|
|
71
|
+
python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)"
|
|
72
|
+
|
|
73
|
+
notify-slack:
|
|
74
|
+
if: always()
|
|
75
|
+
needs: [publish-PyPI, validate-PyPI]
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
|
|
78
|
+
outputs:
|
|
79
|
+
WORKFLOW_RESULT: ${{ steps.get-overall-jobs-results.outputs.WORKFLOW_RESULT }}
|
|
80
|
+
|
|
81
|
+
steps:
|
|
82
|
+
- name: Get overall jobs results
|
|
83
|
+
id: get-overall-jobs-results
|
|
84
|
+
shell: bash
|
|
85
|
+
run: |
|
|
86
|
+
if "${{ needs.publish-PyPI.result == 'success' && needs.validate-PyPI.result == 'success' }}"; then
|
|
87
|
+
echo "WORKFLOW_RESULT=:white_check_mark:" >> "$GITHUB_OUTPUT"
|
|
88
|
+
else
|
|
89
|
+
echo "WORKFLOW_RESULT=:no_entry:" >> "$GITHUB_OUTPUT"
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
- name: Post message to Slack # https://github.com/marketplace/actions/slack-github-action
|
|
93
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
94
|
+
with:
|
|
95
|
+
method: chat.postMessage
|
|
96
|
+
token: "${{ secrets.SECRET_SLACK_APP_GITHUB_BOT }}"
|
|
97
|
+
payload: |
|
|
98
|
+
channel: "${{ secrets.SECRET_SLACK_CHANNEL_CICD }}"
|
|
99
|
+
text: "
|
|
100
|
+
*Repository: ${{ github.repository }}*\n
|
|
101
|
+
*Workflow : ${{ github.workflow }} ${{ steps.get-overall-jobs-results.outputs.WORKFLOW_RESULT }}*\n
|
|
102
|
+
*Tag Name : ${{ github.ref_name }}*
|
|
103
|
+
```
|
|
104
|
+
URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n
|
|
105
|
+
Job: publish-PyPI - ${{ needs.publish-PyPI.result }}\n
|
|
106
|
+
Job: validate-PyPI - ${{ needs.validate-PyPI.result }}
|
|
107
|
+
```"
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: CD-staging
|
|
3
|
+
|
|
4
|
+
on: # yamllint disable-line rule:truthy
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
types:
|
|
10
|
+
- closed
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
PROJECT_NAME: pkg-40400
|
|
14
|
+
PACKAGE_NAME: pkg_40400
|
|
15
|
+
PYTHON_VERSION: "3.14.x"
|
|
16
|
+
UV_VERSION: "0.12.3"
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
push-git-tag:
|
|
23
|
+
if: ${{ startsWith(github.head_ref, 'release/') && github.event.pull_request.merged == true }}
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
|
|
26
|
+
env:
|
|
27
|
+
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
|
28
|
+
|
|
29
|
+
permissions:
|
|
30
|
+
contents: write
|
|
31
|
+
|
|
32
|
+
outputs:
|
|
33
|
+
VERSION: ${{ steps.set-tag.outputs.VERSION }}
|
|
34
|
+
|
|
35
|
+
steps:
|
|
36
|
+
# instead of PAT, github_app_id and github_app_pem_file are used by this workflow because
|
|
37
|
+
# we have tag-based ruleset in place to restrict ACTOR from bypassing tag protection.
|
|
38
|
+
|
|
39
|
+
- name: Generate a token from Github App # https://github.com/marketplace/actions/create-github-app-token
|
|
40
|
+
id: generate-token
|
|
41
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
42
|
+
with:
|
|
43
|
+
client-id: ${{ secrets.SECRET_GITHUB_APP_CLIENT_ID }}
|
|
44
|
+
private-key: ${{ secrets.SECRET_GITHUB_APP_PEM_FILE }}
|
|
45
|
+
|
|
46
|
+
- name: Checkout source code # https://github.com/marketplace/actions/checkout
|
|
47
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
48
|
+
with:
|
|
49
|
+
token: ${{ steps.generate-token.outputs.token }}
|
|
50
|
+
|
|
51
|
+
- name: Tag and Push
|
|
52
|
+
id: set-tag
|
|
53
|
+
shell: bash
|
|
54
|
+
env:
|
|
55
|
+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
56
|
+
run: |
|
|
57
|
+
# parse out the version
|
|
58
|
+
GITHUB_SPEC_VER=${GITHUB_HEAD_REF#release/}
|
|
59
|
+
echo "VERSION=${GITHUB_SPEC_VER}" >> "$GITHUB_OUTPUT"
|
|
60
|
+
|
|
61
|
+
# create and push a lightweight tag
|
|
62
|
+
git tag ${GITHUB_SPEC_VER}
|
|
63
|
+
git push origin ${GITHUB_SPEC_VER}
|
|
64
|
+
|
|
65
|
+
publish-TestPyPI:
|
|
66
|
+
needs: [push-git-tag]
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- name: Checkout source code # https://github.com/marketplace/actions/checkout
|
|
71
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
72
|
+
|
|
73
|
+
- name: Setup Python # https://github.com/marketplace/actions/setup-python
|
|
74
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
75
|
+
with:
|
|
76
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
77
|
+
|
|
78
|
+
- name: Setup UV # https://github.com/marketplace/actions/astral-sh-setup-uv
|
|
79
|
+
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
|
|
80
|
+
with:
|
|
81
|
+
version: ${{ env.UV_VERSION }}
|
|
82
|
+
|
|
83
|
+
- name: Make build
|
|
84
|
+
shell: bash
|
|
85
|
+
run: make build
|
|
86
|
+
|
|
87
|
+
- name: Publish package distributions to TestPyPI # https://github.com/marketplace/actions/pypi-publish
|
|
88
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
89
|
+
with:
|
|
90
|
+
attestations: false
|
|
91
|
+
packages-dir: dist/
|
|
92
|
+
password: ${{ secrets.SECRET_PYPITEST }}
|
|
93
|
+
print-hash: true
|
|
94
|
+
repository-url: https://test.pypi.org/legacy/
|
|
95
|
+
verbose: true
|
|
96
|
+
verify-metadata: true
|
|
97
|
+
|
|
98
|
+
validate-TestPyPI:
|
|
99
|
+
needs: [publish-TestPyPI]
|
|
100
|
+
runs-on: ubuntu-latest
|
|
101
|
+
|
|
102
|
+
steps:
|
|
103
|
+
- name: Validate after short wait to ensure publish is complete
|
|
104
|
+
shell: bash
|
|
105
|
+
run: sleep 15
|
|
106
|
+
|
|
107
|
+
- name: Setup Python # https://github.com/marketplace/actions/setup-python
|
|
108
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
109
|
+
with:
|
|
110
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
111
|
+
|
|
112
|
+
- name: Install package from TestPyPI and run app to show version
|
|
113
|
+
shell: bash
|
|
114
|
+
env:
|
|
115
|
+
INDEX_URL: "https://test.pypi.org/simple/"
|
|
116
|
+
EXTRA_INDEX_URL: "https://pypi.org/simple/"
|
|
117
|
+
run: |
|
|
118
|
+
pip install ${{ env.PROJECT_NAME }} --index-url ${{ env.INDEX_URL }} --extra-index-url ${{ env.EXTRA_INDEX_URL }}
|
|
119
|
+
python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)"
|
|
120
|
+
|
|
121
|
+
notify-slack:
|
|
122
|
+
if: always()
|
|
123
|
+
needs: [push-git-tag, publish-TestPyPI, validate-TestPyPI]
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
|
|
126
|
+
outputs:
|
|
127
|
+
WORKFLOW_RESULT: ${{ steps.get-overall-jobs-results.outputs.WORKFLOW_RESULT }}
|
|
128
|
+
TAG_NAME: ${{ steps.get-overall-jobs-results.outputs.TAG_NAME }}
|
|
129
|
+
|
|
130
|
+
steps:
|
|
131
|
+
- name: Get overall jobs results
|
|
132
|
+
id: get-overall-jobs-results
|
|
133
|
+
shell: bash
|
|
134
|
+
run: |
|
|
135
|
+
# get overall result from all of the previous jobs
|
|
136
|
+
if ${{
|
|
137
|
+
needs.push-git-tag.result == 'success'
|
|
138
|
+
&& needs.publish-TestPyPI.result == 'success'
|
|
139
|
+
&& needs.validate-TestPyPI.result == 'success' }}; then
|
|
140
|
+
echo "WORKFLOW_RESULT=:white_check_mark:" >> "$GITHUB_OUTPUT"
|
|
141
|
+
elif ${{
|
|
142
|
+
needs.push-git-tag.result == 'skipped'
|
|
143
|
+
&& needs.publish-TestPyPI.result == 'skipped'
|
|
144
|
+
&& needs.validate-TestPyPI.result == 'skipped' }}; then
|
|
145
|
+
echo "WORKFLOW_RESULT=:fast_forward:" >> "$GITHUB_OUTPUT"
|
|
146
|
+
else
|
|
147
|
+
echo "WORKFLOW_RESULT=:no_entry:" >> "$GITHUB_OUTPUT"
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
# get tag name
|
|
151
|
+
if ${{ needs.push-git-tag.outputs.VERSION == '' }}; then
|
|
152
|
+
echo "TAG_NAME=not-available" >> "$GITHUB_OUTPUT"
|
|
153
|
+
else
|
|
154
|
+
echo "TAG_NAME=${{ needs.push-git-tag.outputs.VERSION }}" >> "$GITHUB_OUTPUT"
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
- name: Post message to Slack
|
|
158
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
159
|
+
with:
|
|
160
|
+
method: chat.postMessage
|
|
161
|
+
token: "${{ secrets.SECRET_SLACK_APP_GITHUB_BOT }}"
|
|
162
|
+
payload: |
|
|
163
|
+
channel: "${{ secrets.SECRET_SLACK_CHANNEL_CICD }}"
|
|
164
|
+
text: "
|
|
165
|
+
*Repository: ${{ github.repository }}*\n
|
|
166
|
+
*Workflow : ${{ github.workflow }} ${{ steps.get-overall-jobs-results.outputs.WORKFLOW_RESULT }}*\n
|
|
167
|
+
*Tag Name : ${{ steps.get-overall-jobs-results.outputs.TAG_NAME }}*
|
|
168
|
+
```
|
|
169
|
+
URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n
|
|
170
|
+
Job: push-git-tag - ${{ needs.push-git-tag.result }}\n
|
|
171
|
+
Job: publish-TestPyPI - ${{ needs.publish-TestPyPI.result }}\n
|
|
172
|
+
Job: validate-TestPyPI - ${{ needs.validate-TestPyPI.result }}
|
|
173
|
+
```"
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: CI
|
|
3
|
+
|
|
4
|
+
on: # yamllint disable-line rule:truthy
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
types:
|
|
10
|
+
- edited
|
|
11
|
+
- opened
|
|
12
|
+
- synchronize
|
|
13
|
+
|
|
14
|
+
push:
|
|
15
|
+
branches:
|
|
16
|
+
- test-*
|
|
17
|
+
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
pull-requests: read
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
pre-commit:
|
|
26
|
+
uses: ./.github/workflows/reusable-pre-commit.yaml
|
|
27
|
+
|
|
28
|
+
build-test:
|
|
29
|
+
permissions:
|
|
30
|
+
contents: write
|
|
31
|
+
pull-requests: write
|
|
32
|
+
|
|
33
|
+
uses: ./.github/workflows/reusable-build-test.yaml
|
|
34
|
+
|
|
35
|
+
dependency:
|
|
36
|
+
if: ${{ github.event.repository.visibility == 'public' && (github.event_name == 'pull_request' || github.event.workflow_run.event == 'pull_request')}}
|
|
37
|
+
uses: ./.github/workflows/reusable-dependency-review.yaml
|
|
38
|
+
|
|
39
|
+
validate-release:
|
|
40
|
+
needs: [pre-commit, build-test, dependency]
|
|
41
|
+
|
|
42
|
+
# needs are not evaluated properly before the steps kicks in. Therefore, always() must be here.
|
|
43
|
+
if: ${{ always() && startsWith(github.head_ref, 'release/') && needs.pre-commit.result == 'success' && needs.build-test.result == 'success' && contains(fromJSON('["success", "skipped"]'), needs.dependency.result) }}
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
|
|
46
|
+
env:
|
|
47
|
+
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
|
48
|
+
GITHUB_SPEC_VER: ${GITHUB_HEAD_REF#release/}
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout source code # https://github.com/marketplace/actions/checkout
|
|
52
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
53
|
+
|
|
54
|
+
- name: Set release branch info to job output
|
|
55
|
+
id: set-release-branch
|
|
56
|
+
shell: bash
|
|
57
|
+
run: |
|
|
58
|
+
echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
|
|
59
|
+
echo "GITHUB_SPEC_VER=$GITHUB_SPEC_VER" >> "$GITHUB_OUTPUT"
|
|
60
|
+
|
|
61
|
+
- name: Get output variables
|
|
62
|
+
shell: bash
|
|
63
|
+
run: |
|
|
64
|
+
echo "Release Branch Name : ${{ steps.set-release-branch.outputs.GITHUB_HEAD_REF }}"
|
|
65
|
+
echo "Release Branch Spec Version : ${{ steps.set-release-branch.outputs.GITHUB_SPEC_VER }}"
|
|
66
|
+
echo "Software Build Version : ${{ needs.build-test.outputs.BUILD_VERSION }}"
|
|
67
|
+
echo "Workflow Run ID : ${{ needs.build-test.outputs.WORKFLOW_RUN_ID }}"
|
|
68
|
+
echo "Uploaded Artifact ID : ${{ needs.build-test.outputs.ARTIFACT_ID }}"
|
|
69
|
+
|
|
70
|
+
- name: Download distributions # https://github.com/marketplace/actions/download-a-build-artifact
|
|
71
|
+
if: ${{ github.event.repository.language == 'Python' && !env.ACT }}
|
|
72
|
+
id: artifact-download
|
|
73
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1
|
|
74
|
+
with:
|
|
75
|
+
artifact-ids: "${{ needs.build-test.outputs.ARTIFACT_ID }}"
|
|
76
|
+
run-id: "${{ needs.build-test.outputs.WORKFLOW_RUN_ID }}"
|
|
77
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
78
|
+
path: dist/
|
|
79
|
+
|
|
80
|
+
- name: Check artifact download
|
|
81
|
+
if: ${{ github.event.repository.language == 'Python' }}
|
|
82
|
+
shell: bash
|
|
83
|
+
run: tree .
|
|
84
|
+
|
|
85
|
+
# --- release validation starts from here --- #
|
|
86
|
+
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
87
|
+
- name: Validate that release branch version matches release specification
|
|
88
|
+
shell: bash
|
|
89
|
+
run: |
|
|
90
|
+
REGEX="^[0-9]+\.[0-9]+\.[0-9]+$"
|
|
91
|
+
if [[ ! "${{steps.set-release-branch.outputs.GITHUB_SPEC_VER}}" =~ $REGEX ]]; then
|
|
92
|
+
echo "Error: Release Branch Specified Version does not match Release Specification (Major.Minior.Patch)."
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
- name: Validate that release branch version AND software build version are the same
|
|
97
|
+
shell: bash
|
|
98
|
+
run: |
|
|
99
|
+
if [ "${{ needs.build-test.outputs.BUILD_VERSION}}" != "${{steps.set-release-branch.outputs.GITHUB_SPEC_VER}}" ]; then
|
|
100
|
+
echo "Error: Release Branch Specified Version is different from Software Build Version."
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
- name: Validate that release version tag has not been created.
|
|
105
|
+
shell: bash
|
|
106
|
+
run: |
|
|
107
|
+
TAG_EXIST="$(git ls-remote origin refs/tags/${{ needs.build-test.outputs.BUILD_VERSION }} | awk '{print $2}' | sed 's/refs\/tags\///g')"
|
|
108
|
+
if [ -n "$TAG_EXIST" ]; then
|
|
109
|
+
echo "Error: Tag ($TAG_EXIST) exists already at remote origin."
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
|
112
|
+
# --- release validation ends here --- #
|
|
113
|
+
|
|
114
|
+
notify-slack:
|
|
115
|
+
if: always()
|
|
116
|
+
needs: [pre-commit, build-test, dependency, validate-release]
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
|
|
119
|
+
outputs:
|
|
120
|
+
WORKFLOW_RESULT: ${{ steps.get-overall-jobs-results.outputs.WORKFLOW_RESULT }}
|
|
121
|
+
|
|
122
|
+
steps:
|
|
123
|
+
- name: Get overall jobs results
|
|
124
|
+
id: get-overall-jobs-results
|
|
125
|
+
shell: bash
|
|
126
|
+
run: |
|
|
127
|
+
if "${{ needs.pre-commit.result == 'success' && needs.build-test.result == 'success' && contains(fromJSON('["success", "skipped"]'), needs.dependency.result) && contains(fromJSON('["success", "skipped"]'), needs.validate-release.result) }}"; then
|
|
128
|
+
echo "WORKFLOW_RESULT=:white_check_mark:" >> "$GITHUB_OUTPUT"
|
|
129
|
+
else
|
|
130
|
+
echo "WORKFLOW_RESULT=:no_entry:" >> "$GITHUB_OUTPUT"
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
- name: Post message to Slack # https://github.com/marketplace/actions/slack-github-action
|
|
134
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
135
|
+
with:
|
|
136
|
+
method: chat.postMessage
|
|
137
|
+
token: "${{ secrets.SECRET_SLACK_APP_GITHUB_BOT }}"
|
|
138
|
+
payload: |
|
|
139
|
+
channel: "${{ secrets.SECRET_SLACK_CHANNEL_CICD }}"
|
|
140
|
+
text: "
|
|
141
|
+
*Repository: ${{ github.repository }}*\n
|
|
142
|
+
*Workflow : ${{ github.workflow }} ${{ steps.get-overall-jobs-results.outputs.WORKFLOW_RESULT }}*
|
|
143
|
+
```
|
|
144
|
+
URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n
|
|
145
|
+
Job: pre-commit - ${{ needs.pre-commit.result }}\n
|
|
146
|
+
Job: build-test - ${{ needs.build-test.result }}\n
|
|
147
|
+
Job: dependency - ${{ needs.dependency.result }}\n
|
|
148
|
+
Job: validate-release - ${{ needs.validate-release.result }}
|
|
149
|
+
```"
|