Skip to content

Commit

Permalink
Merge branch 'v1.3-dev' into chore/scripts/change-base-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov authored Sep 4, 2024
2 parents adbc62e + 7f350a6 commit b78c4ca
Show file tree
Hide file tree
Showing 201 changed files with 108,620 additions and 1,090 deletions.
11 changes: 11 additions & 0 deletions .cargo/config-release.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a config file used by Docker build process when building release version of drive-abci.
# Hopefully it can be removed once profile-rustflags is stabilized, see https://github.com/rust-lang/cargo/issues/10271

[target.aarch64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]

[target.x86_64-unknown-linux-musl]
rustflags = ["-C", "target-feature=-crt-static"]

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
20 changes: 16 additions & 4 deletions .github/actions/rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: "Rust Dependencies"
description: "Install dependencies"
inputs:
toolchain:
description: Rust toolchain to use, stable / nightly / beta, or exact version
# The same as in /README.md
default: "1.76"
description: Rust toolchain to use, stable / nightly / beta, or exact version; uses rust-toolchain.toml if not specified
default: ""
target:
description: Target Rust platform
required: false
Expand All @@ -21,11 +20,24 @@ inputs:
runs:
using: composite
steps:
- name: Extract Rust toolchain version from rust-toolchain.toml
shell: bash
id: rust_toolchain
run: |
TOOLCHAIN_VERSION="${{ inputs.toolchain }}"
if [[ -z "$TOOLCHAIN_VERSION" ]]; then
TOOLCHAIN_VERSION=$(grep channel rust-toolchain.toml | awk '{print $3}' | tr -d '"')
fi
echo "TOOLCHAIN_VERSION=$TOOLCHAIN_VERSION" >> $GITHUB_ENV
echo "::set-output name=version::$TOOLCHAIN_VERSION"
# TODO: Move to AMI and build every day
- uses: dtolnay/rust-toolchain@master
name: Install Rust toolchain
id: install_rust
with:
toolchain: ${{ inputs.toolchain }}
toolchain: ${{ steps.rust_toolchain.outputs.version }}
target: ${{ inputs.target }}
components: ${{ inputs.components }}

Expand Down
47 changes: 21 additions & 26 deletions .github/workflows/release-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ on:
type: string
description: Image target. i.e. drive-abci, dapi
required: true
tag:
type: string
description: Image tag, i.e. v0.1.0; note it can be inherited from 'workflow_dispatch' event
default: ${{ github.event.inputs.tag || github.event.release.tag_name }}
cargo_profile:
type: string
description: Cargo profile. i.e. release, dev
default: release
env:
DIGEST_NAME: digests-${{ inputs.image_org }}-${{ inputs.image_name }}-${{ github.sha }}
DIGEST_NAME: digests-${{ inputs.image_org }}-${{ inputs.image_name }}-${{ inputs.tag }}-${{ inputs.cargo_profile }}-${{ github.sha }}
DIGEST_DIR_PATH: /tmp/digests

jobs:
Expand All @@ -29,9 +37,9 @@ jobs:
strategy:
matrix:
include:
- runner: [ "self-hosted", "linux", "x64", "ubuntu-platform" ]
- runner: ["self-hosted", "linux", "x64", "ubuntu-platform"]
platform: linux/amd64
- runner: [ "self-hosted", "linux", "arm64", "ubuntu-platform" ]
- runner: ["self-hosted", "linux", "arm64", "ubuntu-platform"]
platform: linux/arm64
steps:
- name: Check out repo
Expand All @@ -52,10 +60,10 @@ jobs:
with:
image_name: ${{ inputs.image_name }}
image_org: ${{ inputs.image_org }}
image_version: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.event.release.tag_name }}
image_version: ${{ inputs.tag }}
target: ${{ inputs.target }}
platform: ${{ matrix.platform }}
cargo_profile: release
cargo_profile: ${{ inputs.cargo_profile }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
region: ${{ secrets.AWS_REGION }}
Expand Down Expand Up @@ -92,29 +100,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get image version
uses: actions/github-script@v6
id: version
with:
result-encoding: string
script: |
return (
context.eventName === 'workflow_dispatch'
? '${{ github.event.inputs.tag }}'
: context.payload.release.tag_name
);
- name: Set suffix
uses: actions/github-script@v6
id: suffix
with:
result-encoding: string
script: |
const fullTag = '${{ steps.version.outputs.result }}';
const fullTag = '${{ inputs.tag }}';
if (fullTag.includes('-')) {
const [, fullSuffix] = fullTag.split('-');
const [suffix] = fullSuffix.split('.');
return `-${suffix}`;
const suffixes = fullTag.split('-').slice(1);
const firstElements = suffixes.map(suffix => suffix.split('.')[0]);
return `-${firstElements.join('-')}`;
} else {
return '';
}
Expand All @@ -125,10 +121,10 @@ jobs:
with:
images: ${{ inputs.image_org }}/${{ inputs.image_name }}
tags: |
type=match,pattern=v(\d+),group=1,value=${{ steps.version.outputs.result }}
type=match,pattern=v(\d+.\d+),group=1,value=${{ steps.version.outputs.result }}
type=match,pattern=v(\d+.\d+.\d+),group=1,value=${{ steps.version.outputs.result }}
type=match,pattern=v(.*),group=1,value=${{ steps.version.outputs.result }},suffix=
type=match,pattern=v(.*),group=1,value=${{ inputs.tag }},priority=910,suffix=
type=match,pattern=v(\d+),group=1,value=${{ inputs.tag }}
type=match,pattern=v(\d+.\d+),group=1,value=${{ inputs.tag }}
type=match,pattern=v(\d+.\d+.\d+),group=1,value=${{ inputs.tag }}
flavor: |
suffix=${{ steps.suffix.outputs.result }},onlatest=true
latest=${{ github.event_name == 'release' }}
Expand All @@ -138,7 +134,6 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create manifest list and push
working-directory: ${{ env.DIGEST_DIR_PATH }}
run: |
Expand Down
37 changes: 33 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
tag:
description: "Version (i.e. v0.22.3-pre.2)"
required: true
only_drive:
type: boolean
description: Only build Drive image
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -17,7 +21,7 @@ concurrency:
jobs:
release-npm:
name: Release NPM packages
runs-on: [ "self-hosted", "linux", "arm64", "ubuntu-platform" ]
runs-on: ["self-hosted", "linux", "arm64", "ubuntu-platform"]
timeout-minutes: 15
if: github.event_name != 'workflow_dispatch'
steps:
Expand Down Expand Up @@ -81,7 +85,7 @@ jobs:
with:
result-encoding: string
script: |
const fullTag = context.payload.release.tag_name;
const fullTag = "${{ inputs.tag }}" || context.payload.release.tag_name;
if (fullTag.includes('-')) {
const [, fullSuffix] = fullTag.split('-');
const [suffix] = fullSuffix.split('.');
Expand All @@ -96,10 +100,15 @@ jobs:
with:
result-encoding: string
script: |
const tag = context.payload.release.tag_name;
const tag = "${{ inputs.tag }}" || context.payload.release.tag_name;
const [, major, minor] = tag.match(/^v([0-9]+)\.([0-9]+)/);
return (tag.includes('-') ? `${major}.${minor}-${{steps.suffix.outputs.result}}` : 'latest');
- name: Show NPM release tag
run: |
echo "NPM suffix: ${{ steps.suffix.outputs.result }}"
echo "NPM release tag: ${{ steps.tag.outputs.result }}"
- name: Configure NPM auth token
run: yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }}

Expand Down Expand Up @@ -136,40 +145,60 @@ jobs:
image_org: dashpay
image_name: drive
target: drive-abci
tag: ${{ inputs.tag || github.event.release.tag_name }}

release-drive-image-debug:
name: Release Drive debug image
secrets: inherit
uses: ./.github/workflows/release-docker-image.yml
with:
name: Drive
image_org: dashpay
image_name: drive
target: drive-abci
cargo_profile: dev
tag: ${{ inputs.tag || github.event.release.tag_name }}-debug

release-dapi-image:
name: Release DAPI image
if: ${{ !inputs.only_drive }}
secrets: inherit
uses: ./.github/workflows/release-docker-image.yml
with:
name: DAPI
image_org: dashpay
image_name: dapi
target: dapi
tag: ${{ inputs.tag || github.event.release.tag_name }}

release-test-suite-image:
name: Release Test Suite image
if: ${{ !inputs.only_drive }}
secrets: inherit
uses: ./.github/workflows/release-docker-image.yml
with:
name: Test Suite
image_org: dashpay
image_name: platform-test-suite
target: test-suite
tag: ${{ inputs.tag || github.event.release.tag_name }}

release-dashmate-helper-image:
name: Release Dashmate Helper image
secrets: inherit
if: ${{ !inputs.only_drive }}
uses: ./.github/workflows/release-docker-image.yml
with:
name: Dashmate Helper
image_org: dashpay
image_name: dashmate-helper
target: dashmate-helper
tag: ${{ inputs.tag || github.event.release.tag_name }}

release-dashmate-packages:
name: Release Dashmate packages
runs-on: ${{ matrix.os }}
if: ${{ !inputs.only_drive }}
needs: release-npm
permissions:
id-token: write # s3 cache
Expand All @@ -190,7 +219,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0

- name: Configure AWS credentials and bucket region
uses: aws-actions/configure-aws-credentials@v4
Expand Down
Loading

0 comments on commit b78c4ca

Please sign in to comment.