-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PH] Create workflow for manually dispatching performance harness runs #1378
Changes from 46 commits
f7f246a
78564fa
7518f78
1f2ca01
975426a
947770e
8f01104
e3ae3a3
dc92ab5
6b4f745
8919364
feffc03
be9452b
754638d
cb73a84
b0075c0
a414b8c
3f13595
a83266b
158ad55
ba738b8
282cfe0
1de5698
c7695c0
0385511
f3097a2
4e2ebb0
f027744
2d7e8c4
96b3d71
fd54f6c
d0c1e2c
f995e47
41a1824
a1bcf4b
f4b7998
56e7a9d
7a12930
b1862f2
d1e099c
1e562e8
90f0852
a155889
6c86da5
1b9f64a
6c2758f
47ddeb6
4f3c5ef
f49f8c9
c597816
7670690
e5139d6
1a96850
775cce4
13424e2
78b16c5
b30be9c
4cb312e
45b6c77
bf95111
8c47cce
cd872b3
d50381b
b710831
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,15 @@ name: "Build leap" | |
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
override-build-matrix: | ||
description: 'Override build matrix' | ||
type: string | ||
required: false | ||
leap-ref: | ||
description: 'Override leap ref' | ||
default: ${{github.sha}} | ||
type: string | ||
outputs: | ||
p: | ||
description: "Discovered Build Platforms" | ||
|
@@ -58,19 +67,51 @@ jobs: | |
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} | ||
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}} | ||
|
||
pm: | ||
name: Platform Matrix | ||
needs: [d] | ||
if: always() && needs.d.result == 'success' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
platform-matrix: ${{steps.pm-results.outputs.platform-matrix}} | ||
steps: | ||
- uses: actions/github-script@v6 | ||
name: Parse Platform Matrix | ||
id: parse-pm | ||
with: | ||
script: return Object.keys(${{needs.d.outputs.p}}) | ||
- name: Check | Override result | ||
id: pm-results | ||
run: | | ||
echo 'platform-matrix=${{steps.parse-pm.outputs.result}}' >> $GITHUB_OUTPUT | ||
|
||
if [[ "${{inputs.override-build-matrix}}" != "" ]]; then | ||
echo "Executing override." | ||
echo 'platform-matrix=["${{inputs.override-build-matrix}}"]' >> $GITHUB_OUTPUT | ||
fi | ||
- name: Check matrix | ||
id: check-matrix | ||
run: | | ||
echo '${{ steps.pm-results.outputs.platform-matrix }}' | ||
echo '${{ steps.parse-pm.outputs.result }}' | ||
|
||
Build: | ||
name: Build leap | ||
needs: [d, build-platforms] | ||
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped') | ||
needs: [d, build-platforms, pm] | ||
if: | | ||
always() && | ||
needs.d.result == 'success' && | ||
(needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ubuntu20, ubuntu22] | ||
platform: ${{fromJSON(needs.pm.outputs.platform-matrix)}} | ||
runs-on: ["self-hosted", "enf-x86-beefy"] | ||
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: '${{inputs.leap-ref}}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems very problematic since on first look I don't believe the workflow+platform used to build leap will match up with the version of leap checked out. You will need to do more effort in at least 2 places to get this to work correctly, I would recommend against the added complexity. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I really had this working correctly, as you observed. I have removed this feature. |
||
submodules: recursive | ||
- name: Build | ||
id: build | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,19 @@ name: "Performance Harness Run" | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
platform-choice: | ||
description: 'Override build platform' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this isn't really overriding the platform but rather picking which platform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. Here it is a platform selection, however down in |
||
type: choice | ||
options: | ||
- ubuntu20 | ||
- ubuntu22 | ||
override-test-params: | ||
description: 'Override perf harness params' | ||
type: string | ||
override-leap-ref: | ||
description: 'Override leap ref' | ||
type: string | ||
|
||
permissions: | ||
packages: read | ||
|
@@ -12,10 +25,93 @@ defaults: | |
shell: bash | ||
|
||
jobs: | ||
tmp: | ||
name: Stub | ||
|
||
v: | ||
name: Discover Inputs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
test-params: ${{steps.overrides.outputs.test-params}} | ||
leap-ref: ${{steps.overrides.outputs.leap-ref}} | ||
steps: | ||
- name: Setup Input Params | ||
id: overrides | ||
env: | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this used any where? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed: 8c47cce |
||
run: | | ||
echo test-params=testBpOpMode >> $GITHUB_OUTPUT | ||
echo leap-ref='${{github.sha}}' >> $GITHUB_OUTPUT | ||
|
||
if [[ "${{inputs.override-test-params}}" != "" ]]; then | ||
echo test-params=${{inputs.override-test-params}} >> $GITHUB_OUTPUT | ||
fi | ||
if [[ "${{inputs.override-leap-ref}}" != "" ]]; then | ||
echo leap-ref=${{inputs.override-leap-ref}} >> $GITHUB_OUTPUT | ||
fi | ||
|
||
reuse-build: | ||
name: Reuse leap build | ||
needs: [v] | ||
if: | | ||
always() && | ||
needs.v.result == 'success' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Workflow Stub | ||
- name: Download builddir | ||
uses: AntelopeIO/asset-artifact-download-action@v2 | ||
with: | ||
owner: AntelopeIO | ||
repo: leap | ||
file: ${{github.event.inputs.platform-choice}}-build | ||
target: '${{needs.v.outputs.leap-ref}}' | ||
artifact-name: ${{github.event.inputs.platform-choice}}-build | ||
token: ${{github.token}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done: d50381b |
||
|
||
- name: Upload builddir | ||
uses: AntelopeIO/upload-artifact-large-chunks-action@v1 | ||
with: | ||
name: ${{github.event.inputs.platform-choice}}-build | ||
path: build.tar.zst | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comments as #1356 (comment): we shouldn't be copy pasting all of this, we need to come up with a better approach. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @spoonincode - I have refactored the build to be a reusable workflow in PR#1356. Hoping to have that PR go into |
||
|
||
build-base: | ||
name: Run Build Workflow | ||
needs: [reuse-build] | ||
if: always() && needs.reuse-build.result != 'success' | ||
uses: ./.github/workflows/build_base.yaml | ||
with: | ||
override-build-matrix: ${{github.event.inputs.platform-choice}} | ||
leap-ref: ${{needs.v.outputs.leap-ref}} | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
tests: | ||
name: Tests | ||
needs: [v, reuse-build, build-base] | ||
if: always() && (needs.build-base.result == 'success' || needs.reuse-build.result == 'success') | ||
runs-on: ubuntu-latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means it runs on a github owned runner, is that what you wanted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @spoonincode - Correct. I was using the github owned runner for initial testing and verification of the workflow. Now that this is closer to complete, do you have a suggestion for a runner to use ( |
||
container: | ||
image: ${{fromJSON(needs.build-base.outputs.p)[github.event.inputs.platform-choice].image}} | ||
steps: | ||
- name: Download builddir | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{github.event.inputs.platform-choice}}-build | ||
- name: Run Performance Test | ||
run: | | ||
zstdcat build.tar.zst | tar x | ||
cd build | ||
./tests/performance_tests/performance_test.py ${{needs.v.outputs.test-params}} | ||
- name: Prepare results | ||
id: prep-results | ||
run: | | ||
echo "Workflow Stub" | ||
tar -pc build/performance_test | zstd --long -T0 -9 > performance_test_logs.tar.zst | ||
- name: Upload results | ||
uses: AntelopeIO/upload-artifact-large-chunks-action@v1 | ||
with: | ||
name: performance-test-results | ||
path: performance_test_logs.tar.zst | ||
- name: Upload report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: performance-test-report | ||
path: ./build/performance_test/**/report.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's driving the need for adding this? You only want to build leap for a single platform when doing the performance harness test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it's worth the added complexity in
build_base.yaml
to accommodate that. Are you doing it just to save a dollar? I'd rather take the cost and not have 30+ more lines of yaml here to maintain forever, especially because PH runs aren't regularly done anyways.If you want to save cost I'd suggest pushing off the complexity in to the
performance_harness_run.yaml
by doing something like trying to fetch an existing built leap.deb & leap-dev.deb, and then only falling back to building leap if they don't exist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While being able to override the build matrix was in support of the
performance_harness_run.yaml
workflow, I also saw the generation of the platform matrix from theplatforms.json
input as a net gain as it removed the maintenance effort of going back and searching out everywhere that thematrix: platform: [ ubuntuXX, ubuntuYY, ...]
was used any time a new platform is added or removed. Now all that is accomplished in a single step by updatingplatforms.json
, which has become the single source of truth.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, not having to copy pasta around the
[ubuntuxx..]
is a good improvement. I'm a little worried we're going to have to refactor much of this soon again though because while right now there is a 1:1 between build platforms and test platforms that won't always be the case. That is, right nowubuntu22
means both building and testing onubuntu22
but that may not always be the case. For example, for our reproducible builds we may have a separaterepro
platform that is used for builds, but then tested on bothubuntu20
andubuntu22
. Or ARM builds may have acrossarm
platform for builds that then runs the tests onubuntu20arm
or something. I can't quite wrap my head around the semantics of how that is going to work just yet (besides adding more complexity 😞) so what is in this PR is good for now on that front.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. There is definitely a complexity addition that will come when that occurs. It could be that the
Platform Matrix
job provides a nice location to do the platform setup though and could be expanded to help with that? Might be that it breaks out into its own workflow. I agree that it is hard to say what will work best until some of those decisions are made. I'll consider this resolved for now per your comment.