Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d013e04
bump nix and all cache versions
OriolMunoz-da Oct 6, 2025
607ecbd
[ci] run
OriolMunoz-da Oct 6, 2025
a3f0a03
use a ridiculous cache version
OriolMunoz-da Oct 6, 2025
5f160a3
[ci] run
OriolMunoz-da Oct 6, 2025
d423b6b
[ci] increase timeout on a test i just stumbled upon
OriolMunoz-da Oct 6, 2025
925e123
[ci] so surely if I don't restore the cache, this will work right?
OriolMunoz-da Oct 7, 2025
20fddda
Revert "[ci] so surely if I don't restore the cache, this will work r…
OriolMunoz-da Oct 7, 2025
eb97931
[ci] try with 2.28.5 (because breaking changes might be causing this)
OriolMunoz-da Oct 7, 2025
f299366
[ci] ok why are you different my dude
OriolMunoz-da Oct 7, 2025
6728a67
[ci] there's no sane reason why you're different
OriolMunoz-da Oct 7, 2025
4b56865
[ci] is this inherent to bumping nix or a version-related issue?
OriolMunoz-da Oct 7, 2025
6aafc5c
[ci] ok now with 14
OriolMunoz-da Oct 7, 2025
a02c1bb
[ci] attempt without GC
OriolMunoz-da Oct 7, 2025
dcbf412
[ci] try without mounting the damn thing
OriolMunoz-da Oct 8, 2025
bbecb2d
[ci] when did some verbose flags ever hurt anyone
OriolMunoz-da Oct 8, 2025
60248a2
[ci] log version in run
OriolMunoz-da Oct 8, 2025
0f94215
[ci] ok what happens if i create it beforehand
OriolMunoz-da Oct 8, 2025
10e8b5c
[ci] probably won't work but moritz says i can try
OriolMunoz-da Oct 8, 2025
f81368a
[ci] soilly me
OriolMunoz-da Oct 8, 2025
b74683b
[ci] orint env
OriolMunoz-da Oct 8, 2025
bcb3d44
[ci] add home to the cache key
OriolMunoz-da Oct 8, 2025
8b83e26
Merge branch 'main' into oriol/nix-electric-boogaloo
OriolMunoz-da Oct 8, 2025
6814e44
[ci] bump to 2.32.0 (released yesterday) and add it to the cache key
OriolMunoz-da Oct 8, 2025
a8aac68
fix comment
OriolMunoz-da Oct 8, 2025
9545649
remove env print
OriolMunoz-da Oct 8, 2025
78280cd
remove redundant mkdir
OriolMunoz-da Oct 8, 2025
b168596
gc before saving
OriolMunoz-da Oct 8, 2025
072a87f
[ci] run
OriolMunoz-da Oct 8, 2025
54979b4
[ci] bump cache key to see what happens
OriolMunoz-da Oct 8, 2025
daf9b99
[ci] seems more useful to run nix stuff after having nix loaded
OriolMunoz-da Oct 8, 2025
6fc6702
[ci] attempt with caches excluding personal profile stuff
OriolMunoz-da Oct 9, 2025
8f58bad
[ci] maybe exclude the DB too? (will this cache anything then?)
OriolMunoz-da Oct 9, 2025
ec92b34
[ci] stupid test: is the mount the problem?
OriolMunoz-da Oct 9, 2025
df9ba84
[ci] run pls gh
OriolMunoz-da Oct 9, 2025
dcc1db0
[ci] run pls gh
OriolMunoz-da Oct 9, 2025
8920f86
[ci] gh was broken so i can't trust that
OriolMunoz-da Oct 9, 2025
fd6a63a
Revert "[ci] gh was broken so i can't trust that"
OriolMunoz-da Oct 10, 2025
e75ba96
Revert "[ci] stupid test: is the mount the problem?"
OriolMunoz-da Oct 10, 2025
faeb743
Revert "[ci] maybe exclude the DB too? (will this cache anything then?)"
OriolMunoz-da Oct 10, 2025
285dc2e
Revert "[ci] attempt with caches excluding personal profile stuff"
OriolMunoz-da Oct 10, 2025
a5115a4
[ci] sensible cache_Version
OriolMunoz-da Oct 10, 2025
39c6b7e
Merge branch 'main' into oriol/nix-electric-boogaloo
OriolMunoz-da Oct 10, 2025
180665b
[ci] fix error...
OriolMunoz-da Oct 10, 2025
f39ce61
Add todos and [ci] for good measure
OriolMunoz-da Oct 10, 2025
a500bc5
Merge branch 'main' into oriol/nix-electric-boogaloo
OriolMunoz-da Oct 13, 2025
c9decd8
[ci] itai review fixes
OriolMunoz-da Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/nix/run_bash_command_in_nix/action.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't see the harm in keeping these

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ runs:
target="default"
fi
echo "Running command with nix version $(nix --version)"
# Attempt to build the nix env with retries to work around transient download failures
echo "building nix env"
MAX_RETRY_NIX_ENV=5
Expand All @@ -48,6 +50,7 @@ runs:
fi
nix develop \
path:nix#$target \
--verbose \
--ignore-environment \
--keep USER \
--keep HOME \
Expand Down Expand Up @@ -142,6 +145,7 @@ runs:
# Run the command for real within the nix environment
nix develop \
path:nix#$target \
--verbose \
--ignore-environment \
--keep USER \
--keep HOME \
Expand Down
20 changes: 14 additions & 6 deletions .github/actions/nix/setup_nix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ runs:
shell: bash
run: |
set -euxo pipefail
NIX_BINARY_VERSION=2.32.0
echo "NIX_BINARY_VERSION=$NIX_BINARY_VERSION" >> $GITHUB_ENV
cat nix/canton-sources.json
git ls-files nix/ | grep -v '[.]md$' | LC_ALL=C sort | xargs sha256sum -b > /tmp/nix-cache-key
uname -m >> /tmp/nix-cache-key # Add architecture to the cache key
echo "gh_cache_version: ${{ inputs.cache_version }}" >> /tmp/nix-cache-key # Add cache version to the cache key
echo "home: $HOME" >> /tmp/nix-cache-key # important when restoring simlinks from cache, apparently
echo "nix binary version: $NIX_BINARY_VERSION" >> /tmp/nix-cache-key # different nix versions might behave differently and corrupt the caches
if [ "${{ inputs.oss_only }}" == true ]; then
echo "Using OSS only dependencies"
echo "oss_only: ${{ inputs.oss_only }}" >> /tmp/nix-cache-key
Expand Down Expand Up @@ -86,8 +91,9 @@ runs:
# we use rsync here because it's simply faster to install
rsync -avi /cache/nix/$cache_key/.nix-* $HOME/
rsync -avi "/cache/nix/$cache_key/nix" $HOME/.config/
rsync -avi "/cache/nix/$cache_key/nix_store/var/" /nix/var
sudo mount --bind /cache/nix/$cache_key/nix_store/store /nix/store
# TODO (#2663): fix & uncomment these two lines
# rsync -avi "/cache/nix/$cache_key/nix_store/var/" /nix/var
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do uncomment that let's create an issue for it documenting how it fails and what you tried.

@martinflorian-da @nicu-da wdyt? I'm leaning towards saying getting an upgrade in with the slowdown and then moving the fix for this to the top of our prio list is better than to keep pushing out that upgrade for another few months (the pressure from slow CI also felt more so chances are higher we'll actually tackle it).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(With my limited context:) Agreed to merging this without this caching part, a bit worried about "just moving the fix to the top of our prio list". Can we give assign it to a concrete person already that will realistically get to it soon?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @martinflorian-da those 2 minutes were really annoying in the past, though I guess with the current CI timing it might be less so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2663 adding as TODOs

# sudo mount --bind /cache/nix/$cache_key/nix_store/store /nix/store
else
sudo mkdir -p "/cache/nix/$cache_key"
sudo chown $(whoami):$(whoami) "/cache/nix/$cache_key"
Expand Down Expand Up @@ -126,7 +132,7 @@ runs:
max-jobs = 16
EOF
fi
sh <(curl -fsSL --retry 8 https://releases.nixos.org/nix/nix-2.13.3/install) --no-daemon
sh <(curl -fsSL --retry 8 "https://releases.nixos.org/nix/nix-$NIX_BINARY_VERSION/install") --no-daemon
sudo mkdir -p /etc/nix
sudo chmod a+rw /etc/nix
if [[ "${{ inputs.oss_only }}" == true ]]; then
Expand All @@ -147,8 +153,6 @@ runs:
target="default"
fi
nix develop path:nix#${target} -v --profile "$HOME/.nix-shell" --command echo "Done loading packages"
echo "Garbage collecting to reduce cache size"
nix-store --gc
Comment on lines -150 to -151
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why it was done above, as opposed to before saving
Maybe because it would clean the mounted /nix/store? But I don't see much of a point in that, as it shouldn't have changed, and if it did, the cache-key would change... I think

fi
- name: Invoke nix before saving cache
Expand Down Expand Up @@ -176,6 +180,9 @@ runs:
export USER=$(whoami)
. ~/.nix-profile/etc/profile.d/nix.sh
echo "Garbage collecting to reduce cache size"
nix-store --gc
nix copy --all --to 'file:///cache/nix/binary_cache?trusted=1' -v
CLONE_COMMAND="rclone --no-update-dir-modtime --no-update-modtime --size-only --multi-thread-streams=32 --transfers=32 --ignore-existing --links --create-empty-src-dirs --fast-list --metadata --order-by name,mixed --retries 10 copy"
Expand All @@ -187,7 +194,8 @@ runs:
#requires to preserve read only during clone
sudo ${CLONE_COMMAND} /nix/store/ /cache/nix/$cache_key/nix_store/store
sudo ${CLONE_COMMAND} /nix/var/ "/cache/nix/$cache_key/nix_store/var"
# TODO (#2663): fix & uncomment this line
# sudo ${CLONE_COMMAND} /nix/var/ "/cache/nix/$cache_key/nix_store/var"
echo "done" > "/cache/nix/$cache_key/cached"
fi
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/tests/common_test_setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ runs:
with:
artifactory_user: ${{ inputs.artifactory_user }}
artifactory_password: ${{ inputs.artifactory_password }}
cache_version: 5
cache_version: 7
should_save: ${{ inputs.save_nix_cache }}
should_save_gcp: ${{ inputs.save_nix_cache_to_gcp }}
oss_only: ${{ inputs.oss_only }}
Expand All @@ -76,4 +76,4 @@ runs:
id: setup_sbt
uses: ./.github/actions/sbt/setup_sbt
with:
cache_version: 5
cache_version: 7
4 changes: 2 additions & 2 deletions .github/actions/tests/scala_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ runs:
id: setup_sbt
uses: ./.github/actions/sbt/setup_sbt
with:
cache_version: 5
cache_version: 7

- name: Set Daml package versions
uses: ./.github/actions/nix/run_bash_command_in_nix
Expand Down Expand Up @@ -285,7 +285,7 @@ runs:
if: ${{ !cancelled() }}
uses: ./.github/actions/sbt/post_sbt
with:
cache_version: 5
cache_version: 7
setup_sbt_cache_hits: ${{ steps.setup_sbt.outputs.cache_hits }}
# Save caches only from one runner, to reduce conflicts on the save
save_caches: ${{ inputs.runner_index == 0 && inputs.test_suite_name == 'wall-clock-time' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Post-SBT job
uses: ./.github/actions/sbt/post_sbt
with:
cache_version: 5
cache_version: 7
setup_sbt_cache_hits: ${{ steps.setup.outputs.sbt_cache_hits }}

- name: Report Failures on Slack & Github
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build.ts_cli_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:
# Checkout the PR head commit to get the commit message first
ref: ${{ github.event.pull_request.head.sha }}

- name: Check out repository code
uses: actions/checkout@v4
if: inputs.commit_sha != ''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this and below are the only ones that had this... what for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isegall-da is that leftover? I could see it only being set when you run from a fork but then it should be used for every checkout and it's definitely not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @isegall-da , don't want to merge without knowing this is 100% fine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @OriolMunoz-da now, just copying the conclusion here as well:
In these tests we do:
Checkout the PR head commit to get the commit message first
check the static label
Checkout commit_sha

In tests that run split_tests first, we check the static label in split_tests which is why we don't have these separate steps there, and we just checkout commit_sha there.

(in ts_cli we flipped the order between (2) and (3) which is wrong, we'll fix that)

with:
ref: ${{ inputs.commit_sha }}

- name: Check if static only
uses: ./.github/actions/tests/skip_on_static
id: skip
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}

- name: Check out repository code
uses: actions/checkout@v4
if: inputs.commit_sha != ''
with:
ref: ${{ inputs.commit_sha }}

- name: Setup
id: setup
if: steps.skip.outputs.skip != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
if: steps.skip.outputs.skip != 'true'
uses: ./.github/actions/sbt/post_sbt
with:
cache_version: 5
cache_version: 7
setup_sbt_cache_hits: ${{ steps.setup.outputs.sbt_cache_hits }}

- name: Upload logs
Expand Down
Loading