Skip to content

Commit f2205b4

Browse files
committed
add features is dockerfile and separate github action for features
1 parent a7f4d37 commit f2205b4

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

Diff for: .github/workflows/prod.yml

+39-17
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ env:
1212
CARGO_TERM_COLOR: always
1313

1414
jobs:
15-
build:
15+
build-arkworks:
1616
runs-on: ubuntu-latest
17-
strategy:
18-
matrix:
19-
rust: [stable]
20-
2117
steps:
2218
- uses: actions/checkout@v2
2319
- name: Install protobuf-compiler
@@ -26,26 +22,52 @@ jobs:
2622
uses: actions-rs/toolchain@v1
2723
with:
2824
profile: minimal
29-
toolchain: ${{ matrix.rust }}
25+
toolchain: stable
3026
override: true
3127
components: rustfmt, clippy
32-
- name: Build
28+
- name: Build with arkworks
3329
run: cargo build --release --verbose --features arkworks
34-
- name: Test
30+
- name: Test with arkworks
3531
run: cargo test --release --verbose --features arkworks
36-
- name: Lint
32+
- name: Lint with arkworks
3733
run: cargo clippy --release --features arkworks
38-
#- name: Format check (verbose)
39-
# run: cargo fmt -- --check --verbose $(find . -name '*.rs' -not -path './src/protobuf/*')
40-
41-
# New steps for Docker build
42-
- name: Set up Docker Buildx
43-
uses: docker/setup-buildx-action@v1
44-
- name: Build Docker image
34+
- name: Build Docker image with arkworks
4535
uses: docker/build-push-action@v2
4636
with:
4737
context: .
4838
push: false
49-
tags: drand:latest
39+
tags: drand:arkworks
40+
build-args: |
41+
FEATURES=arkworks
42+
cache-from: type=gha
43+
cache-to: type=gha,mode=max
44+
45+
build-blstrs:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v2
49+
- name: Install protobuf-compiler
50+
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
51+
- name: Install Rust
52+
uses: actions-rs/toolchain@v1
53+
with:
54+
profile: minimal
55+
toolchain: stable
56+
override: true
57+
components: rustfmt, clippy
58+
- name: Build with blstrs
59+
run: cargo build --release --verbose --features blstrs
60+
- name: Test with blstrs
61+
run: cargo test --release --verbose --features blstrs
62+
- name: Lint with blstrs
63+
run: cargo clippy --release --features blstrs
64+
- name: Build Docker image with blstrs
65+
uses: docker/build-push-action@v2
66+
with:
67+
context: .
68+
push: false
69+
tags: drand:blstrs
70+
build-args: |
71+
FEATURES=blstrs
5072
cache-from: type=gha
5173
cache-to: type=gha,mode=max

Diff for: Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ RUN apt-get update && apt-get install -y protobuf-compiler
1010
# Copy the current directory contents into the container at /app
1111
COPY . .
1212

13+
#default build is arkworks if not specified otherwise
14+
ARG FEATURES=arkworks
15+
1316
# Build the application
14-
RUN cargo build --release --features arkworks
17+
RUN cargo build --release --features ${FEATURES}
1518

1619
# Use the official Golang image to download the binary
1720
FROM golang:latest AS golang_builder

0 commit comments

Comments
 (0)