-
Notifications
You must be signed in to change notification settings - Fork 57
fix(ci): install deps once then cache #1280
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
base: master
Are you sure you want to change the base?
Conversation
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.
thanks for showing initiative.
instead of caching dependencies, it might be even better to optimize them by avoiding them.
- building
p2pd
: could be downloaded as binary and added to path. this would avoid:- setup of go
- downloading sources and building
go-libp2p-daemon
- can pyton be avoided?
- could all platforms reuse nim dependencies? they are just source files? could we download them once and just reuse them in test jobs
- could there be only one
setup-dependencies
job (platform impended) that is reused by test jobs? if so this way to go, if not then there is not need of splittingsetup-dependencies
andtest
because it will just introduce unnecessary blocking.
1c99074
to
a41f101
Compare
Note - I removed the i386 platform from the matrix because no official 32-bit p2pd binary is available, causing build failures. So it needs to be removed if we don't want to install |
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.
@neriumpete sir, thanks for effort!
ci i currently failing, it looks like deamon is not in path or something? may i suggest to run changes in ci of your fork and push back here once it passes over there?
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.
LGTM - if ci is passing.
@neriumpete it would be also nice to update PR title and description to match what has been done in PR since it was changed since initial commit.
@richard-ramos it will require approval from you, and also removing i386
from ci test requirements since it was removed.
I think it should be fine to drop Linux i386 since this architecture should be rare (looking for examples across internet it seems to be used on older machines). Let's cc: @arnetheduck for his blessings / insight. --
Also, the commits must be signed. |
09557d6
to
d084bf5
Compare
Yeah after giving it some thought, let's drop i386 support. |
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.
LGTM!
Good work
|
||
# Verify p2pd before running tests | ||
export PATH="${{ github.workspace }}/p2pdCache:$PATH" | ||
echo "PATH: $PATH" |
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.
this echo is likely unneeded.
# Set GCC-14 as the default | ||
sudo update-alternatives --set gcc /usr/bin/gcc-14 | ||
|
||
- name: Run tests | ||
run: | | ||
source .venv/bin/activate |
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.
This is no longer needed. I ended up removing python from mbedtls (and ended up remobing mbedtls too :) )
- name: Setup python | ||
run: | | ||
mkdir -p .venv | ||
python -m venv .venv |
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.
This can be removed
- name: Setup python | |
run: | | |
mkdir -p .venv | |
python -m venv .venv |
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.
@richard-ramos not what suggestion implies? did you forget to make empty suggestion?
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... forgot to actually remove the code from my suggestion. fixed
# Verify p2pd before running tests | ||
export PATH="${{ github.workspace }}/p2pdCache:$PATH" | ||
echo "PATH: $PATH" |
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.
there is # Verify it's working
step above? is it really necessary to verify two times?
@@ -0,0 +1,57 @@ | |||
name: "Install p2pd" |
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.
this action didn't work?
Overview
This PR refactors the CI workflow to address the issue of redundant dependency installation and p2pd builds across multiple matrix jobs. By moving these steps into a dedicated job, we now install and cache dependencies only once per CI run, reducing overall build time and resource consumption.
Changes
Separated Dependency Setup:
setup-dependencies
) that runs before the matrix-basedtest
job.Caching Improvements:
Nimble Dependencies: Caches the
nimbledeps
directory using a key based on Nim version, builder, CPU type, and a hash of the.pinned
file.p2pd Build Artifact: Implements caching for the p2pd build, so it’s only built if the cache isn’t found.
Enhanced Environment Consistency:
Both the setup and test jobs now consistently configure the environment (using the same custom actions for Nim, and the appropriate setup for Go and Python).
Improved directory creation by using
mkdir -p
to ensure robustness.Concurrency Management:
The concurrency settings ensure that the setup job runs only once per branch or pull request, avoiding simultaneous redundant executions.
Impact
Improved Consistency: Ensures that all jobs run with the same pre-installed environment, reducing potential configuration discrepancies.
Closes #1154