Skip to content

Commit f6099d2

Browse files
committed
CI: add check for build-info
1 parent 21a200b commit f6099d2

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,23 @@ jobs:
205205
- name: Release build
206206
run: make build-release
207207

208+
- name: Verify build-info command
209+
run: |
210+
echo "Testing build-info command..."
211+
./target/release/mina build-info
212+
213+
# Verify required fields are present
214+
./target/release/mina build-info | grep -E "Version:|Build time:|Commit SHA:|Commit branch:|Rustc version:"
215+
216+
# Verify version format (should be a short commit hash)
217+
VERSION=$(./target/release/mina build-info | grep "Version:" | awk '{print $2}')
218+
if [[ ! "$VERSION" =~ ^[0-9a-f]{7}$ ]]; then
219+
echo "Error: Version should be a 7-character commit hash, got: $VERSION"
220+
exit 1
221+
fi
222+
223+
echo "Build info verification passed!"
224+
208225
- name: Upload binaries
209226
if: matrix.os == 'ubuntu-22.04'
210227
uses: actions/upload-artifact@v4

.github/workflows/docker.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,44 @@ jobs:
197197
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
198198
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
199199
additional_tags: ${{ env.ADDITIONAL_TAGS }}
200+
201+
# Test Docker image build-info
202+
test-docker-build-info:
203+
runs-on: ubuntu-latest
204+
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release')
205+
needs:
206+
- push-node-image
207+
steps:
208+
- name: Set up environment variables
209+
run: |
210+
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
211+
echo "DOCKER_TAG=develop" >> $GITHUB_ENV
212+
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
213+
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
214+
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
215+
TAG="${GITHUB_REF#refs/tags/}"
216+
echo "DOCKER_TAG=${TAG}" >> $GITHUB_ENV
217+
elif [[ "${{ github.ref }}" == refs/heads/release/* ]]; then
218+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
219+
VERSION="${BRANCH_NAME#release/}"
220+
echo "DOCKER_TAG=${VERSION}" >> $GITHUB_ENV
221+
fi
222+
223+
- name: Test build-info command in Docker image
224+
run: |
225+
echo "Testing build-info for Docker image ${{ env.REGISTRY_NODE_IMAGE }}:${{ env.DOCKER_TAG }}"
226+
227+
# Run build-info command
228+
docker run --rm ${{ env.REGISTRY_NODE_IMAGE }}:${{ env.DOCKER_TAG }} build-info
229+
230+
# Verify required fields are present
231+
docker run --rm ${{ env.REGISTRY_NODE_IMAGE }}:${{ env.DOCKER_TAG }} build-info | grep -E "Version:|Build time:|Commit SHA:|Commit branch:|Rustc version:"
232+
233+
# Verify version format
234+
VERSION=$(docker run --rm ${{ env.REGISTRY_NODE_IMAGE }}:${{ env.DOCKER_TAG }} build-info | grep "Version:" | awk '{print $2}')
235+
if [[ ! "$VERSION" =~ ^[0-9a-f]{7}$ ]]; then
236+
echo "Error: Version should be a 7-character commit hash, got: $VERSION"
237+
exit 1
238+
fi
239+
240+
echo "Docker image build-info verification passed!"

0 commit comments

Comments
 (0)