Skip to content

Commit

Permalink
chore: build image with optional SMT trie feature
Browse files Browse the repository at this point in the history
- add feature-tag at the end of image tag

- optional SMT trie feature
  see godwokenrises#859
  • Loading branch information
Flouse committed Feb 11, 2023
1 parent 89e6226 commit c02e36e
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ jobs:
gwos-evm-filehash: ${{ steps.prepare.outputs.gwos-evm-filehash }}

build-godwoken:
strategy:
matrix:
# optional SMT trie feature
# see https://github.com/godwokenrises/godwoken/pull/859
features: ['', 'smt-trie']
runs-on: ${{ inputs.runner_type || 'ubuntu-20.04' }}
# matrix: [with or without builtin consensus]
# TODO: build-godwoken-without-builtin-consensus:
Expand Down Expand Up @@ -190,7 +195,7 @@ jobs:
path: |
target/release/godwoken
target/release/gw-tools
key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.runner_type || 'ubuntu-20.04' }}-godwoken-${{ hashFiles('crates/**') }}
key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.runner_type || 'ubuntu-20.04' }}-godwoken-${{ matrix.features || 'default' }}-${{ hashFiles('crates/**') }}
- name: Cache Godwoken target directory
if: steps.godwoken-cache.outputs.cache-hit != 'true'
uses: actions/cache@v3
Expand All @@ -203,22 +208,27 @@ jobs:
- name: Build godwoken
id: build
if: steps.godwoken-cache.outputs.cache-hit != 'true'
env:
FEATURE_ARG: ${{ matrix.features && format('--features={0}', matrix.features) || '' }}
# Use SSE4.2, POPCNT, etc. These are available on almost all x86 CPUs in use today, including rosetta 2.
run: |
echo "install libclang required by autorocks-sys"
sudo apt update && sudo apt install -y libclang-dev
RUSTFLAGS="-C target-cpu=x86-64-v2" CARGO_PROFILE_RELEASE_LTO=true cargo build --release
RUSTFLAGS="-C target-cpu=x86-64-v2" CARGO_PROFILE_RELEASE_LTO=true cargo build --release ${{ env.FEATURE_ARG }}
- name: Archive godwoken binaries
# TODO: upload only once
# if: steps.godwoken-cache.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v3
with:
name: component.godwoken-${{ hashFiles('crates/**') }}
name: component.godwoken-${{ matrix.features || 'default' }}-${{ hashFiles('crates/**') }}
path: |
target/release/godwoken
target/release/gw-tools
outputs:
feature-tag: ${{ matrix.features && format('-{0}', matrix.features) || '' }}


# https://github.com/docker/build-push-action has a warning:
# > Subdirectory for Git context is available from BuildKit v0.9.0. If you're using the docker
# > builder (default if setup-buildx-action not used), then BuildKit in Docker Engine will be
Expand Down Expand Up @@ -276,6 +286,9 @@ jobs:
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
suffix=${{ needs.build-godwoken.outputs.feature-tag }},onlatest=true
# dynamically set date as a suffix
tags: |
type=ref,event=tag
Expand All @@ -288,6 +301,8 @@ jobs:
source.component.gwos=https://github.com/godwokenrises/godwoken/tree/${{ github.sha }}/gwos
source.component.gwos-evm=https://github.com/godwokenrises/godwoken/tree/${{ github.sha }}/gwos-evm
source.component.omni_lock=https://github.com/nervosnetwork/ckb-production-scripts/tree/rc_lock
- name: Echo steps.meta.outputs.bake-file
run: echo ${{ steps.meta.outputs.bake-file }}

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
Expand Down

0 comments on commit c02e36e

Please sign in to comment.