Skip to content

Commit

Permalink
refactor(ci): move bls CI code to a separate action and improve ARM b…
Browse files Browse the repository at this point in the history
…uild (#314)

* refactor(ci): move bls CI code to a separate action

* fix(ci): e2e testnet matrix is invalid

* chore(ci): whitespace fix
  • Loading branch information
lklimek authored Mar 30, 2022
1 parent a138df2 commit 78b8111
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 255 deletions.
53 changes: 53 additions & 0 deletions .github/actions/bls/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: BLS
description: Build and install BLS library. Assumes the caller did actions/setup-go and actions-checkout.
inputs:
arch:
description: "Target architecture, one of: amd64 arm"
default: amd64
required: false
outputs:
bls_cache_key:
description: Key used by BLS cache
value: ${{ runner.os }}-${{ inputs.arch }}-bls-${{ steps.bls-revision.outputs.hash }}
runs:
using: composite
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- uses: actions/checkout@v2
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: actions/cache@v2
id: bls-cache
with:
path: ~/bls-cache
key: ${{ runner.os }}-${{ inputs.arch }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Build BLS library
run: make install-bls
if: steps.bls-cache.outputs.cache-hit != 'true'
shell: bash
- name: Save BLS library
run: |
mkdir -p ~/bls-cache/include
cp -vr /usr/local/include/chiabls ~/bls-cache/include
cp -vr /usr/local/include/relic* ~/bls-cache/include
cp -v /usr/local/lib/libchiabls.a ~/bls-cache/
if: steps.bls-cache.outputs.cache-hit != 'true'
shell: bash
- uses: actions/[email protected]
with:
path: ~/bls-cache
key: ${{ runner.os }}-${{ inputs.arch }}-bls-${{ steps.bls-revision.outputs.hash }}
if: steps.bls-cache.outputs.cache-hit != 'true'
- name: Install BLS library
run: |
sudo cp -vr ~/bls-cache/include/* /usr/local/include/
sudo cp -vr ~/bls-cache/libchiabls.a /usr/local/lib/
shell: bash
60 changes: 14 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,6 @@ on:
- v0.*-dev

jobs:
bls-signatures:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v2
with:
go-version: "^1.17"
- uses: actions/checkout@v2
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: actions/cache@v2
id: bls-cache
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Build BLS library
run: make install-bls
if: steps.bls-cache.outputs.cache-hit != 'true'
- name: Save BLS library
run: |
mkdir -p ~/bls-cache/include
cp -vr /usr/local/include/chiabls ~/bls-cache/include
cp -vr /usr/local/include/relic* ~/bls-cache/include
cp -v /usr/local/lib/libchiabls.a ~/bls-cache/
if: steps.bls-cache.outputs.cache-hit != 'true'
- uses: actions/[email protected]
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
if: steps.bls-cache.outputs.cache-hit != 'true'

build:
name: Build
runs-on: ubuntu-latest
Expand All @@ -70,9 +34,19 @@ jobs:
go.mod
go.sum
Makefile
- uses: ./.github/actions/bls
name: Install BLS library
if: "env.GIT_DIFF != ''"
with:
arch: ${{ matrix.goarch }}
- name: install-gcc
run: sudo apt-get update -qq && sudo apt-get install -qq --yes gcc-10-arm-linux-gnueabi g++-10-arm-linux-gnueabi
if: "matrix.goarch == 'arm'"
- name: install
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} make build
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} make build-binary
if: "env.GIT_DIFF != ''"
shell: bash

test_abci_cli:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -111,15 +85,9 @@ jobs:
**/**.go
go.mod
go.sum
- uses: actions/cache@v2
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Install BLS library
run: |
sudo cp -vr ~/bls-cache/include/* /usr/local/include/
sudo cp -vr ~/bls-cache/libchiabls.a /usr/local/lib/
- uses: ./.github/actions/bls
name: Install BLS library
if: "env.GIT_DIFF != ''"
- name: install
run: make install install_abci
if: "env.GIT_DIFF != ''"
Expand Down
112 changes: 12 additions & 100 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,12 @@ on:
- release/**

jobs:
bls-signatures:
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- uses: actions/checkout@v2
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: actions/cache@v2
id: bls-cache
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Build BLS library
run: make install-bls
if: steps.bls-cache.outputs.cache-hit != 'true'
- name: Save BLS library
run: |
mkdir -p ~/bls-cache/include
cp -vr /usr/local/include/chiabls ~/bls-cache/include
cp -vr /usr/local/include/relic* ~/bls-cache/include
cp -v /usr/local/lib/libchiabls.a ~/bls-cache/
if: steps.bls-cache.outputs.cache-hit != 'true'
- uses: actions/[email protected]
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
if: steps.bls-cache.outputs.cache-hit != 'true'

e2e-test-dashcore:
runs-on: ubuntu-latest
needs: bls-signatures
strategy:
fail-fast: true
matrix:
testnet: [ "dashcore", "rotate" ]
timeout-minutes: 25
env:
FULLNODE_PUBKEY_KEEP: false
Expand All @@ -59,85 +26,30 @@ jobs:
- uses: actions/[email protected]
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: technote-space/get-diff-action@v5
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/cache@v2
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Install BLS library
run: |
sudo cp -vr ~/bls-cache/include/* /usr/local/include/
sudo cp -vr ~/bls-cache/libchiabls.a /usr/local/lib/
- name: Build
working-directory: test/e2e
# Run two make jobs in parallel, since we can't run steps in parallel.
run: make -j2 docker runner tests
if: "env.GIT_DIFF != ''"
- name: Run CI dashcore testnet
working-directory: test/e2e
run: ./run-multiple.sh networks/dashcore.toml
- uses: ./.github/actions/bls
name: Install BLS library
if: "env.GIT_DIFF != ''"

- name: Emit dashcore logs on failure
if: ${{ failure() }}
working-directory: test/e2e
run: ./build/runner -f networks/dashcore.toml logs

e2e-test-rotate:
runs-on: ubuntu-latest
needs: bls-signatures
timeout-minutes: 35
env:
FULLNODE_PUBKEY_KEEP: false
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.17'
- uses: actions/[email protected]
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/cache@v2
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Install BLS library
run: |
sudo cp -vr ~/bls-cache/include/* /usr/local/include/
sudo cp -vr ~/bls-cache/libchiabls.a /usr/local/lib/
- name: Build
working-directory: test/e2e
# Run two make jobs in parallel, since we can't run steps in parallel.
run: make -j2 docker runner tests
if: "env.GIT_DIFF != ''"

- name: Run CI rotate testnet
- name: Run CI ${{ matrix.testnet }} testnet
working-directory: test/e2e
run: ./run-multiple.sh networks/rotate.toml
run: ./run-multiple.sh networks/${{ matrix.testnet }}.toml
if: "env.GIT_DIFF != ''"

- name: Emit rotate logs on failure
- name: Emit ${{ matrix.testnet }} logs on failure
if: ${{ failure() }}
working-directory: test/e2e
run: ./build/runner -f networks/rotate.toml logs
run: ./build/runner -f networks/${{ matrix.testnet }}.toml logs

55 changes: 5 additions & 50 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,70 +8,25 @@ on:
branches:
- master
jobs:
bls-signatures:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v2
with:
go-version: "^1.15.5"
- uses: actions/checkout@v2
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: actions/cache@v2
id: bls-cache
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Build BLS library
run: make install-bls
if: steps.bls-cache.outputs.cache-hit != 'true'
- name: Save BLS library
run: |
mkdir -p ~/bls-cache/include
cp -vr /usr/local/include/chiabls ~/bls-cache/include
cp -vr /usr/local/include/relic* ~/bls-cache/include
cp -v /usr/local/lib/libchiabls.a ~/bls-cache/
if: steps.bls-cache.outputs.cache-hit != 'true'
- uses: actions/[email protected]
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
if: steps.bls-cache.outputs.cache-hit != 'true'

golangci:
name: golangci-lint
runs-on: ubuntu-latest
needs: bls-signatures
timeout-minutes: 8
steps:
- uses: actions/[email protected]
with:
submodules: true
- name: Get BLS library revision
id: bls-revision
run: |
echo "::set-output name=hash::$(git --git-dir=third_party/bls-signatures/src/.git rev-parse HEAD)"
shell: bash
- uses: technote-space/get-diff-action@v5
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/cache@v2
with:
path: ~/bls-cache
key: ${{ runner.os }}-bls-${{ steps.bls-revision.outputs.hash }}
- name: Install BLS library
run: |
sudo cp -vr ~/bls-cache/include/* /usr/local/include/
sudo cp -vr ~/bls-cache/libchiabls.a /usr/local/lib/
- uses: ./.github/actions/bls
name: Install BLS library
if: "env.GIT_DIFF != ''"

- uses: golangci/[email protected]
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
Expand Down
Loading

0 comments on commit 78b8111

Please sign in to comment.