Skip to content
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

ci: speed up workflows and reduce costs #1545

Merged
merged 260 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
260 commits
Select commit Hold shift + click to select a range
01260d0
ci: try multi-line expression
strophy Oct 31, 2023
6a39ac3
ci: add steps to build layer cache
strophy Oct 31, 2023
421c950
ci: refactor conditions and runs
strophy Oct 31, 2023
1b6b0b9
refactor: move things back and forth
shumkov Oct 31, 2023
4ed50f2
chore: empty commit to fix CI
shumkov Oct 31, 2023
bb69884
refactor: some renaming
shumkov Oct 31, 2023
8ad9d7b
refactor: continue to move things
shumkov Nov 1, 2023
2021e69
refactor: continue to move things
shumkov Nov 1, 2023
4ecfb59
refactor: continue to move things
shumkov Nov 1, 2023
71ea0e8
refactor: continue to move things
shumkov Nov 1, 2023
0523b78
refactor: continue to move things
shumkov Nov 1, 2023
5773e7a
ci: Save s3 cache failed: Error: getaddrinfo ENOTFOUND s3..amazonaws.com
strophy Nov 1, 2023
07ce3b6
ci: try to remove configure-aws-credentials step
strophy Nov 1, 2023
fbca54f
ci: try upstream actions-cache
strophy Nov 1, 2023
96290df
ci: try to use merged actions-cache
strophy Nov 1, 2023
f1f3989
ci: try with updated opendal
strophy Nov 1, 2023
8a42490
ci: run action from branch
strophy Nov 1, 2023
5c5c852
chore: trigger ci
strophy Nov 1, 2023
4f27dac
chore: trigger ci
strophy Nov 1, 2023
bc4ecaf
chore: trigger ci
strophy Nov 1, 2023
65b6f1d
chore: trigger ci
strophy Nov 1, 2023
e9c7149
chore: try to force endpoint
strophy Nov 1, 2023
ffe6f24
ci: revert to everpcpc action
strophy Nov 1, 2023
a15114c
ci: specify endpoint everywhere
strophy Nov 1, 2023
a20ff31
ci: revert to strophy actions-cache
strophy Nov 1, 2023
16612ca
chore: trigger ci
strophy Nov 1, 2023
a45139a
chore: reset to everpc for debug output to open issue
strophy Nov 1, 2023
2a4771f
Merge branch 'master' into ci/build-cache
shumkov Nov 1, 2023
2cc2f78
chore: remove defined endpoint
strophy Nov 1, 2023
63bb902
chore: trigger build with all everpcpc version
strophy Nov 1, 2023
aa370af
ci: try to force correct endpoint
strophy Nov 1, 2023
631602b
chore: move configure-aws-credentials to outer action
strophy Nov 1, 2023
00bacb4
chore: trigger ci
strophy Nov 1, 2023
9a9191c
ci: debug github context
strophy Nov 1, 2023
7c9d023
ci: use hashed ref_name to avoid slashes being parsed in S3
strophy Nov 1, 2023
aeb4e96
ci: remove debug
strophy Nov 1, 2023
8841231
ci: configure aws credentials outside rust/node actions
strophy Nov 1, 2023
defba96
chore: trigger ci
strophy Nov 1, 2023
677e078
chore: switch to using github_output
strophy Nov 1, 2023
b5c17f4
chore: trigger ci
strophy Nov 2, 2023
ee1203f
chore: debug images
strophy Nov 2, 2023
bff9aa0
chore: debug runner
strophy Nov 2, 2023
71875f8
chore: fetch region from repo vars
strophy Nov 3, 2023
a6a55f7
chore: push built images to ecr
strophy Nov 3, 2023
604ef3b
Merge branch 'master' into ci/build-cache
strophy Nov 3, 2023
4103141
ci: revert to hard-coded value for testing
strophy Nov 3, 2023
c19baf4
ci: use build artifacts instead of build
shumkov Nov 3, 2023
171b551
ci: show gitignores
shumkov Nov 3, 2023
ce0a69a
chore: remove debug
strophy Nov 3, 2023
a491cf9
ci: fix remove gitignore command
shumkov Nov 3, 2023
0b2b5a0
Merge remote-tracking branch 'origin/ci/build-cache' into ci/build-cache
shumkov Nov 3, 2023
75753bc
ci: remove build steps from test-suite
shumkov Nov 3, 2023
436215a
ci: fix js build artifacts list
shumkov Nov 3, 2023
39b66f2
ci: use ecr image names in ci
strophy Nov 3, 2023
3d65352
ci: use file with file changes
shumkov Nov 3, 2023
87687d9
Merge remote-tracking branch 'origin/ci/build-cache' into ci/build-cache
shumkov Nov 3, 2023
e241fde
chore: trigger ci
strophy Nov 6, 2023
946794a
fix: cache inaccessible before setting up aws credentials and region
strophy Nov 6, 2023
861f7b7
ci: remove tmate
strophy Nov 6, 2023
d798152
fix: cache inaccessible in test suite runs
strophy Nov 6, 2023
af89c72
fix: createEmptyBlocksInterval must match pattern "^[0-9]+(.[0-9]+)?(…
strophy Nov 6, 2023
6909305
fix: Workspace '@dashevo/dpp' not found
strophy Nov 6, 2023
9f91b44
ci: remove unnecessary steps
shumkov Nov 6, 2023
f45c129
ci: more fixes
shumkov Nov 6, 2023
dae57c3
ci: fix s3 auth creds
shumkov Nov 6, 2023
52d062a
ci: fix rs package jobs
shumkov Nov 6, 2023
13776f2
chore: don't cancel all runs when one fails
strophy Nov 6, 2023
9429b0c
ci: fix dashmate helper image name
shumkov Nov 6, 2023
4c32852
ci: fix cache paths
shumkov Nov 6, 2023
3a83dc7
chore: empty commit to fix CI
shumkov Nov 6, 2023
6ff61b2
ci: fix cache key paths
shumkov Nov 6, 2023
490c593
ci: optimize rust build
shumkov Nov 6, 2023
0245e20
ci: libs to lib
shumkov Nov 6, 2023
d47bd2f
ci: disable rust cache for formatting
shumkov Nov 6, 2023
4436a33
ci: reduce duplications in js packages
shumkov Nov 6, 2023
47a71ea
ci: try to remove locked
shumkov Nov 6, 2023
1559ab4
ci: reduce duplications in rs packages
shumkov Nov 6, 2023
89204a9
ci: run dashmate e2e tests without building
shumkov Nov 6, 2023
45c8dee
ci: fix string
shumkov Nov 6, 2023
2994e7f
ci: fix image pull
shumkov Nov 6, 2023
3947030
ci: fixed some issues
shumkov Nov 6, 2023
5cbe77f
ci: fixed some issues
shumkov Nov 6, 2023
0b0acce
ci: add frozen to clippy
shumkov Nov 6, 2023
f975e20
build: build base image
shumkov Nov 6, 2023
0ec3f57
ci: add debug information to test suite
shumkov Nov 6, 2023
14c2e8d
chore: trigger ci
strophy Nov 6, 2023
7ec084d
ci: fix multiple issues
shumkov Nov 7, 2023
2087428
Merge remote-tracking branch 'origin/ci/build-cache' into ci/build-cache
shumkov Nov 7, 2023
5659333
ci: fix syntax
shumkov Nov 7, 2023
a65453b
ci: fixed 'tage', move JS linting to GA runner, remove compilation er…
shumkov Nov 7, 2023
f432324
ci: fixed 'tage', move JS linting to GA runner, remove compilation er…
shumkov Nov 7, 2023
a72e9be
ci: fix linting and retimer
shumkov Nov 7, 2023
d3be298
chore: kick off CI
shumkov Nov 7, 2023
5fec03a
ci: move retimer to rust action
shumkov Nov 7, 2023
b065ba3
ci: fix build js
shumkov Nov 7, 2023
5611188
ci: fix build js
shumkov Nov 7, 2023
ac719db
ci: build images without js
shumkov Nov 7, 2023
4c4a53a
ci: fixed docker action
shumkov Nov 7, 2023
457c3f8
ci: fixed docker action platforms
shumkov Nov 7, 2023
f00b7b6
ci: fix something
shumkov Nov 7, 2023
6b98def
ci: enable incremental rust build
shumkov Nov 7, 2023
5de7bce
ci: some fixes
shumkov Nov 7, 2023
044f3a7
ci: some fixes
shumkov Nov 7, 2023
4c3a5f0
ci: split dashmate tests + some fixes
shumkov Nov 7, 2023
c780358
chore: kick off CI
shumkov Nov 7, 2023
a566ae0
ci: switch to s3 cache fork
shumkov Nov 7, 2023
53be75b
ci: test pattern is required
shumkov Nov 7, 2023
4e41ed5
docs: add some todos
shumkov Nov 7, 2023
bf3cde4
Merge branch 'master' into ci/build-cache
shumkov Nov 7, 2023
6b584f3
ci: fix image names + debug output
shumkov Nov 7, 2023
ed1d3a2
ci: added debug output
shumkov Nov 7, 2023
12bd828
chore: kick off CI
shumkov Nov 7, 2023
e0a0753
ci: disable rust cache
shumkov Nov 7, 2023
2b3b7cb
ci: add scache for rust builds
shumkov Nov 7, 2023
cdc6510
ci: add for wasm
shumkov Nov 7, 2023
ca6ca45
ci: switch dashmate tests to github runners
shumkov Nov 7, 2023
1f14eb2
build: use sccache for docker builds
shumkov Nov 7, 2023
4eeba04
ci: bring back toolchain
shumkov Nov 7, 2023
6fbec85
build: switch to stable toolchain
shumkov Nov 7, 2023
f406770
ci: return back registry cache mounts
shumkov Nov 7, 2023
5ace41f
build: fix sccache
shumkov Nov 7, 2023
0e40a67
ci: finally enable sccache
shumkov Nov 7, 2023
66f43a9
ci: finally enable sccache
shumkov Nov 7, 2023
716113d
chore: kick off CI
shumkov Nov 7, 2023
8454780
chore: kick off CI
shumkov Nov 7, 2023
4338cc9
ci: build images with x8 runner
shumkov Nov 7, 2023
8a4fc2e
ci: do not build images with x8 runner
shumkov Nov 7, 2023
11ed883
ci: do not build images with x8 runner
shumkov Nov 7, 2023
8e8aed8
ci: fix dapi image build
shumkov Nov 7, 2023
0043124
ci: fix volumes path output
shumkov Nov 7, 2023
c048f6a
ci: cache local network data
shumkov Nov 7, 2023
150bb7a
ci: fix cache pulling
shumkov Nov 7, 2023
e26af33
ci: fix cache pulling
shumkov Nov 7, 2023
6455cc1
chore: kick off CI
shumkov Nov 7, 2023
eef8b26
ci: cache local network data for dashmate e2e tests
shumkov Nov 7, 2023
8244c5b
ci: fix sccache key and dashmate helper pulling
shumkov Nov 7, 2023
74ad36b
ci: fix dashmate pulling
shumkov Nov 7, 2023
94b0b6d
chore: kick off CI
shumkov Nov 7, 2023
2b520a7
ci: fix dashmate sha output
shumkov Nov 7, 2023
a99d530
chore: kick off CI
shumkov Nov 7, 2023
bbf655b
chore: docker compose version debug
shumkov Nov 7, 2023
bc7d8e0
chore: kick off CI
shumkov Nov 7, 2023
775c16c
chore: some todos and minor refactoring
shumkov Nov 8, 2023
fd9c924
chore: move local network cache snapshot source to instance store
strophy Nov 8, 2023
34fd3f3
chore: move local-network-data cache to s3
strophy Nov 8, 2023
348a8b6
chore: trigger ci
strophy Nov 8, 2023
8c5df06
chore: check cache contents
strophy Nov 8, 2023
b07c756
chore: move skip condition inside test scope
strophy Nov 8, 2023
55243aa
chore: don't restore local-network-data in dashmate tests action
strophy Nov 8, 2023
7f21cc3
chore: try 8x runner
strophy Nov 8, 2023
f8cf09a
fix: incorrect runner call label
strophy Nov 8, 2023
84921f2
chore: revert to standard runners due to bucket permission problems
strophy Nov 8, 2023
37ae1ab
chore: restore local network data only for local test
shumkov Nov 8, 2023
9112dc6
chore: remove commented code
shumkov Nov 8, 2023
ce1e8df
chore: update release workflow
shumkov Nov 8, 2023
c9ee444
ci: switch docker image build to correct s3 bucket
shumkov Nov 8, 2023
b940309
chore(release): bump version to 0.25.0-pr.1545.2
shumkov Nov 8, 2023
5570c5a
chore(release): bump version to v1.0.0-pr.1545.2
shumkov Nov 8, 2023
81a83bc
ci: use correct restore action
shumkov Nov 8, 2023
bea6ae0
chore: kick off CI
shumkov Nov 8, 2023
1080cbf
ci: use correct restore action
shumkov Nov 9, 2023
6bb9fbe
ci: debug local network cache
shumkov Nov 9, 2023
d8309ca
ci: fix release workflow
shumkov Nov 9, 2023
bb5dcb0
ci: refactor action cache
shumkov Nov 9, 2023
52e7d7b
chore: trigger ci
strophy Nov 9, 2023
586cf38
ci: some fixes
shumkov Nov 9, 2023
07067c7
Merge remote-tracking branch 'origin/ci/build-cache' into ci/build-cache
shumkov Nov 9, 2023
6b00f53
fix: sccache download version mismatch
strophy Nov 9, 2023
8a8c545
build: add `SCCHACHE_VERSION` build arg
shumkov Nov 9, 2023
31c2c15
Merge remote-tracking branch 'origin/ci/build-cache' into ci/build-cache
shumkov Nov 9, 2023
8685d7e
chore: bump sccache version
shumkov Nov 9, 2023
f432b51
ci: dump and restore local volumes using docker run
shumkov Nov 9, 2023
7dea3b9
ci: move dump and restore to scripts
shumkov Nov 9, 2023
128a44f
ci: update runners and buckets
shumkov Nov 10, 2023
ab2694e
chore: kick off CI
shumkov Nov 10, 2023
725f0d2
ci: allow rust to pull deps
shumkov Nov 10, 2023
dc81e3f
test: fix dashmate setup skip
shumkov Nov 10, 2023
0205f26
ci: introduce matrix build for release and remove 8x runners
shumkov Nov 10, 2023
7ebfb46
ci: fix release workflow
shumkov Nov 10, 2023
6f4635f
ci: fix release workflow
shumkov Nov 10, 2023
a258b0a
ci: refactored docker
shumkov Nov 10, 2023
20b3fda
ci: mistype
shumkov Nov 10, 2023
4f4f9eb
chore: rename dashmate_helper to dashmate-helper image
shumkov Nov 10, 2023
ff3d017
ci: disable fast fail
shumkov Nov 10, 2023
f4691cd
ci: fix dashmate matrix
shumkov Nov 10, 2023
e664405
ci: fix test suite matrix
shumkov Nov 10, 2023
3be9ac5
ci: fix push tags
shumkov Nov 10, 2023
58f6685
ci: invalid tag condition
shumkov Nov 10, 2023
31ed71c
ci: fix release docker image workflow path
shumkov Nov 10, 2023
59461cf
ci: only one dashmate test is running
shumkov Nov 10, 2023
d0fc1f3
Merge branch 'master' into ci/build-cache
shumkov Nov 10, 2023
2eb973b
ci: remove extra matrix
shumkov Nov 10, 2023
f8d578a
chore: build on ARM
Nov 10, 2023
d4bde5f
ci: update opendal
shumkov Nov 10, 2023
fb615dd
chore: switch back to chrome
shumkov Nov 10, 2023
51b553b
ci: switch to arm64 runners
shumkov Nov 10, 2023
563cb67
ci: install protoc for arm64
shumkov Nov 10, 2023
dcba11a
chore: detect chromium
shumkov Nov 10, 2023
ec420d7
chore: fix detect chromium
shumkov Nov 10, 2023
8c6da42
ci: configure dashmate images
shumkov Nov 10, 2023
6a7840d
ci: configure dashmate images in right place
shumkov Nov 10, 2023
185a682
ci: fix uploading digest
shumkov Nov 10, 2023
4b2efe3
ci: fix restore local data in dashmate tests
shumkov Nov 10, 2023
e3392cc
ci: fix publish tags
shumkov Nov 10, 2023
a7ed7a8
ci: add debug info
shumkov Nov 11, 2023
f04cfc6
chore: introduced `CHROMIUM_BASED_BROWSER_NAME` env
shumkov Nov 11, 2023
6a8ee03
chore: introduced `CHROMIUM_BASED_BROWSER_NAME` env
shumkov Nov 11, 2023
0cd1c1f
chore: introduced `CHROMIUM_BASED_BROWSER_NAME` env
shumkov Nov 11, 2023
dee8e6a
chore: try just EdgeHeadless
shumkov Nov 11, 2023
69d01bc
test: set configGroup even in case if setup is skipped
shumkov Nov 11, 2023
082e219
ci: fix digest path
shumkov Nov 11, 2023
1dd7e0e
ci: fix digest name and test new runner
shumkov Nov 11, 2023
1965ade
ci: multiple fixes
shumkov Nov 11, 2023
722d3a0
ci: fix digest name
shumkov Nov 11, 2023
53315d9
chore: try insecure firefox
shumkov Nov 11, 2023
2f22e97
chore: bump version
shumkov Nov 11, 2023
060dde4
chore: bump the rest
shumkov Nov 11, 2023
3c88bed
chore: bump version again
shumkov Nov 11, 2023
4e646d0
test: read config if present
shumkov Nov 11, 2023
bc02130
chore: trigger 4x runner
strophy Nov 12, 2023
ea947f8
chore: change 4x runner labels
strophy Nov 12, 2023
902e15f
chore: remove firefox insecure (doesn't work)
shumkov Nov 12, 2023
b5b036e
Merge remote-tracking branch 'origin/ci/build-cache' into ci/build-cache
shumkov Nov 12, 2023
9970d06
ci: use 4x for build images
shumkov Nov 12, 2023
f1e29f4
ci: run rust test on 4x
shumkov Nov 12, 2023
e5f4062
ci: run linting on free runner + some optimizations
shumkov Nov 12, 2023
a4c5512
ci: fix tests4x
shumkov Nov 12, 2023
523e2be
ci: run linting on 2x
shumkov Nov 12, 2023
47b2798
ci: refactor calls
shumkov Nov 12, 2023
dcedc48
ci: fix test-runner input
shumkov Nov 12, 2023
9120679
ci: linter on free runner
shumkov Nov 12, 2023
b605297
test: run tests suite in parallel
shumkov Nov 12, 2023
6df7414
ci: test conditions
shumkov Nov 12, 2023
533b407
ci: test conditions
shumkov Nov 12, 2023
376e0ee
ci: test conditions
shumkov Nov 12, 2023
d3b98b7
ci: test conditions
shumkov Nov 12, 2023
9f42000
ci: test conditions
shumkov Nov 12, 2023
295d12e
ci: test conditions
shumkov Nov 12, 2023
34dd2e9
chore: fix linter
shumkov Nov 12, 2023
4d2257b
fix: multiple fixes
shumkov Nov 12, 2023
c973f32
fix: multiple fixes
shumkov Nov 12, 2023
47b1754
ci: use brave browser
shumkov Nov 13, 2023
9074b5f
ci: move functional tests to a separate job
shumkov Nov 13, 2023
3188982
tests: fix browser tests suite parallel loader
shumkov Nov 13, 2023
cda2028
ci: try multiple options for browser tests
shumkov Nov 13, 2023
1019b04
ci: fix local network action
shumkov Nov 13, 2023
ea4abe3
test: fix batching test suite in browsers
shumkov Nov 13, 2023
bd795d2
ci: remove testing jobs
shumkov Nov 13, 2023
196343b
ci: remove invalid input
shumkov Nov 13, 2023
007dddf
test: remove invalid assert in test suite
shumkov Nov 13, 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
114 changes: 42 additions & 72 deletions .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
---
name: "Build Docker image"
description: "Build Docker image with Rust caching"
name: "Build and push docker image"
description: "Build and push docker image by digest with Rust caching"
inputs:
image:
description: Name of image in Docker Hub, like `dashpay/drive`
image_name:
description: Name of image in Docker Hub, like `drive`
required: true
dockerfile:
description: Path to the Dockerfile, for example `./Dockerfile`
default: './Dockerfile'
image_org:
description: Docker Hub organization, like `dashpay`
default: dashpay
image_version:
description: Docker image semver. Commit SHA if empty
push_tags:
description: Push tags to registry or digest only
default: "false"
target:
description: "Target stage within Dockerfile: dapi, drive-abci, dashmate-helper, test-suite"
push:
description: Shall we push the image to Docker Hub?
default: "false"
platform:
description: Platform to build for. i.e linux/amd64 or linux/arm64
required: true
dockerhub_username:
description: User name to use when pushing images to Docker Hub
dockerhub_token:
description: Docker Hub token to use
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
default: |
cargo_registry_index
cargo_registry_cache
cargo_git
cargo_profile:
description: Cargo build profile, i.e release or dev
default: release
default: dev
bucket:
description: S3 bucket to use for caching, must match runner define in `runs-on`
default: multi-runner-cache-x1xibo9c
region:
description: S3 bucket region
required: true
outputs:
digest:
value: ${{ steps.docker_build.outputs.digest }}
description: Docker image digest

runs:
using: composite
Expand All @@ -42,81 +52,38 @@ runs:
password: ${{ inputs.dockerhub_token }}
if: ${{ inputs.dockerhub_token != '' }}

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

- 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: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v3
with:
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
gc = false
Copy link
Contributor

Choose a reason for hiding this comment

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

it means the cache size will grow indefinitely

Copy link
Member

Choose a reason for hiding this comment

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

We drop it every time. Only cargo registry mount is stored on S3 where we have own retention policy for files (3 days)


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

- name: Set suffix
uses: actions/github-script@v6
id: suffix
with:
result-encoding: string
script: |
const fullTag = '${{inputs.image_tag}}';
if (fullTag.includes('-')) {
const [, fullSuffix] = fullTag.split('-');
const [suffix] = fullSuffix.split('.');
return `-${suffix}`;
} else {
return '';
}

- name: Set Docker tags and labels
- name: Set Docker tags and labels from image tag
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.image }}
images: ${{ inputs.image_org }}/${{ inputs.image_name }}
tags: |
type=match,pattern=v(\d+),group=1,value=${{inputs.image_tag}}
type=match,pattern=v(\d+.\d+),group=1,value=${{inputs.image_tag}}
type=match,pattern=v(\d+.\d+.\d+),group=1,value=${{inputs.image_tag}}
type=match,pattern=v(.*),group=1,value=${{inputs.image_tag}},suffix=
flavor: |
suffix=${{ steps.suffix.outputs.result }},onlatest=true
latest=${{ github.event_name == 'release' }}
type=semver,pattern={{version}},value=${{inputs.image_version}},enable=${{ inputs.image_version != '' }}
strophy marked this conversation as resolved.
Show resolved Hide resolved
type=sha,format=long,enable=${{ inputs.image_version == '' }}

- 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: ${{ inputs.image_name }}
bucket: ${{ inputs.bucket }}

- name: Build and push Docker image ${{ inputs.image }}
Expand All @@ -125,19 +92,22 @@ runs:
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 }}
tags: ${{ inputs.push_tags == 'true' && steps.docker_meta.outputs.tags || '' }}
platforms: ${{ inputs.platform }}
build-args: |
CARGO_BUILD_PROFILE=${{ inputs.cargo_profile }}
platforms: ${{ steps.platforms.outputs.result }}
push: ${{ fromJSON(inputs.push) }}
RUSTC_WRAPPER=sccache
SCCACHE_BUCKET=${{ inputs.bucket }}
SCCACHE_REGION=${{ inputs.region }}
SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache
cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }}
cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }}
outputs: type=image,name=${{ inputs.image_org }}/${{ inputs.image_name }},push-by-digest=${{ inputs.push_tags != 'true' }},name-canonical=true,push=true

- name: Save Docker mount cache
uses: dcginfra/buildkit-cache-dance/extract@main
uses: dcginfra/buildkit-cache-dance/extract@s5cmd
if: ${{ inputs.cache_mounts != '' }}
with:
bucket: ${{ inputs.bucket }}
Expand Down
99 changes: 99 additions & 0 deletions .github/actions/local-network/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
name: "Start local network"
description: "Setup and start dashmate local network"
inputs:
image_org:
description: "Docker image organization"
required: true
runs:
using: composite
steps:
- name: Setup Node.JS
uses: ./.github/actions/nodejs

- name: Restore JS build artifacts
uses: strophy/actions-cache@opendal-update
with:
bucket: multi-runner-cache-x1xibo9c
root: actions-cache
path: build-js-artifacts-${{ github.sha }}.tar
key: build-js-artifacts/${{ github.sha }}

- name: Unpack JS build artifacts archive
shell: bash
run: tar -xf build-js-artifacts-${{ github.sha }}.tar

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

# TODO: Use upload artifacts action instead
Copy link
Contributor

Choose a reason for hiding this comment

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

check this todo

Copy link
Member

Choose a reason for hiding this comment

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

I wasn't going to do it this iteration

- name: Restore local network data
id: local-network-data
uses: strophy/actions-cache/restore@opendal-update
with:
bucket: multi-runner-cache-x1xibo9c
root: local-network-data
path: |
/home/ubuntu/.dashmate
**/.env
dashmate_volumes_dump
key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}

- name: Restore dashmate volumes
run: ./scripts/dashmate/volumes/restore.sh
shell: bash
if: steps.local-network-data.outputs.cache-hit == 'true'

- name: Setup local network
run: |
set -ex

# create tenderdash blocks every 10s to speed up test suite
yarn dashmate config set --config=local platform.drive.tenderdash.consensus.createEmptyBlocksInterval "10s"

# collect drive logs for bench suite
yarn dashmate config set --config=local platform.drive.abci.logs.stdout.level "trace"

./scripts/setup_local_network.sh
./scripts/configure_test_suite.sh
./scripts/configure_dotenv.sh
shell: bash
if: steps.local-network-data.outputs.cache-hit != 'true'

- name: Dump dashmate volumes
run: ./scripts/dashmate/volumes/dump.sh
shell: bash
if: steps.local-network-data.outputs.cache-hit != 'true'

- name: Save local network data
uses: strophy/actions-cache/save@opendal-update
with:
bucket: multi-runner-cache-x1xibo9c
root: local-network-data
path: |
/home/ubuntu/.dashmate
**/.env
dashmate_volumes_dump
key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}
if: steps.local-network-data.outputs.cache-hit != 'true'

- name: Configure pre-built docker images
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we get these images from? Looks like we assume they are already pushed (= we should have some dependency on another job declared above). Please add dependency/comment explaining that.

Copy link
Member

Choose a reason for hiding this comment

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

It's not a job, it's an action that pulls images to do the work. Workflows what use this action defines dependencies to build-images job.

shell: bash
run: |
SHA_TAG=sha-${{ github.sha }}
VERSION=$(cat package.json | jq -r '.version')

# Dashmate helper
docker pull ${{ inputs.image_org }}/dashmate-helper:$SHA_TAG
docker tag ${{ inputs.image_org }}/dashmate-helper:$SHA_TAG dashpay/dashmate-helper:$VERSION

# Replace DAPI and Drive images with new org and tag in dashmate config
sed -i -E "s/dashpay\/(drive|dapi):[^\"]+/${{ inputs.image_org }}\/\1:${SHA_TAG}/g" /home/ubuntu/.dashmate/config.json

cat /home/ubuntu/.dashmate/config.json

- name: Start local network
shell: bash
run: yarn start
23 changes: 3 additions & 20 deletions .github/actions/nodejs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,16 @@ runs:
shell: bash
run: npm config set audit false

- name: Configure AWS credentials and bucket region
uses: aws-actions/configure-aws-credentials@v4
if: contains(runner.name, 'ubuntu-platform')
with:
aws-region: eu-west-1

- name: Cache NPM build artifacts (S3 bucket cache)
uses: everpcpc/actions-cache@v1
if: contains(runner.name, 'ubuntu-platform')
uses: strophy/actions-cache@opendal-update
strophy marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

We should prefer @master, + we should migrate that repo to dashpay org

Copy link
Member

Choose a reason for hiding this comment

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

We expect some updates on upstream soon. When they don't we will change it.

with:
bucket: multi-runner-cache-x1xibo9c
root: actions-cache
path: |
.yarn/unplugged
key: ${{ runner.os }}-yarn-unplugged-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-unplugged-

- name: Cache NPM build artifacts (GitHub Actions cache)
uses: actions/cache@v3
if: ${{ !contains(runner.name, 'ubuntu-platform') }}
with:
path: |
.yarn/unplugged
key: ${{ runner.os }}-yarn-unplugged-${{ hashFiles('yarn.lock') }}
key: ${{ runner.os }}/yarn/unplugged/${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-unplugged-
${{ runner.os }}/yarn/unplugged/

- name: Install dependencies
shell: bash
Expand Down
Loading
Loading