8000 ci: enable docker test workflow by Pouyanpi · Pull Request #1016 · NVIDIA/NeMo-Guardrails · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ci: enable docker test workflow #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 34 additions & 19 deletions .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,54 @@ name: Test Docker Image
# TODO: set docker auth
on:
workflow_dispatch:
# on:
# push:
# tags:
# - "v*"

env:
IMAGE: nemoguardrails
TEST_TAG: ${{ env.IMAGE }}:test
LATEST_TAG: ${{ env.IMAGE }}:latest
push:
# tags:
# - "v*"
pull_request:

jobs:
docker:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, macos-15, windows-latest]
os: [ubuntu-latest]
env:
IMAGE: nemoguardrails
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
#
# Checkout the code
- name: Checkout
uses: actions/checkout@v4

# Extract the tag version and set Docker tags
- name: Get git tag and set Docker tags
# Get runner architecture
- name: Get runner architecture
id: runner-arch
run: echo "arch=$(uname -m)" >> $GITHUB_OUTPUT

# Extract the PR SHA and set Docker tags
- name: Get PR SHA and set Docker tags
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_TAG=${{ env.IMAGE }}:$VERSION" >> $GITHUB_ENV
SHA=${GITHUB_SHA}
OS=${{ matrix.os }}
ARCH=${{ steps.runner-arch.outputs.arch }}
echo "SHA=$SHA" >> $GITHUB_ENV
echo "PR_TAG=${{ env.IMAGE }}:$SHA-$OS-$ARCH" >> $GITHUB_ENV

# Build the Docker image
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ env.TEST_TAG }} --tag ${{ env.VERSION_TAG }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
load: true
tags: ${{ env.PR_TAG }}

# Start the container in detached mode
- name: Start container
run: docker run -d --name test_container -p 8000:8000 ${{ env.TEST_TAG }}
run: docker run -d --name test_container -p 8000:8000 ${{ env.PR_TAG }}

# Wait for the container to be ready
- name: Wait for container to be ready
Expand Down
0