Skip to content

Commit ba6ca3e

Browse files
committed
Initial commit for template repository
0 parents  commit ba6ca3e

Some content is hidden

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

50 files changed

+3208
-0
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXPECTED_KEY=randomkeyhere
2+
EXPECTED_ENV=test

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
publish:
10+
name: "Publish release"
11+
runs-on: "ubuntu-latest"
12+
permissions:
13+
id-token: write
14+
environment:
15+
name: pypi
16+
url: https://pypi.org/p/integrify-{integration-name}/
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.9"
23+
- name: Install build dependencies
24+
run: pip install build
25+
- name: Build distribution
26+
run: python -m build
27+
- name: Upload package to PyPI
28+
uses: pypa/gh-action-pypi-publish@v1.12.4

.github/workflows/readme-table.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Readme API Table
2+
3+
on:
4+
schedule:
5+
# cron every day
6+
- cron: "0 0 * * *"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
update-readme:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Fetch remote README
21+
run: |
22+
curl -sSL "https://raw.githubusercontent.com/Integrify-SDK/integrify-docs-python/refs/heads/main/README.md" -o remote_readme.md
23+
24+
- name: Extract section from remote README
25+
run: |
26+
# Extract content between markers in remote README
27+
awk '/<!-- START SECTION -->/{flag=1;next}/<!-- END SECTION -->/{flag=0}flag' remote_readme.md > extracted_section.md
28+
29+
- name: Insert into local README
30+
run: |
31+
# Replace content in local README after a marker
32+
marker="<!-- AUTO-UPDATE SECTION -->"
33+
tmp_file=$(mktemp)
34+
awk -v marker="$marker" -v insert="$(cat extracted_section.md)" '
35+
{
36+
print $0
37+
if ($0 ~ marker) {
38+
print insert
39+
exit # Stop after inserting content
40+
}
41+
}
42+
' README.md > "$tmp_file"
43+
mv "$tmp_file" README.md
44+
45+
- name: Commit and push changes
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
git add README.md
50+
git diff --cached --quiet || git commit -m "Update README from remote source"
51+
git push

.github/workflows/smokeshow.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Smokeshow
2+
3+
on:
4+
workflow_run:
5+
workflows: [Test]
6+
types: [completed]
7+
8+
permissions:
9+
statuses: write
10+
11+
12+
jobs:
13+
smokeshow:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Dump GitHub context
19+
env:
20+
GITHUB_CONTEXT: ${{ toJson(github) }}
21+
run: echo "$GITHUB_CONTEXT"
22+
23+
- uses: actions/checkout@v4
24+
25+
#----------------------------------------------
26+
# ----- Checkout -----
27+
#----------------------------------------------
28+
- uses: actions/checkout@v4
29+
#----------------------------------------------
30+
# ----- install & configure uv -----
31+
#----------------------------------------------
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
python-version: 3.9
36+
#----------------------------------------------
37+
# load cached venv if cache exists
38+
#----------------------------------------------
39+
- name: Load cached venv
40+
id: cached-poetry-dependencies
41+
uses: actions/cache@v4
42+
with:
43+
path: .venv
44+
key: venv-Linux-3.9-${{ hashFiles('pyproject.toml') }}
45+
#----------------------------------------------
46+
# install dependencies if cache does not exist
47+
#----------------------------------------------
48+
- name: Install dependencies
49+
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
50+
run: uv export --only-group=gh | uv pip install --requirements=-
51+
52+
#----------------------------------------------
53+
# ----- Run Smokeshow -----
54+
#----------------------------------------------
55+
- uses: actions/download-artifact@v4
56+
with:
57+
name: coverage-html
58+
path: htmlcov
59+
github-token: ${{ secrets.GITHUB_TOKEN }}
60+
run-id: ${{ github.event.workflow_run.id }}
61+
62+
- run: uv run --no-sync smokeshow upload htmlcov
63+
env:
64+
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
65+
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 95
66+
SMOKESHOW_GITHUB_CONTEXT: coverage
67+
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
69+
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}

.github/workflows/test.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**.py'
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
paths:
14+
- '**.py'
15+
schedule:
16+
# cron every week on monday
17+
- cron: "0 0 * * 1"
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version:
26+
- "3.13"
27+
- "3.12"
28+
- "3.11"
29+
- "3.10"
30+
- "3.9"
31+
steps:
32+
- name: Dump GitHub context
33+
env:
34+
GITHUB_CONTEXT: ${{ toJson(github) }}
35+
run: echo "$GITHUB_CONTEXT"
36+
37+
- name: Secrets -> env
38+
uses: oNaiPs/secrets-to-env-action@v1
39+
with:
40+
secrets: ${{ toJSON(secrets) }}
41+
#----------------------------------------------
42+
# ----- Checkout -----
43+
#----------------------------------------------
44+
- uses: actions/checkout@v4
45+
#----------------------------------------------
46+
# ----- install & configure uv -----
47+
#----------------------------------------------
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
#----------------------------------------------
53+
# load cached venv if cache exists
54+
#----------------------------------------------
55+
- name: Load cached venv
56+
id: cached-uv-dependencies
57+
uses: actions/cache@v4
58+
with:
59+
path: .venv
60+
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
61+
#----------------------------------------------
62+
# install dependencies if cache does not exist
63+
#----------------------------------------------
64+
- name: Install dependencies
65+
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
66+
run: uv sync --no-dev --no-group=docs
67+
#----------------------------------------------
68+
# run test suite
69+
#----------------------------------------------
70+
- run: mkdir coverage
71+
- name: Run tests
72+
run: |
73+
make test
74+
env:
75+
COVERAGE_FILE: coverage/.coverage.py${{ matrix.python-version }}
76+
CONTEXT: py${{ matrix.python-version }}
77+
- name: Store coverage files
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: coverage-py${{ matrix.python-version }}
81+
path: coverage
82+
include-hidden-files: true
83+
coverage-combine:
84+
needs: [test]
85+
runs-on: ubuntu-latest
86+
defaults:
87+
run:
88+
shell: bash
89+
steps:
90+
- name: Dump GitHub context
91+
env:
92+
GITHUB_CONTEXT: ${{ toJson(github) }}
93+
run: echo "$GITHUB_CONTEXT"
94+
- uses: actions/checkout@v4
95+
#----------------------------------------------
96+
# ----- install & configure uv -----
97+
#----------------------------------------------
98+
- name: Install uv
99+
uses: astral-sh/setup-uv@v5
100+
with:
101+
python-version: '3.9'
102+
#----------------------------------------------
103+
# load cached venv if cache exists
104+
#----------------------------------------------
105+
- name: Load cached venv
106+
id: cached-uv-dependencies
107+
uses: actions/cache@v4
108+
with:
109+
path: .venv
110+
key: venv-Linux-3.9-${{ hashFiles('pyproject.toml') }}
111+
#----------------------------------------------
112+
- name: Get coverage files
113+
uses: actions/download-artifact@v4
114+
with:
115+
pattern: coverage-*
116+
path: coverage
117+
merge-multiple: true
118+
- run: ls -la coverage
119+
- run: make coverage title=${{ github.sha }}
120+
- name: Store coverage HTML
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: coverage-html
124+
path: htmlcov
125+
include-hidden-files: true

0 commit comments

Comments
 (0)