Files
dolibarr-docker/.gitea/workflows/test.yml
2025-10-08 19:34:23 +02:00

70 lines
1.8 KiB
YAML

name: test
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
check-update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Test the update was run, files will differ if not
run: |
set -euo pipefail
./update.sh
git diff --exit-code
- name: Display error message on failure
if: failure()
run: echo "The diff after running update.sh shows it wasn't run before committing the PR."
check-build:
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:
- name: Checkout code
uses: actions/checkout@v5
- name: Build and run container
shell: bash
run: |
set -euo pipefail
# Regenerate all the image files
./update.sh
# Remove old container if it exists
if [ "$(docker ps -aq -f name=^/${CONTAINER_NAME}$)" ]; then
echo "Removing existing ${CONTAINER_NAME}..."
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"
- name: Cleanup container
if: always()
shell: bash
run: |
docker rm -f "${CONTAINER_NAME}" || true