Skip to content

Commit feeae07

Browse files
committed
chore: add private repo tests on pr
1 parent ed8b404 commit feeae07

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from setuptools_scm import get_version
22

3-
version = get_version(root='../', relative_to=__file__)
3+
version = get_version(root='../../', relative_to=__file__)
44
print(version.split('+')[0])
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Private Repo Testing
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: 'private-test-${{ github.event.pull_request.number }}'
10+
cancel-in-progress: true
11+
12+
jobs:
13+
trigger-private-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v6
26+
- name: Set up Node.js for UI build
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
- name: Install pnpm
31+
uses: pnpm/action-setup@v4
32+
with:
33+
version: latest
34+
- name: Install UI dependencies
35+
run: pnpm install
36+
- name: Build UI
37+
run: pnpm --prefix web/client run build
38+
- name: Install Python dependencies
39+
run: |
40+
python -m venv .venv
41+
source .venv/bin/activate
42+
pip install build twine setuptools_scm
43+
- name: Generate development version
44+
id: version
45+
run: |
46+
source .venv/bin/activate
47+
# Generate a development version using existing script
48+
DEV_VERSION=$(python .github/scripts/get_scm_version.py)
49+
echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT
50+
echo "Generated development version: $DEV_VERSION"
51+
- name: Build package
52+
run: |
53+
source .venv/bin/activate
54+
python -m build
55+
- name: Configure PyPI for private repository
56+
env:
57+
TOBIKO_PRIVATE_PYPI_URL: ${{ secrets.TOBIKO_PRIVATE_PYPI_URL }}
58+
TOBIKO_PRIVATE_PYPI_KEY: ${{ secrets.TOBIKO_PRIVATE_PYPI_KEY }}
59+
run: ./.circleci/update-pypirc.sh
60+
- name: Publish to private PyPI
61+
run: |
62+
source .venv/bin/activate
63+
python -m twine upload -r tobiko-private dist/*
64+
- name: Get commit information
65+
id: commit
66+
run: |
67+
echo "author=$(git log -1 --format='%an')" >> $GITHUB_OUTPUT
68+
echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
69+
echo "message=$(git log -1 --format='%s')" >> $GITHUB_OUTPUT
70+
- name: Get GitHub App token
71+
id: get_token
72+
uses: actions/create-github-app-token@v1
73+
with:
74+
private-key: ${{ secrets.TOBIKO_RENOVATE_BOT_PRIVATE_KEY }}
75+
app-id: ${{ secrets.TOBIKO_RENOVATE_BOT_APP_ID }}
76+
owner: ${{ secrets.PRIVATE_REPO_OWNER }}
77+
- name: Trigger private repository workflow
78+
uses: convictional/trigger-workflow-and-wait@v1.6.5
79+
with:
80+
owner: ${{ secrets.PRIVATE_REPO_OWNER }}
81+
repo: ${{ secrets.PRIVATE_REPO_NAME }}
82+
github_token: ${{ steps.get_token.outputs.token }}
83+
workflow_file_name: ${{ secrets.PRIVATE_WORKFLOW_FILE }}
84+
client_payload: |
85+
{
86+
"package_version": "${{ steps.version.outputs.version }}",
87+
"python_version": "3.12",
88+
"author": "${{ steps.commit.outputs.author }}",
89+
"hash": "${{ steps.commit.outputs.hash }}",
90+
"message": "${{ steps.commit.outputs.message }}",
91+
"pr_number": "${{ github.event.pull_request.number }}"
92+
}

0 commit comments

Comments
 (0)