Skip to content

Commit 276d7d4

Browse files
committed
perf: compile artifacts & update child repo
1 parent 6f3a1c1 commit 276d7d4

File tree

2 files changed

+26
-82
lines changed

2 files changed

+26
-82
lines changed

.github/workflows/pi_build.yml

Lines changed: 26 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ env:
1313
GH_TOKEN: ${{ secrets.GH_TOKEN }}
1414

1515
jobs:
16-
pi-compile:
17-
name: 'Parent Images: Compile Requirements'
16+
pi-diff:
17+
name: 'Parent Images: Diff PI Types'
1818
runs-on: ubuntu-latest
1919
environment: dev
2020
env:
2121
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
2222
outputs:
23-
updated_parent_types: ${{ steps.run-compile.outputs.updated_parent_types }}
23+
updated_parent_types: ${{ steps.get-diff.outputs.updated_parent_types }}
2424
steps:
25-
- name: Checkout repository
25+
- name: Checkout Repository
2626
uses: actions/checkout@v4
2727
with:
2828
repository: ${{ github.repository_owner }}/refinery-submodule-parent-images
@@ -34,60 +34,16 @@ jobs:
3434
- name: Clone cicd-deployment-scripts
3535
run: git clone --branch parent-images https://github.com/code-kern-ai/cicd-deployment-scripts.git
3636

37-
- name: Set up Python
38-
uses: actions/setup-python@v5
39-
with:
40-
python-version: ${{ env.PYTHON_VERSION }}
41-
42-
- name: Install dependencies
43-
run: python -m pip install pip-tools
44-
45-
- name: Run compile
46-
id: run-compile
37+
- name: Get Diff Types
38+
id: get-diff
4739
run: |
48-
bash cicd-deployment-scripts/pi/compile.sh \
40+
bash cicd-deployment-scripts/pi/diff.sh \
4941
-p "${{ github.event.pull_request.number }}"
5042
51-
# pi-upload-artifacts:
52-
# name: 'Parent Images: Upload Artifacts'
53-
# runs-on: ubuntu-latest
54-
# needs: pi-compile
55-
# environment: dev
56-
# env:
57-
# PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
58-
# strategy:
59-
# matrix:
60-
# parent_image_type: ${{ fromJson(needs.pi-compile.outputs.updated_parent_types) }}
61-
# steps:
62-
# - name: Checkout repository
63-
# uses: actions/checkout@v4
64-
# with:
65-
# repository: ${{ github.repository_owner }}/refinery-submodule-parent-images
66-
# ref: ${{ github.event.pull_request.head.ref }}
67-
68-
# - name: Set up Python
69-
# uses: actions/setup-python@v5
70-
# with:
71-
# python-version: ${{ env.PYTHON_VERSION }}
72-
73-
# - name: Install dependencies
74-
# run: python -m pip install pip-tools
75-
76-
# - name: Compile Artifacts
77-
# run: pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
78-
79-
# # Save plan to artifacts
80-
# - name: Upload ${{ matrix.parent_image_type }}-requirements
81-
# uses: actions/upload-artifact@v4
82-
# with:
83-
# name: ${{ matrix.parent_image_type }}-requirements.txt
84-
# path: requirements/${{ matrix.parent_image_type }}-requirements.txt
85-
# if-no-files-found: error
86-
8743
pi-build:
8844
name: 'Parent Images: Docker Build'
8945
runs-on: ubuntu-latest
90-
needs: [pi-compile]
46+
needs: [pi-diff]
9147
environment: dev
9248
env:
9349
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
@@ -97,50 +53,42 @@ jobs:
9753
IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
9854
strategy:
9955
matrix:
100-
parent_image_type: ${{ fromJson(needs.pi-compile.outputs.updated_parent_types) }}
56+
parent_image_type: ${{ fromJson(needs.pi-diff.outputs.updated_parent_types) }}
10157
steps:
10258
- name: Checkout repository
10359
uses: actions/checkout@v4
10460
with:
10561
repository: '${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image'
10662
submodules: 'true'
10763
fetch-depth: 0
108-
64+
65+
- name: GitHub Configuration
66+
run: git config --global url."https://oauth2:${{ secrets.GH_TOKEN }}@github.com".insteadOf https://github.com
67+
10968
- name: Set up Python
11069
uses: actions/setup-python@v5
11170
with:
11271
python-version: ${{ env.PYTHON_VERSION }}
11372

114-
- name: Install dependencies
73+
- name: Install Dependencies
11574
run: python -m pip install pip-tools
11675

117-
# - name: Update submodules
118-
# run: |
119-
# echo "ls -l: $(pwd)"
120-
# ls -l
121-
# # cat ${{ github.workspace }}/submodules/parent-images/requirements/${{ matrix.parent_image_type }}-requirements.txt
122-
# cd submodules
123-
# echo "ls -l: $(pwd)"
124-
# ls -l
125-
# cd parent-images
126-
# echo "ls -l: $(pwd)"
127-
# ls -l
128-
12976
- name: Compile Artifacts
13077
run: |
13178
cd ${{ github.workspace }}/submodules/parent-images
132-
git checkout ${{ github.event.pull_request.head.sha }}
79+
git checkout ${{ github.event.pull_request.head.ref }}
13380
pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
134-
135-
# # Download requirements from artifacts
136-
# - name: Download ${{ matrix.parent_image_type }}-requirements
137-
# uses: actions/download-artifact@v4
138-
# with:
139-
# name: ${{ matrix.parent_image_type }}-requirements.txt
140-
# path: ${{ github.workspace }}/submodules/parent-images/requirements
141-
142-
# - name: GitHub Configuration
143-
# run: git config --global url."https://oauth2:${{ secrets.GH_TOKEN }}@github.com".insteadOf https://github.com
81+
cd ${{ github.workspace }}
82+
git checkout -b ${{ github.event.pull_request.head.ref }}
83+
git add submodules
84+
git commit -m "${{ github.event.pull_request.title }}"
85+
git push origin ${{ github.event.pull_request.head.ref }}
86+
gh pr create \
87+
--title "${{ github.event.pull_request.title }}" \
88+
--body "${{ github.event.pull_request.body }}" \
89+
--base dev \
90+
--head ${{ github.event.pull_request.head.ref }} \
91+
--repo ${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image
14492
14593
# - name: Clone cicd-deployment-scripts
14694
# run: git clone --branch parent-images https://github.com/code-kern-ai/cicd-deployment-scripts.git

pi/compile.sh renamed to pi/diff.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ while IFS= read -r file; do
2121
parent_image_type=$(basename $file | sed 's|-requirements.in||g')
2222
UPDATED_PARENT_TYPES+=($parent_image_type)
2323

24-
echo "::group::Compiling $parent_image_type-requirements.in"
25-
pip-compile requirements/$parent_image_type-requirements.in
26-
echo "::endgroup::"
27-
2824
done <<< "$UPDATED_FILES"
2925

3026
JSON=""

0 commit comments

Comments
 (0)