Skip to content

Commit a526ceb

Browse files
committed
Merge remote-tracking branch 'origin/revert-2308-ci/do-not-run-test-on-push' into revert-2308-ci/do-not-run-test-on-push
2 parents 79bb789 + 89e91cd commit a526ceb

Some content is hidden

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

50 files changed

+905
-529
lines changed

.devcontainer/Dockerfile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,30 @@ ENV PATH=$CARGO_HOME/bin:$PATH
4444
COPY rust-toolchain.toml .
4545
RUN TOOLCHAIN_VERSION="$(grep channel rust-toolchain.toml | awk '{print $3}' | tr -d '"')" && \
4646
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
47-
--profile minimal \
4847
-y \
4948
--default-toolchain "${TOOLCHAIN_VERSION}" \
5049
--target wasm32-unknown-unknown
5150
52-
# Install wasm-bindgen-cli in the same profile as other components, to sacrifice some performance & disk space to gain
53-
# better build caching
54-
RUN if [[ -z "${SCCACHE_MEMCACHED}" ]] ; then unset SCCACHE_MEMCACHED ; fi ; \
55-
RUSTFLAGS="-C target-feature=-crt-static" \
56-
# Meanwhile if you want to update wasm-bindgen you also need to update version in:
57-
# - packages/wasm-dpp/Cargo.toml
58-
# - packages/wasm-dpp/scripts/build-wasm.sh
59-
cargo install wasm-bindgen-cli@0.2.86 --locked
51+
# Download and install cargo-binstall
52+
ENV BINSTALL_VERSION=1.10.11
53+
RUN set -ex; \
54+
if [ "$TARGETARCH" = "amd64" ]; then \
55+
CARGO_BINSTALL_ARCH="x86_64-unknown-linux-musl"; \
56+
elif [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
57+
CARGO_BINSTALL_ARCH="aarch64-unknown-linux-musl"; \
58+
else \
59+
echo "Unsupported architecture: $TARGETARCH"; exit 1; \
60+
fi; \
61+
DOWNLOAD_URL="https://github.com/cargo-bins/cargo-binstall/releases/download/v${BINSTALL_VERSION}/cargo-binstall-${CARGO_BINSTALL_ARCH}.tgz"; \
62+
curl -L --fail --show-error "$DOWNLOAD_URL" -o /tmp/cargo-binstall.tgz; \
63+
tar -xzf /tmp/cargo-binstall.tgz -C /tmp cargo-binstall; \
64+
chmod +x /tmp/cargo-binstall; \
65+
/tmp/cargo-binstall -y --force cargo-binstall; \
66+
rm /tmp/cargo-binstall; \
67+
cargo binstall -V
68+
69+
RUN cargo binstall wasm-bindgen-cli@0.2.86 --locked \
70+
--no-discover-github-token \
71+
--disable-telemetry \
72+
--no-track \
73+
--no-confirm

.github/actions/docker/action.yaml

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ inputs:
2222
description: User name to use when pushing images to Docker Hub
2323
dockerhub_token:
2424
description: Docker Hub token to use
25-
cache_mounts:
26-
description: Load cache mounts cache
27-
default: |
28-
cargo_registry_index
29-
cargo_registry_cache
30-
cargo_git
3125
cargo_profile:
3226
description: Cargo build profile, i.e release or dev
3327
default: dev
@@ -43,6 +37,9 @@ inputs:
4337
aws_secret_access_key:
4438
description: AWS secret access key
4539
required: true
40+
cache_to_name:
41+
description: 'Save cache to name manifest (should be used only on default branch)'
42+
default: 'false'
4643
outputs:
4744
digest:
4845
value: ${{ steps.docker_build.outputs.digest }}
@@ -65,17 +62,10 @@ runs:
6562
install: true
6663
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760
6764
cleanup: false
68-
config-inline: |
65+
buildkitd-config-inline: |
6966
[worker.oci]
7067
gc = false
7168
72-
- name: Load Docker mount cache
73-
uses: dcginfra/buildkit-cache-dance/inject@s5cmd
74-
if: ${{ inputs.cache_mounts != '' }}
75-
with:
76-
bucket: ${{ inputs.bucket }}
77-
mounts: ${{ inputs.cache_mounts }}
78-
7969
- name: Set Docker tags and labels from image tag
8070
id: docker_meta
8171
uses: docker/metadata-action@v5
@@ -90,16 +80,83 @@ runs:
9080
id: layer_cache_settings
9181
with:
9282
name: ${{ inputs.image_name }}
83+
region: ${{ inputs.region }}
9384
bucket: ${{ inputs.bucket }}
85+
cache_to_name: ${{ inputs.cache_to_name }}
86+
87+
- name: Set HOME variable to github context
88+
shell: bash
89+
run: echo "HOME=$HOME" >> $GITHUB_ENV
90+
91+
- name: Cargo cache for Docker
92+
uses: actions/cache@v4
93+
id: cargo-cache
94+
with:
95+
path: |
96+
${{ env.HOME }}/cargo-cache-registry-index
97+
${{ env.HOME }}/cargo-cache-registry-cache
98+
${{ env.HOME }}/cargo-cache-git-db
99+
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
100+
restore-keys: |
101+
${{ runner.os }}-cargo-
102+
103+
- name: Inject cargo cache into docker
104+
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
105+
with:
106+
cache-map: |
107+
{
108+
"${{ env.HOME }}/cargo-cache-registry-index": {
109+
"target": "/root/.cargo/registry/index",
110+
"id": "cargo_registry_index"
111+
},
112+
"${{ env.HOME }}/cargo-cache-registry-cache": {
113+
"target": "/root/.cargo/registry/cache",
114+
"id": "cargo_registry_cache"
115+
},
116+
"${{ env.HOME }}/cargo-cache-git-db": {
117+
"target": "/root/.cargo/git/db",
118+
"id": "cargo_git"
119+
}
120+
}
121+
skip-extraction: ${{ steps.cargo-cache.outputs.cache-hit }}
122+
123+
- name: Yarn unplugged cache for Docker
124+
uses: actions/cache@v4
125+
id: yarn-cache
126+
with:
127+
path: ${{ env.HOME }}/yarn-unplugged-cache
128+
key: ${{ inputs.platform }}-yarn-unplugged-${{ hashFiles('yarn.lock') }}
129+
restore-keys: |
130+
${{ inputs.platform }}-yarn-unplugged-
131+
132+
- name: Set arch
133+
id: arch
134+
uses: actions/github-script@v6
135+
with:
136+
result-encoding: 'string'
137+
script: return '${{ inputs.platform }}'.replace('linux/', '');
138+
139+
- name: Inject cargo cache into docker
140+
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
141+
with:
142+
cache-map: |
143+
{
144+
"${{ env.HOME }}/yarn-unplugged-cache": {
145+
"target": "/tmp/unplugged",
146+
"id": "unplugged_${{ steps.arch.outputs.result }}"
147+
}
148+
}
149+
skip-extraction: ${{ steps.yarn-cache.outputs.cache-hit }}
94150

95151
- name: Build and push Docker image ${{ inputs.image }}
96152
id: docker_build
97-
uses: docker/build-push-action@v5
153+
uses: docker/build-push-action@v6
98154
with:
99155
context: .
100156
builder: ${{ steps.buildx.outputs.name }}
101157
target: ${{ inputs.target }}
102158
labels: ${{ steps.docker_meta.outputs.labels }}
159+
push: ${{ inputs.push_tags }}
103160
tags: ${{ inputs.push_tags == 'true' && steps.docker_meta.outputs.tags || '' }}
104161
platforms: ${{ inputs.platform }}
105162
build-args: |
@@ -113,10 +170,3 @@ runs:
113170
cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }}
114171
cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }}
115172
outputs: type=image,name=${{ inputs.image_org }}/${{ inputs.image_name }},push-by-digest=${{ inputs.push_tags != 'true' }},name-canonical=true,push=true
116-
117-
- name: Save Docker mount cache
118-
uses: dcginfra/buildkit-cache-dance/extract@s5cmd
119-
if: ${{ inputs.cache_mounts != '' }}
120-
with:
121-
bucket: ${{ inputs.bucket }}
122-
mounts: ${{ inputs.cache_mounts }}

.github/actions/librocksdb/action.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ inputs:
2121
runs:
2222
using: composite
2323
steps:
24-
# Cache librocksdb using s3 bucket
25-
- name: Restore cached librocksdb from S3
24+
- name: Cache librocksdb
25+
uses: actions/cache@v4
2626
id: librocksdb-cache
27-
uses: strophy/actions-cache@opendal-update
2827
with:
29-
bucket: ${{ inputs.bucket }}
30-
path: /opt/rocksdb
3128
key: librocksdb/${{ inputs.version }}/${{ runner.os }}/${{ runner.arch }}
29+
path: /opt/rocksdb
3230

3331
- if: ${{ steps.librocksdb-cache.outputs.cache-hit != 'true' || inputs.force == 'true' }}
3432
shell: bash

.github/actions/local-network/action.yaml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,27 @@ runs:
1111
- name: Setup Node.JS
1212
uses: ./.github/actions/nodejs
1313

14-
- name: Restore JS build artifacts
15-
uses: strophy/actions-cache@opendal-update
14+
- name: Download JS build artifacts
15+
uses: actions/download-artifact@v4
1616
with:
17-
bucket: multi-runner-cache-x1xibo9c
18-
root: actions-cache
19-
path: build-js-artifacts-${{ github.sha }}.tar
20-
key: build-js-artifacts/${{ github.sha }}
21-
22-
- name: Unpack JS build artifacts archive
23-
shell: bash
24-
run: tar -xf build-js-artifacts-${{ github.sha }}.tar
17+
name: js-build-${{ github.sha }}
18+
path: packages
2519

2620
- name: Get dashmate fingerprint
2721
id: dashmate-fingerprint
2822
shell: bash
2923
run: echo "sha=$(git log -1 --format="%h" -- packages/dashmate)" >> $GITHUB_OUTPUT
3024

31-
# TODO: Use upload artifacts action instead
25+
- name: Set HOME variable to github context
26+
shell: bash
27+
run: echo "HOME=$HOME" >> $GITHUB_ENV
28+
3229
- name: Restore local network data
3330
id: local-network-data
34-
uses: strophy/actions-cache/restore@opendal-update
31+
uses: actions/cache/restore@v4
3532
with:
36-
bucket: multi-runner-cache-x1xibo9c
37-
root: local-network-data
3833
path: |
39-
/home/ubuntu/.dashmate
34+
${{ env.HOME }}/.dashmate
4035
**/.env
4136
dashmate_volumes_dump
4237
key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}
@@ -68,12 +63,10 @@ runs:
6863
if: steps.local-network-data.outputs.cache-hit != 'true'
6964

7065
- name: Save local network data
71-
uses: strophy/actions-cache/save@opendal-update
66+
uses: actions/cache/save@v4
7267
with:
73-
bucket: multi-runner-cache-x1xibo9c
74-
root: local-network-data
7568
path: |
76-
/home/ubuntu/.dashmate
69+
${{ env.HOME }}/.dashmate
7770
**/.env
7871
dashmate_volumes_dump
7972
key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}
@@ -90,9 +83,9 @@ runs:
9083
docker tag ${{ inputs.image_org }}/dashmate-helper:$SHA_TAG dashpay/dashmate-helper:$VERSION
9184
9285
# Replace DAPI and Drive images with new org and tag in dashmate config
93-
sed -i -E "s/dashpay\/(drive|dapi):[^\"]+/${{ inputs.image_org }}\/\1:${SHA_TAG}/g" /home/ubuntu/.dashmate/config.json
86+
sed -i -E "s/dashpay\/(drive|dapi):[^\"]+/${{ inputs.image_org }}\/\1:${SHA_TAG}/g" ${{ env.HOME }}/.dashmate/config.json
9487
95-
cat /home/ubuntu/.dashmate/config.json
88+
cat ${{ env.HOME }}/.dashmate/config.json
9689
9790
- name: Start local network
9891
shell: bash

.github/actions/nodejs/action.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ runs:
1717
shell: bash
1818
run: npm config set audit false
1919

20-
- name: Cache NPM build artifacts (S3 bucket cache)
21-
uses: strophy/actions-cache@opendal-update
20+
- name: Cache NPM build artifacts
21+
uses: actions/cache@v4
2222
with:
23-
bucket: multi-runner-cache-x1xibo9c
24-
root: actions-cache
2523
path: |
2624
.yarn/unplugged
2725
key: ${{ runner.os }}/yarn/unplugged/${{ runner.arch }}/${{ hashFiles('yarn.lock') }}

.github/actions/rust/action.yaml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ inputs:
1717
required: false
1818
default: "true"
1919

20+
# TODO: Cache deps here to save 1 minute
2021
runs:
2122
using: composite
2223
steps:
@@ -32,10 +33,8 @@ runs:
3233
echo "TOOLCHAIN_VERSION=$TOOLCHAIN_VERSION" >> $GITHUB_ENV
3334
echo "::set-output name=version::$TOOLCHAIN_VERSION"
3435
35-
# TODO: Move to AMI and build every day
3636
- uses: dtolnay/rust-toolchain@master
3737
name: Install Rust toolchain
38-
id: install_rust
3938
with:
4039
toolchain: ${{ steps.rust_toolchain.outputs.version }}
4140
target: ${{ inputs.target }}
@@ -60,7 +59,6 @@ runs:
6059
;;
6160
esac
6261
63-
# TODO: Move to AMI and build every day
6462
- name: Check if protoc is installed
6563
id: check-protoc
6664
shell: bash
@@ -84,38 +82,35 @@ runs:
8482
echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV
8583
export PATH="${PATH}:${HOME}/.local/bin"
8684
87-
- name: Run sccache-cache
88-
uses: mozilla-actions/sccache-action@v0.0.3
85+
- name: Install sccache-cache
86+
uses: mozilla-actions/sccache-action@v0.0.6
8987
with:
90-
version: "v0.7.1" # Must be the same as in Dockerfile
88+
version: "v0.8.2" # Must be the same as in Dockerfile
9189
if: inputs.cache == 'true'
9290

93-
- name: Hash ref_name
94-
id: hashed-ref-name
91+
- name: Set HOME variable to github context
9592
shell: bash
96-
run: echo "key=$(echo '${{ github.ref_name }}' | sha256sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
93+
run: echo "HOME=$HOME" >> $GITHUB_ENV
9794

98-
- name: Cache cargo registry (S3 bucket cache)
99-
uses: strophy/actions-cache@opendal-update
95+
- name: Cache cargo registry
96+
uses: actions/cache@v4
10097
if: inputs.cache == 'true'
10198
with:
102-
bucket: multi-runner-cache-x1xibo9c
103-
root: actions-cache
10499
path: |
105-
/home/ubuntu/.cargo/registry/index
106-
/home/ubuntu/.cargo/registry/cache
107-
/home/ubuntu/.cargo/git
100+
${{ env.HOME }}/.cargo/registry/index
101+
${{ env.HOME }}/.cargo/registry/cache
102+
${{ env.HOME }}/.cargo/git
108103
key: ${{ runner.os }}/cargo/registry/${{ hashFiles('**/Cargo.lock') }}
109104
restore-keys: |
110105
${{ runner.os }}/cargo/registry/${{ hashFiles('**/Cargo.lock') }}
111106
${{ runner.os }}/cargo/registry/
112107
113-
# TODO: Move to AMI and build every day
114108
- name: Install clang
115109
id: deps-clang
116110
shell: bash
117111
if: runner.os == 'Linux'
118112
run: |
119113
sudo apt update -qq
120-
sudo apt install -qq --yes clang llvm
114+
# snappy is required by rust rocksdb
115+
sudo apt install -qq --yes clang llvm libsnappy-dev
121116
sudo update-alternatives --set cc /usr/bin/clang

0 commit comments

Comments
 (0)