Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
5cc163a
ci: remove sccache
shumkov Jun 15, 2023
8a5672a
ci: use s3 cache for local builds
shumkov Jun 15, 2023
3d96a90
ci: store docker cache mount in s3
shumkov Jun 15, 2023
7a1e926
ci: store docker layer cache in s3
shumkov Jun 15, 2023
9b06572
ci: fix "required property is missing: shell"
shumkov Jun 15, 2023
91fa3c3
ci: fix various issues
shumkov Jun 15, 2023
ffbf31b
ci: adjust timeouts
shumkov Jun 15, 2023
bb44ab4
ci: fix compose cache
shumkov Jun 15, 2023
67f49a6
ci: bring back to non-arch mounts for compatibility
shumkov Jun 15, 2023
b8d3e32
ci: fix dockerfile
shumkov Jun 16, 2023
684cea3
build: make sccache optional
shumkov Jun 16, 2023
123d893
build: add debug info
shumkov Jun 16, 2023
16256c9
build: try to fix cp issue
shumkov Jun 16, 2023
49ebeda
chore: store cache before running tests
strophy Jun 16, 2023
72b133b
chore: rename actions cache target path
strophy Jun 16, 2023
b223bd5
ci: store mount cache right after docker build
shumkov Jun 16, 2023
8f4194f
Merge remote-tracking branch 'origin/ci/s3_cache' into ci/s3_cache
shumkov Jun 16, 2023
8fbe625
build: fix dockerfile
shumkov Jun 16, 2023
00f7304
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jun 23, 2023
c0856d9
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jun 23, 2023
bc54179
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jun 23, 2023
63bd4b1
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jun 23, 2023
059007e
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jun 23, 2023
65a3e39
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jun 27, 2023
d564418
fix: cannot find libzmq.a: No such file or directory
strophy Jun 28, 2023
ad737d4
chore: add unplugged dir debug
strophy Jun 28, 2023
5da0b38
chore: fix debug dirs
strophy Jun 28, 2023
5849046
chore: increase buildkit logs cache to 10MB
strophy Jun 28, 2023
babf210
chore: enable cargo fingerprint debug again
strophy Jun 28, 2023
4e31419
chore: show cargo fingerprint during yarn build of wasm-bindgen
strophy Jun 28, 2023
8dad9f6
ci: add tmate session
shumkov Jun 28, 2023
fd1c921
ci: add tmate session
shumkov Jun 28, 2023
7239008
chore: downgrade zmq
shumkov Jun 28, 2023
51fa8b8
chore: downgrade zermoq to 5.2.*
shumkov Jun 29, 2023
2609162
chore: push deps
shumkov Jun 29, 2023
5dd6ffc
refactor: release workflow
shumkov Jun 29, 2023
7fb1953
chore: remove some debug
strophy Jun 29, 2023
8d3aad2
ci: fix release
shumkov Jun 29, 2023
13604be
fix: cannot read properties of undefined (reading 'tag_name')
strophy Jun 29, 2023
199378e
fix: release context doesn't exist if triggering with workflow_dispatch
strophy Jun 29, 2023
a5060ec
build: prevent of additional cargo-lock asn wasm-bindgen install
shumkov Jun 29, 2023
629933b
Merge remote-tracking branch 'origin/ci/s3_cache' into ci/s3_cache
shumkov Jun 29, 2023
f1b1d4e
chore: enable multiarch cache mounts
strophy Jun 29, 2023
4b45029
docs: add comments
shumkov Jun 29, 2023
fd2a4f6
refactor: rename `wasm_dpp_target` to ``target_wasm`
shumkov Jun 29, 2023
f355373
Merge branch 'v0.25-dev' into ci/s3_cache
strophy Jun 30, 2023
ca2d4e8
chore: revert to wasm-bindgen 0.2.86
strophy Jul 1, 2023
54d4f8b
build: compile proto everytime to make sure that rust files are exist
shumkov Jul 3, 2023
fa995a1
docs: update comments
shumkov Jul 3, 2023
dde1dfd
ci: build envoy with self-hosted runner
shumkov Jul 3, 2023
5b84683
build: persist compiled proto files
shumkov Jul 3, 2023
7d3a586
ci: use specific docker cache mounts
shumkov Jul 3, 2023
6f02610
ci: remove tmate
shumkov Jul 3, 2023
7039fbc
chore: increase buildkit logs cache to 10MB
strophy Jul 4, 2023
05bc777
ci: temporary disable release of arm64 images
shumkov Jul 4, 2023
505808d
ci: set aws creds
shumkov Jul 4, 2023
700b103
ci: separate manifests for targets
shumkov Jul 5, 2023
98153ed
ci: use correct order of manifest names
shumkov Jul 5, 2023
e25ccc4
ci: use image as manifest name to covert envoy case
shumkov Jul 5, 2023
5410aae
ci: bring arm64 image build back
shumkov Jul 5, 2023
78bb87a
build: use independent docker cache options for each service
shumkov Jul 5, 2023
4ffbea6
chore: test
shumkov Jul 5, 2023
19ecd29
chore: disable npm audit
shumkov Jul 5, 2023
ef71190
chore: remove unnecessary AWS auth
shumkov Jul 6, 2023
6e2e5a2
chore: remove duplicate drive check
shumkov Jul 6, 2023
3c09bee
refactor: remove duplicate docker layer cache configuration
shumkov Jul 6, 2023
3d2f515
ci: fix action path
shumkov Jul 6, 2023
444b52d
ci: add JS deps to s3-layer-cache-settings
shumkov Jul 7, 2023
6c9cce4
ci: commit node_modules for s3 cache action
shumkov Jul 7, 2023
976e63c
ci: change type of action to “to compose
shumkov Jul 7, 2023
1edd1b2
ci: fix input params in s3 cache action
shumkov Jul 7, 2023
f74fc47
chore: remove unnecessary .gitignore
shumkov Jul 7, 2023
8a753f8
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jul 7, 2023
b1bd5e1
Merge branch 'v0.25-dev' into ci/s3_cache
shumkov Jul 10, 2023
4aae031
revert: DAPI gRPC Rust files
shumkov Jul 10, 2023
c3ec8b8
chore: empty commit to fix CI
shumkov Jul 11, 2023
d421f66
fix: malformed manifest names
strophy Jul 11, 2023
71e8919
fix: unsafe forward slash chars in head ref
strophy Jul 11, 2023
978df4e
chore: empty commit to test ci
strophy Jul 11, 2023
f2f455a
fix: indentation
strophy Jul 11, 2023
4a1e034
chore: empty commit to fix CI
shumkov Jul 11, 2023
86a6b22
Merge branch 'ci/s3_cache' of github.com:dashpay/platform into ci/s3_…
shumkov Jul 11, 2023
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
101 changes: 67 additions & 34 deletions .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,81 @@
name: "Build Docker image"
description: "Build Docker image with Rust caching"
inputs:
dockerfile:
description: Path to the Dockerfile, for example `./Dockerfile`
required: true
image:
description: Name of image in Docker Hub, like `dashpay/drive`
required: true
dockerfile:
description: Path to the Dockerfile, for example `./Dockerfile`
default: './Dockerfile'
target:
description: "Target stage within Dockerfile: dapi, drive-abci, dashmate-helper, test-suite"
required: false
push:
description: Shall we push the image to Docker Hub?
default: "false"
dockerhub_username:
description: User name to use when pushing images to Docker Hub
required: false
dockerhub_token:
description: Docker Hub token to use
required: false
image_tag:
description: Docker image tag
default: ${{ github.head_ref || github.ref_name }}
platforms:
description: Docker image platform to build
default: amd64,arm64
cache_mounts:
description: Load cache mounts cache
cargo_profile:
description: Cargo build profile, i.e release or dev
default: release

runs:
using: composite
steps:
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ inputs.dockerhub_username }}
password: ${{ inputs.dockerhub_token }}
if: ${{ inputs.dockerhub_token != '' }}

- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: amd64,arm64
platforms: ${{ inputs.platforms }}

- name: Set up Docker Build
uses: docker/setup-buildx-action@v2.4.1
- name: Format platforms for docker
uses: actions/github-script@v6
id: platforms
with:
result-encoding: string
script: |
return '${{inputs.platforms}}'
.split(',')
.map((platform) => `linux/${platform.trim()}`)
.join(',')

- name: Login to DockerHub
uses: docker/login-action@v2
- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v2
with:
username: ${{ inputs.dockerhub_username }}
password: ${{ inputs.dockerhub_token }}
if: inputs.dockerhub_token != ''
install: true
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760
cleanup: false
platforms: ${{ steps.platforms.outputs.result }}
config-inline: |
[worker.oci]
gc = true
gckeepstorage = 40000 # 40 GB
[[worker.oci.gcpolicy]]
all = true
keepBytes = 30000000000 # 30 GB
keepDuration = 864000 # 10 days

- name: Load Docker mount cache
uses: dcginfra/buildkit-cache-dance/inject@main
if: ${{ inputs.cache_mounts != '' }}
with:
mounts: ${{ inputs.cache_mounts }}

- name: Set suffix
uses: actions/github-script@v6
Expand Down Expand Up @@ -74,32 +107,32 @@ runs:
suffix=${{ steps.suffix.outputs.result }},onlatest=true
latest=${{ github.event_name == 'release' }}

# ARM build takes very long time, so we build PRs for AMD64 only
- name: Select target platforms
shell: bash
id: select_platforms
run: |
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] ; then
echo "build_platforms=linux/amd64" >> $GITHUB_ENV
else
echo "build_platforms=linux/amd64,linux/arm64" >> $GITHUB_ENV
fi
- name: Configure docker layer cache
uses: ./.github/actions/s3-layer-cache-settings
id: layer_cache_settings
with:
name: ${{ inputs.image }}
head_ref: ${{ inputs.image_tag }}

- name: Build and push Docker image ${{ inputs.image }}
id: docker_build
uses: docker/build-push-action@v4.0.0
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ${{ inputs.dockerfile }}
target: ${{ inputs.target }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
SCCACHE_GHA_ENABLED=true
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}
CARGO_BUILD_PROFILE=dev
platforms: ${{ env.build_platforms }}
push: ${{ inputs.push }}
cache-from: type=s3,region=eu-west-1,bucket=platform-runner-cache
cache-to: type=s3,region=eu-west-1,bucket=platform-runner-cache,mode=max
CARGO_BUILD_PROFILE=${{ inputs.cargo_profile }}
platforms: ${{ steps.platforms.outputs.result }}
push: ${{ fromJSON(inputs.push) }}
cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }}
cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }}

- name: Save Docker mount cache
uses: dcginfra/buildkit-cache-dance/extract@main
if: ${{ inputs.cache_mounts != '' }}
with:
mounts: ${{ inputs.cache_mounts }}
38 changes: 38 additions & 0 deletions .github/actions/nodejs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: "Setup Node.JS"
description: "Setup Node.JS binaries, dependencies and cache"
runs:
using: composite
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: eu-west-1

- name: Setup Node.JS
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Enable corepack
shell: bash
run: corepack enable

- name: Disable NPM audit
shell: bash
run: npm config set audit false

- name: Cache NPM build artifacts
uses: everpcpc/actions-cache@v1
with:
bucket: platform-runner-cache
root: actions-cache
path: |
.yarn/unplugged
key: ${{ runner.os }}-yarn-unplugged-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-unplugged-

- name: Install dependencies
shell: bash
run: yarn install
28 changes: 15 additions & 13 deletions .github/actions/rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@ runs:
echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV
export PATH="${PATH}:${HOME}/.local/bin"

- name: Install sccache cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Set sccache Rust variables
shell: bash
run: |
echo SCCACHE_GHA_ENABLED=true >> $GITHUB_ENV
echo RUSTC_WRAPPER=sccache >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: eu-west-1

- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Cache Rust build artifacts
uses: everpcpc/actions-cache@v1
with:
# Don't cache ./target, as it takes tons of space, use sccache instead.
cache-targets: false
# We set a shared key, as our cache is reusable between jobs
shared-key: rust-cargo
bucket: platform-runner-cache
root: actions-cache
path: |
/home/ubuntu/.cargo/registry/index
/home/ubuntu/.cargo/registry/cache
/home/ubuntu/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install clang
id: deps-clang
Expand Down
66 changes: 66 additions & 0 deletions .github/actions/s3-layer-cache-settings/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 'Get S3 Docker Layer Cache settings'
description: |
This action generates string with s3-based cache configuration for docker buildx.
It defines three manifests:
- name and current commit to hit all builds for this commit (restart) with this name
- name and head ref to hit all builds for this branch with this name
- just name to hit all builds for this name

inputs:
name:
description: 'Cache key name will be used as a prefix for all docker image manifests'
required: true
head_ref:
description: 'Head ref for an additional manifest to hit all builds for this head'
default: ${{ github.head_ref }}
region:
description: S3 region
default: eu-west-1
bucket:
description: S3 bucket name
default: platform-runner-cache
prefix:
description: S3 key prefix
default: 'cache-layers/'
mode:
description: Cache mode
default: max

outputs:
cache_to:
description: 'String with s3-based cache configuration for docker buildx cache-to option'
value: ${{ steps.script.outputs.cache_to }}
cache_from:
description: 'String with s3-based cache configuration for docker buildx cache-from option'
value: ${{ steps.script.outputs.cache_from }}

runs:
using: composite
steps:
- uses: actions/github-script@v6
id: script
with:
script: |
const sanitizedHeadRef = '${{ inputs.head_ref }}'.replace(/[^a-zA-Z0-9]/g, '-');

const manifestNames = [
'${{ inputs.name }}_sha_${{ github.sha }}',
`${{ inputs.name }}_tag_${ sanitizedHeadRef }`,
'${{ inputs.name }}'
];

const settings = {
type: 's3',
region: '${{ inputs.region }}',
bucket: '${{ inputs.bucket }}',
prefix: '${{ inputs.prefix }}',
name: manifestNames.join(';'),
};

const settingsString = Object.entries(settings)
.filter(([,value]) => value !== '')
.map(([key, value]) => `${key}=${value}`)
.join(',');

core.setOutput('cache_from', settingsString);
core.setOutput('cache_to', `${settingsString},mode=${{ inputs.mode }}`);
Loading