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 #859
  • Loading branch information
Flouse authored and jjyr committed Feb 13, 2023
1 parent 6110103 commit 9dac5ea
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 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,24 @@ 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
# 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 All @@ -230,6 +237,11 @@ jobs:
#
# So the `docker-build-push` step was simply moved to a separate job.
docker-build-push:
strategy:
matrix:
# optional SMT trie feature
# see https://github.com/godwokenrises/godwoken/pull/859
features: ['', 'smt-trie']
needs: [build-scripts, build-godwoken]
runs-on: 'ubuntu-20.04'
# If you specify the access for any of these scopes, all of those that are not specified are set to none.
Expand Down Expand Up @@ -263,7 +275,7 @@ jobs:
- name: Download component.godwoken
uses: actions/download-artifact@v3
with:
name: component.godwoken-${{ hashFiles('crates/**') }}
name: component.godwoken-${{ matrix.features || 'default' }}-${{ hashFiles('crates/**') }}
path: target/release/
- name: Add executable permission to Godwoken binaries
run: chmod +x godwoken gw-tools
Expand All @@ -274,8 +286,13 @@ jobs:
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
env:
FEATURE_TAG: ${{ matrix.features && format('-{0}', matrix.features) || '' }}
with:
images: ${{ env.REGISTRY }}${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
suffix=${{ env.FEATURE_TAG }},onlatest=true
# dynamically set date as a suffix
tags: |
type=ref,event=tag
Expand All @@ -288,6 +305,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: cat ${{ 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 9dac5ea

Please sign in to comment.