From 18eb883484dc9928d1baa08a42152773dfd09d3a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 16:36:47 +0000 Subject: [PATCH] Add GitHub Action to test container endpoints This commit adds a new GitHub Action workflow that builds the Docker image, runs it as a container, and tests the `/` and `/docs` endpoints to ensure they are available and return a successful response. --- .github/workflows/test-container.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/test-container.yml diff --git a/.github/workflows/test-container.yml b/.github/workflows/test-container.yml new file mode 100644 index 0000000..67643a3 --- /dev/null +++ b/.github/workflows/test-container.yml @@ -0,0 +1,41 @@ +name: Test Container + +on: [push] + +jobs: + build_and_test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build Docker image + run: docker build -t test-image . + + - name: Run container + run: docker run -d -p 8080:80 --name test-container test-image + + - name: Wait for container to start + run: | + echo "Waiting for container to start..." + sleep 10 + + - name: Test root endpoint + run: | + curl -f http://localhost:8080/ + if [ $? -ne 0 ]; then + echo "Failed to get a 200 OK response from the root endpoint." + exit 1 + fi + + - name: Test docs endpoint + run: | + curl -f http://localhost:8080/docs + if [ $? -ne 0 ]; then + echo "Failed to get a 200 OK response from the /docs endpoint." + exit 1 + fi + + - name: Stop and remove container + if: always() + run: docker stop test-container && docker rm test-container \ No newline at end of file