forked from Wavyzz/dolibarr-docker
Changed test step
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -11,32 +12,78 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
check-update:
|
check-update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Test the update was run, files will differ if not
|
- name: Test the update was run, files will differ if not
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
./update.sh
|
./update.sh
|
||||||
git diff --exit-code
|
git diff --exit-code
|
||||||
|
|
||||||
- name: Display error message on failure
|
- name: Display error message on failure
|
||||||
if: failure() # This condition ensures the step runs only if the previous step failed
|
if: failure()
|
||||||
run: echo "The diff after running the update.sh shows that the update.sh was not run before committing the PR."
|
run: echo "The diff after running update.sh shows it wasn't run before committing the PR."
|
||||||
|
|
||||||
check-build:
|
check-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_NAMESPACE: wavyzz
|
||||||
|
CONTAINER_NAME: dolibarr_build
|
||||||
|
DOLI_PORT: "8085"
|
||||||
|
DOLI_INSTALL_AUTO: "0" # passed into the container if your image uses it
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- name: Checkout code
|
||||||
- env:
|
uses: actions/checkout@v5
|
||||||
DOLI_INSTALL_AUTO: 0
|
|
||||||
DOCKER_NAMESPACE: "wavyzz"
|
- name: Build and run container
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# Regenerate all the image files
|
# Regenerate all the image files
|
||||||
./update.sh
|
./update.sh
|
||||||
# Try to build the image inimages/develop
|
|
||||||
docker rm -f dolibarr_build
|
# Remove old container if it exists
|
||||||
docker build -t ${DOCKER_NAMESPACE}/dolibarr:develop images/develop
|
if [ "$(docker ps -aq -f name=^/${CONTAINER_NAME}$)" ]; then
|
||||||
docker run -d -p 127.0.0.1:8085:80 --name dolibarr_build ${DOCKER_NAMESPACE}/dolibarr:develop
|
echo "Removing existing ${CONTAINER_NAME}..."
|
||||||
docker ps | grep -q dolibarr_build
|
docker rm -f "${CONTAINER_NAME}" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building image ${DOCKER_NAMESPACE}/dolibarr:develop..."
|
||||||
|
docker build -t "${DOCKER_NAMESPACE}/dolibarr:develop" images/develop
|
||||||
|
|
||||||
|
echo "Starting ${CONTAINER_NAME} on 127.0.0.1:${DOLI_PORT}..."
|
||||||
|
docker run -d \
|
||||||
|
-p "127.0.0.1:${DOLI_PORT}:80" \
|
||||||
|
--name "${CONTAINER_NAME}" \
|
||||||
|
-e DOLI_INSTALL_AUTO="${DOLI_INSTALL_AUTO}" \
|
||||||
|
"${DOCKER_NAMESPACE}/dolibarr:develop"
|
||||||
|
|
||||||
|
# Give it a moment to boot
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# Verify container is running
|
||||||
|
if [ "$(docker inspect -f '{{.State.Running}}' "${CONTAINER_NAME}" 2>/dev/null)" != "true" ]; then
|
||||||
|
echo "❌ Container failed to start"
|
||||||
|
docker ps -a || true
|
||||||
|
docker logs --tail=200 "${CONTAINER_NAME}" || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Quick HTTP check
|
||||||
|
curl -sSf "http://127.0.0.1:${DOLI_PORT}/" > /dev/null || {
|
||||||
|
echo "❌ HTTP check failed on http://127.0.0.1:${DOLI_PORT}/"
|
||||||
|
docker logs --tail=200 "${CONTAINER_NAME}" || true
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "✅ Container started and responded over HTTP"
|
||||||
|
|
||||||
|
- name: Cleanup container
|
||||||
|
if: always()
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
docker rm -f "${CONTAINER_NAME}" || true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user