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

Chore/small fixes #33

Merged
merged 6 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Functional Tests

on:
push:
tags: ['v*']
pull_request:
branches: [ "main" ]
branches: ['main']
workflow_dispatch:

jobs:
Expand All @@ -14,18 +16,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Build dkc script"
- name: 'Build dkc script'
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
- run: go build ../../

- name: "Install ethdo"
- name: 'Install ethdo'
run: |
go install "github.com/wealdtech/ethdo@$ethdo_version"
env:
ethdo_version: "v1.28.5"
- name: "Get Original Wallets"
ethdo_version: 'v1.28.5'
- name: 'Get Original Wallets'
run: |
#FIXME set -e is the default bash flag(this is not obvious btw need to fix)
account_pubkey_map='{}'
Expand All @@ -44,7 +46,7 @@ jobs:
done;
echo "account_pubkey_map=${account_pubkey_map}" >> $GITHUB_ENV

- name: "Prepare configs"
- name: 'Prepare configs'
run: |
#FIXME set -e is the default bash flag(this is not obvious btw need to fix)
cp config.yaml config-combine.yaml
Expand All @@ -56,7 +58,7 @@ jobs:
sed -i "s,DISTRIBUTED_WALLETS,$output_distributed_wallets_path,g" config-split.yaml
sed -i "s,ND_WALLETS,$output_nd_wallets_path,g" config-split.yaml

- name: "COMBINE Function Test"
- name: 'COMBINE Function Test'
run: |
#FIXME set -e is the default bash flag(this is not obvious btw need to fix)
#Combine
Expand All @@ -76,7 +78,7 @@ jobs:
echo -e "Account [$account]: ${green}OK${nc}"
done;

- name: "Split Function Test"
- name: 'Split Function Test'
run: |
#FIXME set -e is the default bash flag(this is not obvious btw need to fix)
#Split
Expand All @@ -96,10 +98,10 @@ jobs:
echo -e "Account [$account]: ${green}OK${nc}"
done;
env:
wallet_name: "DW"
input_distributed_wallets_path: "./wallets"
output_nd_wallets_path: "./nd_wallets"
output_distributed_wallets_path: "./distributed_wallets"
wallet_name: 'DW'
input_distributed_wallets_path: './wallets'
output_nd_wallets_path: './nd_wallets'
output_distributed_wallets_path: './distributed_wallets'
red: '\033[0;31m'
green: '\033[0;32m'
nc: '\033[0m'
142 changes: 68 additions & 74 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@ name: Release

on:
push:
tags:
- 'v*'
tags: ['v*']

env:
artifacts_name: "building-artifacts"
artifacts_name: 'building-artifacts'

jobs:
tests-and-linters:
uses: ./.github/workflows/build.yaml

prepare:
name: Prepare Variables
runs-on: [ubuntu-latest]
needs: tests-and-linters
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.enver.outputs.release_version }}
steps:

- name: Set env
id: enver
run: |
# Release tag comes from the github reference.
RELEASE_TAG=$(echo ${GITHUB_REF} | sed -e 's!.*/!!')
# Ensure the release tag has expected format.
echo ${RELEASE_TAG} | grep -q '^v' || exit 1
# Release version is same as release tag without leading 'v'.
RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -e 's!.*/v!!')
echo "release_version=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"

- name: Set env
id: enver
run: |
# Release tag comes from the github reference.
RELEASE_TAG=$(echo ${GITHUB_REF} | sed -e 's!.*/!!')
# Ensure the release tag has expected format.
echo ${RELEASE_TAG} | grep -q '^v' || exit 1
# Release version is same as release tag without leading 'v'.
RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -e 's!.*/v!!')
echo "release_version=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"

build:
name: Build For Different Arch
Expand All @@ -42,69 +39,66 @@ jobs:
env:
release_version: ${{needs.prepare.outputs.release_version}}
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: "Setup Go"
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
id: go

- name: Set env
run: |
# Set arch related variables
echo "goos=$(go env GOOS)" >> $GITHUB_ENV
echo "goarch=$(go env GOARCH)" >> $GITHUB_ENV

- name: Build on ${{runner.os}}
run: |
#Building for main platform
go build -o dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}} -ldflags="-X github.com/p2p-org/dkc/cmd.ReleaseVersion=${{env.release_version}}" .
tar zcf dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.tar.gz dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}
shasum -a 256 dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.tar.gz >dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.sha256

- name: Save to artifacts
id: artifacts-save
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifacts_name }}
path: |
./dkc-**.tar.gz
./dkc-**.sha256
if-no-files-found: error

- name: Checkout code
uses: actions/checkout@v2

- name: 'Setup Go'
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
id: go

- name: Set env
run: |
# Set arch related variables
echo "goos=$(go env GOOS)" >> $GITHUB_ENV
echo "goarch=$(go env GOARCH)" >> $GITHUB_ENV

- name: Build on ${{runner.os}}
run: |
#Building for main platform
go build -o dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}} -ldflags="-X github.com/p2p-org/dkc/cmd.ReleaseVersion=${{env.release_version}}" .
tar zcf dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.tar.gz dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}
shasum -a 256 dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.tar.gz >dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.sha256

- name: Save to artifacts
id: artifacts-save
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifacts_name }}
path: |
./dkc-**.tar.gz
./dkc-**.sha256
if-no-files-found: error

release:
name: Publish Release
runs-on: ubuntu-latest
needs:
- build
- prepare
- build
- prepare
env:
release_version: ${{needs.prepare.outputs.release_version}}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.artifacts_name }}

- name: Run Changelog CI
uses: saadmk11/changelog-ci@v1.1.1
with:
release_version: ${{ env.release_version }}

- name: Create Release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: |
./dkc-**.tar.gz
./dkc-**.sha256
generate_release_notes: true
fail_on_unmatched_files: true

- name: Checkout code
uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.artifacts_name }}

- name: Run Changelog CI
uses: saadmk11/changelog-ci@v1.1.1
with:
release_version: ${{ env.release_version }}

- name: Create Release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: |
./dkc-**.tar.gz
./dkc-**.sha256
generate_release_notes: true
fail_on_unmatched_files: true
4 changes: 3 additions & 1 deletion .github/workflows/snyk.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Snyk Vulnerabilities Checker
on:
push:
tags: ['v*']
pull_request:
branches: [ "main" ]
branches: ['main']
workflow_dispatch:
schedule:
- cron: '00 10 * * 1'
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/build.yaml → .github/workflows/tests.yaml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Integration tests
name: Tests

on:
push:
tags: ['v*']
pull_request:
branches:
- 'master'
workflow_call:
branches: ['main']
workflow_dispatch:

jobs:
go-tests:
Expand All @@ -29,3 +30,15 @@ jobs:

- name: Run golang lint
uses: golangci/golangci-lint-action@v3

nix-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v20

- name: Run nix flake check
run: nix flake check
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ go build .

:bangbang: Before you begin, make sure you backup keys and store recovered wallets and passwords securely.

`dkc` uses [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary). The pseudocode of using [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary) in `dkc` is available [here](./example/split.go)
`dkc` uses [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary). Some research code of using [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary) in `dkc` is available [here](./research/research.go)

You can also test `dkc` on predefiened inputs [here](.github/workflows/func-tests.yml).

Expand Down
Loading