Skip to content

Commit 45ec6ab

Browse files
Merge pull request #2713 from hyperledger-labs/cocreature/canton-3.4-main
Merge remote-tracking branch 'origin/main' into canton-3.4
2 parents abbfa2e + c65a905 commit 45ec6ab

File tree

80 files changed

+1666
-781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1666
-781
lines changed

.github/actions/nix/run_bash_command_in_nix/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ runs:
3535
target="default"
3636
fi
3737
38+
echo "Running command with nix version $(nix --version)"
39+
3840
# Attempt to build the nix env with retries to work around transient download failures
3941
echo "building nix env"
4042
MAX_RETRY_NIX_ENV=5
@@ -48,6 +50,7 @@ runs:
4850
fi
4951
nix develop \
5052
path:nix#$target \
53+
--verbose \
5154
--ignore-environment \
5255
--keep USER \
5356
--keep HOME \
@@ -142,6 +145,7 @@ runs:
142145
# Run the command for real within the nix environment
143146
nix develop \
144147
path:nix#$target \
148+
--verbose \
145149
--ignore-environment \
146150
--keep USER \
147151
--keep HOME \

.github/actions/nix/setup_nix/action.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ runs:
3838
shell: bash
3939
run: |
4040
set -euxo pipefail
41+
NIX_BINARY_VERSION=2.32.0
42+
echo "NIX_BINARY_VERSION=$NIX_BINARY_VERSION" >> $GITHUB_ENV
43+
cat nix/canton-sources.json
4144
git ls-files nix/ | grep -v '[.]md$' | LC_ALL=C sort | xargs sha256sum -b > /tmp/nix-cache-key
4245
uname -m >> /tmp/nix-cache-key # Add architecture to the cache key
4346
echo "gh_cache_version: ${{ inputs.cache_version }}" >> /tmp/nix-cache-key # Add cache version to the cache key
47+
echo "home: $HOME" >> /tmp/nix-cache-key # important when restoring simlinks from cache, apparently
48+
echo "nix binary version: $NIX_BINARY_VERSION" >> /tmp/nix-cache-key # different nix versions might behave differently and corrupt the caches
4449
if [ "${{ inputs.oss_only }}" == true ]; then
4550
echo "Using OSS only dependencies"
4651
echo "oss_only: ${{ inputs.oss_only }}" >> /tmp/nix-cache-key
@@ -86,8 +91,9 @@ runs:
8691
# we use rsync here because it's simply faster to install
8792
rsync -avi /cache/nix/$cache_key/.nix-* $HOME/
8893
rsync -avi "/cache/nix/$cache_key/nix" $HOME/.config/
89-
rsync -avi "/cache/nix/$cache_key/nix_store/var/" /nix/var
90-
sudo mount --bind /cache/nix/$cache_key/nix_store/store /nix/store
94+
# TODO (#2663): fix & uncomment these two lines
95+
# rsync -avi "/cache/nix/$cache_key/nix_store/var/" /nix/var
96+
# sudo mount --bind /cache/nix/$cache_key/nix_store/store /nix/store
9197
else
9298
sudo mkdir -p "/cache/nix/$cache_key"
9399
sudo chown $(whoami):$(whoami) "/cache/nix/$cache_key"
@@ -126,7 +132,7 @@ runs:
126132
max-jobs = 16
127133
EOF
128134
fi
129-
sh <(curl -fsSL --retry 8 https://releases.nixos.org/nix/nix-2.13.3/install) --no-daemon
135+
sh <(curl -fsSL --retry 8 "https://releases.nixos.org/nix/nix-$NIX_BINARY_VERSION/install") --no-daemon
130136
sudo mkdir -p /etc/nix
131137
sudo chmod a+rw /etc/nix
132138
if [[ "${{ inputs.oss_only }}" == true ]]; then
@@ -147,8 +153,6 @@ runs:
147153
target="default"
148154
fi
149155
nix develop path:nix#${target} -v --profile "$HOME/.nix-shell" --command echo "Done loading packages"
150-
echo "Garbage collecting to reduce cache size"
151-
nix-store --gc
152156
fi
153157
154158
- name: Invoke nix before saving cache
@@ -176,6 +180,9 @@ runs:
176180
export USER=$(whoami)
177181
. ~/.nix-profile/etc/profile.d/nix.sh
178182
183+
echo "Garbage collecting to reduce cache size"
184+
nix-store --gc
185+
179186
nix copy --all --to 'file:///cache/nix/binary_cache?trusted=1' -v
180187
181188
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"
@@ -187,7 +194,8 @@ runs:
187194
188195
#requires to preserve read only during clone
189196
sudo ${CLONE_COMMAND} /nix/store/ /cache/nix/$cache_key/nix_store/store
190-
sudo ${CLONE_COMMAND} /nix/var/ "/cache/nix/$cache_key/nix_store/var"
197+
# TODO (#2663): fix & uncomment this line
198+
# sudo ${CLONE_COMMAND} /nix/var/ "/cache/nix/$cache_key/nix_store/var"
191199
192200
echo "done" > "/cache/nix/$cache_key/cached"
193201
fi

.github/actions/tests/common_test_setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ runs:
6464
with:
6565
artifactory_user: ${{ inputs.artifactory_user }}
6666
artifactory_password: ${{ inputs.artifactory_password }}
67-
cache_version: 5
67+
cache_version: 7
6868
should_save: ${{ inputs.save_nix_cache }}
6969
should_save_gcp: ${{ inputs.save_nix_cache_to_gcp }}
7070
oss_only: ${{ inputs.oss_only }}
@@ -76,4 +76,4 @@ runs:
7676
id: setup_sbt
7777
uses: ./.github/actions/sbt/setup_sbt
7878
with:
79-
cache_version: 5
79+
cache_version: 7

.github/actions/tests/scala_test/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ runs:
141141
id: setup_sbt
142142
uses: ./.github/actions/sbt/setup_sbt
143143
with:
144-
cache_version: 5
144+
cache_version: 7
145145

146146
- name: Set Daml package versions
147147
uses: ./.github/actions/nix/run_bash_command_in_nix
@@ -285,7 +285,7 @@ runs:
285285
if: ${{ !cancelled() }}
286286
uses: ./.github/actions/sbt/post_sbt
287287
with:
288-
cache_version: 5
288+
cache_version: 7
289289
setup_sbt_cache_hits: ${{ steps.setup_sbt.outputs.cache_hits }}
290290
# Save caches only from one runner, to reduce conflicts on the save
291291
save_caches: ${{ inputs.runner_index == 0 && inputs.test_suite_name == 'wall-clock-time' }}

.github/workflows/build.docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Post-SBT job
4949
uses: ./.github/actions/sbt/post_sbt
5050
with:
51-
cache_version: 5
51+
cache_version: 7
5252
setup_sbt_cache_hits: ${{ steps.setup.outputs.sbt_cache_hits }}
5353

5454
- name: Report Failures on Slack & Github

.github/workflows/build.static_tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
self_hosted:
1010
type: boolean
1111
required: true
12+
skip_todo_check:
13+
type: boolean
14+
required: false
15+
default: false
1216

1317
jobs:
1418
static_tests:
@@ -53,6 +57,7 @@ jobs:
5357

5458
- name: Checking TODOs
5559
uses: ./.github/actions/nix/run_bash_command_in_nix
60+
if: ${{ inputs.skip_todo_check == false }}
5661
with:
5762
cmd: |
5863
echo "PR number: $CIRCLE_PULL_REQUEST"

.github/workflows/build.ts_cli_tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ jobs:
2020
# Checkout the PR head commit to get the commit message first
2121
ref: ${{ github.event.pull_request.head.sha }}
2222

23-
- name: Check out repository code
24-
uses: actions/checkout@v4
25-
if: inputs.commit_sha != ''
26-
with:
27-
ref: ${{ inputs.commit_sha }}
28-
2923
- name: Check if static only
3024
uses: ./.github/actions/tests/skip_on_static
3125
id: skip
3226
with:
3327
gh_token: ${{ secrets.GITHUB_TOKEN }}
3428

29+
- name: Check out repository code
30+
uses: actions/checkout@v4
31+
if: inputs.commit_sha != ''
32+
with:
33+
ref: ${{ inputs.commit_sha }}
34+
3535
- name: Setup
3636
id: setup
3737
if: steps.skip.outputs.skip != 'true'

.github/workflows/build.ui_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
if: steps.skip.outputs.skip != 'true'
5959
uses: ./.github/actions/sbt/post_sbt
6060
with:
61-
cache_version: 5
61+
cache_version: 7
6262
setup_sbt_cache_hits: ${{ steps.setup.outputs.sbt_cache_hits }}
6363

6464
- name: Upload logs

.github/workflows/pr_non_contributors.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,3 @@ jobs:
3232
needs: env_hold
3333
with:
3434
commit_sha: ${{ github.event.pull_request.head.sha }}
35-
36-
# Note: unapproved runs must not be granted access to secrets, and must not run on self-hosted runners
37-
no_approval_static_tests:
38-
name: Static Tests (No Approval Required)
39-
uses: ./.github/workflows/build.static_tests.yml
40-
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
41-
secrets: {} # Explcitly do not grant access to secrets
42-
permissions:
43-
contents: read
44-
pull-requests: read # Required for the static tests
45-
issues: read # Required for the static tests
46-
with:
47-
self_hosted: false
48-
commit_sha: ${{ github.event.pull_request.head.sha }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Static checks for PRs from forks (No Approval Required)
2+
on:
3+
# unapproved runs must be on: pull_request, to prevent cache pollution on main
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
# Note: unapproved runs must not be granted access to secrets, and must not run on self-hosted runners
13+
no_approval_static_tests:
14+
name: Static Tests
15+
uses: ./.github/workflows/build.static_tests.yml
16+
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
17+
secrets: {} # Explcitly do not grant access to secrets
18+
permissions:
19+
contents: read
20+
with:
21+
self_hosted: false
22+
commit_sha: ${{ github.event.pull_request.head.sha }}
23+
skip_todo_check: true # runs from forks with on: pull_request run in context of the fork, so issue references will be broken

0 commit comments

Comments
 (0)