Skip to content

Commit a407d73

Browse files
committed
refactor(librariangen): move docker build to local script
The Docker build and test steps were moved from the GitHub Actions workflow to a local script. This is because the base Docker image is not accessible from GitHub Actions. The CI workflow now only runs the Go tests. The new `build-docker-and-test.sh` script can be used to build the Docker image and run the version check locally.
1 parent fa3fe47 commit a407d73

2 files changed

Lines changed: 32 additions & 17 deletions

File tree

.github/workflows/librariangen-ci.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,3 @@ jobs:
3030
run: go test ./...
3131
working-directory: internal/librariangen
3232

33-
- name: Build Docker image
34-
run: docker build -t librariangen-test ./internal/librariangen
35-
36-
- name: Run version command
37-
id: version
38-
run: |
39-
output=$(docker run --rm -e GOOGLE_SDK_JAVA_LOGGING_LEVEL=quiet librariangen-test --version)
40-
echo "version_output=$output" >> $GITHUB_OUTPUT
41-
42-
- name: Verify version
43-
run: |
44-
version_output="${{ steps.version.outputs.version_output }}"
45-
if [[ ! "$version_output" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
46-
echo "Version format is incorrect. Got: $version_output"
47-
exit 1
48-
fi
49-
echo "Version check passed. Version is $version_output"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
set -e
18+
SCRIPT_DIR=$(dirname "$0")
19+
IMAGE_NAME="librariangen-test"
20+
21+
echo "Building Docker image..."
22+
docker build -t "${IMAGE_NAME}" "${SCRIPT_DIR}"
23+
24+
echo "Running version check..."
25+
output=$(docker run --rm -e GOOGLE_SDK_JAVA_LOGGING_LEVEL=quiet "${IMAGE_NAME}" --version)
26+
27+
if [[ ! "$output" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
28+
echo "Version format is incorrect. Got: $output"
29+
exit 1
30+
fi
31+
32+
echo "Version check passed. Version is $output"

0 commit comments

Comments
 (0)