Skip to content

Commit a95fe4f

Browse files
committed
Add Action to build package for a specific branch, and push build target to "custom" branch.
1 parent 1d8db9b commit a95fe4f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# MIT licensed
2+
name: openMINDS_Python_build_pipeline
3+
4+
on:
5+
push:
6+
branches:
7+
- fairgraph-compat
8+
9+
jobs:
10+
build:
11+
if: github.repository == 'apdavison/openMINDS_Python'
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.13"]
16+
steps:
17+
18+
- name: Checkout Repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Run build
27+
run: |
28+
pip install -r requirements.txt
29+
python build.py
30+
31+
- name: Test built package
32+
run: |
33+
pip install pytest
34+
pip install ./target
35+
pytest -v pipeline/tests
36+
37+
- name: Checkout "custom" branch
38+
uses: actions/checkout@v4
39+
with:
40+
ref: custom
41+
path: custom
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
if: ${{ matrix.python-version == 3.13 }}
44+
45+
- name: Push to custom
46+
if: ${{ matrix.python-version == 3.13 }}
47+
run: |
48+
rsync -a --delete --exclude '.git/' --exclude 'img/' target/ custom/
49+
cd custom
50+
rm -rf build openMINDS.egg-info
51+
git config --global user.email "[email protected]"
52+
git config --global user.name "openMINDS pipeline"
53+
if [[ $(git add . --dry-run | wc -l) -gt 0 ]]; then
54+
git add .
55+
git commit -m "build triggered by ${{ github.event_name }}"
56+
git push -f
57+
else
58+
echo "Nothing to commit"
59+
fi

0 commit comments

Comments
 (0)