Skip to content

Commit cf10b37

Browse files
committed
Build proto in Docker
1 parent 7ef3d77 commit cf10b37

File tree

5 files changed

+114
-36
lines changed

5 files changed

+114
-36
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ on: # rebuild any PRs and main branch changes
66
branches:
77
- main
88

9-
env:
10-
DOTNET_SDK_VERSION: "1.7.0"
11-
GO_SDK_VERSION: "1.35.0"
12-
JAVA_SDK_VERSION: "1.30.1"
13-
TYPESCRIPT_SDK_VERSION: "1.12.1"
14-
GO_VERSION: "^1.21"
15-
JAVA_VERSION: "11"
16-
PROTOC_GEN_GO_VERSION: "v1.31.0"
17-
PROTOC_VERSION: "25.1"
18-
PYTHON_SDK_VERSION: "1.14.1"
19-
PYTHON_VERSION: "3.10"
20-
RUST_TOOLCHAIN: "1.74.0"
21-
229
jobs:
2310
build-lint-test-go:
2411
runs-on: ubuntu-latest
@@ -27,6 +14,10 @@ jobs:
2714
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
2815
- name: Checkout repo
2916
uses: actions/checkout@v2
17+
- name: Load versions
18+
run: |
19+
set -a && source versions.env && set +a
20+
printenv >> $GITHUB_ENV
3021
- name: Setup Go
3122
uses: actions/setup-go@v2
3223
with:
@@ -51,6 +42,10 @@ jobs:
5142
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
5243
- name: Checkout repo
5344
uses: actions/checkout@v4
45+
- name: Load versions
46+
run: |
47+
set -a && source versions.env && set +a
48+
printenv >> $GITHUB_ENV
5449
- name: Setup Java
5550
uses: actions/setup-java@v2
5651
with:
@@ -82,6 +77,10 @@ jobs:
8277
run: "echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}"
8378
- name: Checkout repo
8479
uses: actions/checkout@v2
80+
- name: Load versions
81+
run: |
82+
set -a && source versions.env && set +a
83+
printenv >> $GITHUB_ENV
8584
- name: Setup Python
8685
uses: actions/setup-python@v1
8786
with:
@@ -97,7 +96,7 @@ jobs:
9796
- name: Setup Go
9897
uses: actions/setup-go@v2
9998
with:
100-
go-version: "${{ env.GO_VERSION }}"
99+
go-version: "${{ needs.load-versions.outputs.go_version }}"
101100
- name: Build exe
102101
run: go build -o temporal-omes ./cmd
103102
- name: Run local scenario with worker
@@ -118,6 +117,10 @@ jobs:
118117
uses: actions/checkout@v2
119118
with:
120119
submodules: 'true'
120+
- name: Load versions
121+
run: |
122+
set -a && source versions.env && set +a
123+
printenv >> $GITHUB_ENV
121124
- name: Setup TypeScript
122125
uses: actions/setup-node@v4
123126
- name: Initialize TypeScript worker
@@ -148,6 +151,10 @@ jobs:
148151
uses: actions/checkout@v2
149152
with:
150153
submodules: 'true'
154+
- name: Load versions
155+
run: |
156+
set -a && source versions.env && set +a
157+
printenv >> $GITHUB_ENV
151158
- name: Setup Dotnet
152159
uses: actions/setup-dotnet@v3
153160
- name: Check formatting
@@ -174,25 +181,8 @@ jobs:
174181
uses: actions/checkout@v2
175182
with:
176183
submodules: 'true'
177-
- uses: actions-rs/toolchain@v1
178-
with:
179-
profile: minimal
180-
toolchain: "${{ env.RUST_TOOLCHAIN }}"
181-
override: true
182-
- name: Install protoc
183-
uses: arduino/setup-protoc@v2
184-
with:
185-
version: "${{ env.PROTOC_VERSION }}"
186-
repo-token: ${{ secrets.GITHUB_TOKEN }}
187-
- name: Setup Go
188-
uses: actions/setup-go@v2
189-
with:
190-
go-version: "${{ env.GO_VERSION }}"
191-
- name: Install protoc-gen-go
192-
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@${{ env.PROTOC_GEN_GO_VERSION }}
193-
- name: Build kitchen-sink-gen
194-
working-directory: ./loadgen/kitchen-sink-gen
195-
run: cargo build
184+
- name: Build proto
185+
run: ./scripts/build_proto.sh
196186
- name: Check diff
197187
run: |
198188
git config --global core.safecrlf false
@@ -217,6 +207,12 @@ jobs:
217207
python-sdk-version: ${{ steps.set-output.outputs.python-sdk-version }}
218208
dotnet-sdk-version: ${{ steps.set-output.outputs.dotnet-sdk-version }}
219209
steps:
210+
- name: Checkout repo
211+
uses: actions/checkout@v2
212+
- name: Load versions
213+
run: |
214+
set -a && source versions.env && set +a
215+
printenv >> $GITHUB_ENV
220216
- name: Set output variables to pass to docker YML
221217
id: set-output
222218
run: |

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ Omes (pronounced oh-mess) is the Hebrew word for "load" (עומס).
1010
## Prerequisites
1111

1212
- [Go](https://golang.org/) 1.24+
13-
- `protoc` and `protoc-gen-go` must be installed
14-
- tip: don't worry about the specific versions here; instead, the GitHub action will make a diff
15-
available for download that you can use with `git apply`
1613
- [Java](https://openjdk.org/) 8+
1714
- TypeScript: [Node](https://nodejs.org) 16+
1815
- Python: [uv](https://docs.astral.sh/uv/)
@@ -21,6 +18,8 @@ Omes (pronounced oh-mess) is the Hebrew word for "load" (עומס).
2118
And if you're running the fuzzer (see below)
2219
- [Rust](https://rustup.rs/)
2320

21+
SDK and tool versions are defined in `versions.env`.
22+
2423
## Architecture
2524

2625
This (simplified) diagram shows the main components of Omes:
@@ -242,6 +241,8 @@ The Kitchen Sink workflows accepts a DSL generated by the `kitchen-sink-gen` Rus
242241
to test a wide variety of scenarios without having to imagine all possible edge cases that could
243242
come up in workflows. Input may be saved for regression testing, or hand written for specific cases.
244243

244+
Build by running `scripts/build_proto.sh`.
245+
245246
### Scenario Failure
246247

247248
A scenario can only fail if an `Execute` method returns an error, that means the control is fully in the scenario

dockerfiles/proto.Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM ubuntu:24.04
2+
3+
RUN apt-get update \
4+
&& DEBIAN_FRONTEND=noninteractive \
5+
apt-get install -y \
6+
curl \
7+
unzip \
8+
build-essential \
9+
pkg-config \
10+
libssl-dev \
11+
ca-certificates \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
ARG RUST_TOOLCHAIN
15+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN}
16+
ENV PATH="/root/.cargo/bin:${PATH}"
17+
18+
ARG PROTOC_VERSION
19+
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \
20+
&& unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local \
21+
&& rm protoc-${PROTOC_VERSION}-linux-x86_64.zip
22+
23+
ARG GO_VERSION
24+
RUN curl -OL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz \
25+
&& tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz \
26+
&& rm go${GO_VERSION}.linux-amd64.tar.gz
27+
ENV PATH="/usr/local/go/bin:${PATH}"
28+
29+
ARG PROTOC_GEN_GO_VERSION
30+
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION}
31+
ENV PATH="/root/go/bin:${PATH}"
32+
33+
ARG NODE_VERSION
34+
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
35+
&& apt-get install -y nodejs
36+
37+
WORKDIR /workspace

scripts/build_proto.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
7+
IMAGE_NAME="omes-ks-gen"
8+
9+
# Always load versions from versions.env
10+
set -a && source "${PROJECT_ROOT}/versions.env" && set +a
11+
12+
echo "Building Docker image for kitchen-sink-gen..."
13+
docker build -f "${PROJECT_ROOT}/dockerfiles/proto.Dockerfile" \
14+
--build-arg RUST_TOOLCHAIN="${RUST_TOOLCHAIN}" \
15+
--build-arg GO_VERSION="${GO_VERSION}" \
16+
--build-arg PROTOC_VERSION="${PROTOC_VERSION}" \
17+
--build-arg PROTOC_GEN_GO_VERSION="${PROTOC_GEN_GO_VERSION}" \
18+
--build-arg NODE_VERSION="${NODE_VERSION}" \
19+
-t "${IMAGE_NAME}" "${PROJECT_ROOT}"
20+
21+
echo "Running kitchen-sink-gen build..."
22+
docker run --rm -v "${PROJECT_ROOT}:/workspace" -w /workspace "${IMAGE_NAME}" bash -c "
23+
cd /workspace/loadgen/kitchen-sink-gen
24+
cargo build
25+
cd /workspace/workers/typescript
26+
npm install && npm run proto-gen
27+
"
28+
29+
echo "✅ kitchen-sink-gen build complete!"

versions.env

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Tool versions
2+
GO_VERSION=1.21.0
3+
JAVA_VERSION=11
4+
NODE_VERSION=22
5+
PROTOC_GEN_GO_VERSION=v1.31.0
6+
PROTOC_VERSION=25.1
7+
PYTHON_VERSION=3.10
8+
RUST_TOOLCHAIN=1.74.0
9+
10+
# SDK versions
11+
DOTNET_SDK_VERSION=1.7.0
12+
GO_SDK_VERSION=1.35.0
13+
JAVA_SDK_VERSION=1.30.1
14+
PYTHON_SDK_VERSION=1.14.1
15+
TYPESCRIPT_SDK_VERSION=1.12.1

0 commit comments

Comments
 (0)