Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
28 changes: 22 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ on:

jobs:
test_sanity:
name: Sanity Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install docker-compose
run: sudo apt-get update && sudo apt-get install -y docker-compose
- name: Build the Docker images
run: docker compose -f docker-compose.test.yml build
run: docker compose -f docker-compose.test-mysql.yml build
- name: Run sanity tests
run: docker compose -f docker-compose.test.yml run --no-deps bugzilla6.test test_sanity t/*.t extensions/*/t/*.t
run: docker compose -f docker-compose.test-mysql.yml run --no-deps bugzilla6.test test_sanity t/*.t extensions/*/t/*.t

# test_webservices:
# runs-on: ubuntu-latest
Expand All @@ -31,22 +32,24 @@ jobs:
# - name: Install docker-compose
# run: sudo apt-get update && sudo apt-get install -y docker-compose
# - name: Build the Docker images
# run: docker compose -f docker-compose.test.yml build
# run: docker compose -f docker-compose.test-mysql.yml build
# - name: Run webservice tests
# run: docker compose -f docker-compose.test.yml run bugzilla6.test test_webservices
# run: docker compose -f docker-compose.test-mysql.yml run bugzilla6.test test_webservices

test_bugzilla6_mysql:
name: Interactive Tests with MySQL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install docker-compose
run: sudo apt-get update && sudo apt-get install -y docker-compose
- name: Build the Docker images
run: docker compose -f docker-compose.test.yml build
run: docker compose -f docker-compose.test-mysql.yml build
- name: Run bmo specific tests
run: docker compose -f docker-compose.test.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
run: docker compose -f docker-compose.test-mysql.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t

test_bugzilla6_mariadb:
name: Interactive Tests with MariaDB
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -58,6 +61,7 @@ jobs:
run: docker compose -f docker-compose.test-mariadb.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t

test_bugzilla6_pg:
name: Interactive Tests with PostgreSQL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -69,6 +73,7 @@ jobs:
run: docker compose -f docker-compose.test-pg.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t

test_bugzilla6_sqlite:
name: Interactive Tests with SQLite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -79,3 +84,14 @@ jobs:
- name: Run bmo specific tests
run: docker compose -f docker-compose.test-sqlite.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t

test_release:
name: Perl Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t bugzilla-release-test -f docker/images/Dockerfile.perl-testsuite .
- name: Run tests
run: docker run --rm bugzilla-release-test

73 changes: 0 additions & 73 deletions .github/workflows/release.yml

This file was deleted.

File renamed without changes.
8 changes: 7 additions & 1 deletion docker/gen-cpanfile-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

if [ ! -e 'Makefile.PL' ]; then
echo
echo "Please run this from the root of the Bugzilla source tree."
echo
exit -1
fi
if [ -z "$DOCKER" ]; then
DOCKER=`which docker`
fi
if [ ! -x "$DOCKER" ]; then
if [ -n "$DOCKER" ] && [ ! -x "$DOCKER" ]; then
echo
echo "You specified a custom Docker executable via the DOCKER"
echo "environment variable at $DOCKER"
Expand Down
6 changes: 4 additions & 2 deletions docker/gen-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
if [ -z "$DOCKER" ]; then
DOCKER=`which docker`
fi
if [ ! -x "$DOCKER" ]; then
if [ -n "$DOCKER" ] && [ ! -x "$DOCKER" ]; then
echo
echo "You specified a custom Docker executable via the DOCKER"
echo "environment variable at $DOCKER"
Expand Down Expand Up @@ -79,7 +79,7 @@ select IMAGE in $FILES; do
if [ $? == 0 ]; then
echo
echo "The build appears to have succeeded. Don't forget to change the FROM line"
echo "at the top of Dockerfile to use:"
echo "at the top of Dockerfile and each of docker/Dockerfile.* to use:"
echo " bugzilla/${IMAGE}:${DATE}.${ITER}"
echo "to make use of this image."
echo
Expand Down Expand Up @@ -108,6 +108,8 @@ select IMAGE in $FILES; do
*)
echo "Not pushing. You can just run this script again when you're ready"
echo "to push. The prior build result is cached."
echo "Remember NOT to commit any changes to the FROM lines of Dockerfiles until"
echo "you've pushed to DockerHub."
;;
esac
fi
Expand Down
46 changes: 46 additions & 0 deletions docker/images/Dockerfile.perl-testsuite
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

ARG BZDB=""
FROM bugzilla/bugzilla-perl-slim${BZDB}:20250925.1

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get -y dist-upgrade && \
apt-get install --ignore-hold --allow-downgrades -y \
apache2 \
cpanminus \
mariadb-client \
netcat-traditional \
build-essential \
libapache2-mod-perl2 \
libapache2-mod-perl2-dev \
libgd3 \
libgd-dev \
perlmagick \
graphviz \
curl libssl-dev zlib1g-dev openssl \
libexpat-dev cmake git libcairo-dev \
unzip wget && \
rm -rf /var/lib/apt/lists/*

# Copy the source code
COPY . /app/

# Run Makefile.PL and install dependencies
RUN perl Makefile.PL && \
cpanm --notest --quiet --local-lib="/app/local" Module::CPANfile && \
make cpanfile GEN_CPANFILE_ARGS='-A -U oracle -U mariadb -U pg -U mysql' && \
cpanm --notest --quiet --local-lib="/app/local" -f --installdeps .

# Run checksetup
RUN perl checksetup.pl --no-database --default-localconfig --no-templates

# Set the default command to run tests
ENTRYPOINT ["prove", "-Ilocal/lib/perl5", "t"]
CMD []
44 changes: 40 additions & 4 deletions docker/run-tests-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
if [ -z "$DOCKER" ]; then
DOCKER=`which docker`
fi
if [ ! -x "$DOCKER" ]; then
if [ -n "$DOCKER" ] && [ ! -x "$DOCKER" ]; then
echo
echo "You specified a custom Docker executable via the DOCKER"
echo "environment variable at $DOCKER"
Expand Down Expand Up @@ -51,17 +51,53 @@ export DOCKER_CLI_HINTS=false
export CI=""
export CIRCLE_SHA1=""
export CIRCLE_BUILD_URL=""
DOCKER_COMPOSE_FILE=docker-compose.test.yml
if [ "$1" == "pg" ]; then

TEST_NAME="test_bmo"
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
if [ "$#" -eq 0 ]; then
echo "Available test options:"
echo " 1) sanity - Run sanity tests"
echo " 2) mysql - Run BMO tests with MySQL (default)"
echo " 3) pg - Run BMO tests with PostgreSQL"
echo " 4) sqlite - Run BMO tests with SQLite"
echo " 5) mariadb - Run BMO tests with MariaDB"
echo " 6) release - Run release tests"
echo
read -p "Select a test option (1-6, default is mysql): " choice
Comment thread
dannycolin marked this conversation as resolved.
Outdated
case "$choice" in
1) set -- "sanity" ;;
2|"") set -- "mysql" ;;
3) set -- "pg" ;;
4) set -- "sqlite" ;;
5) set -- "mariadb" ;;
6) set -- "release" ;;
*) echo "Invalid choice. Using default (mysql)"; set -- "mysql" ;;
esac
fi
if [ "$1" == "sanity" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
TEST_NAME="test_sanity"
elif [ "$1" == "mysql" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-mysql.yml
elif [ "$1" == "pg" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-pg.yml
elif [ "$1" == "sqlite" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-sqlite.yml
elif [ "$1" == "mariadb" ]; then
DOCKER_COMPOSE_FILE=docker-compose.test-mariadb.yml
elif [ "$1" == "release" ]; then
DOCKER_FILE=docker/images/Dockerfile.perl-testsuite
$DOCKER build -t bugzilla-release-test -f $DOCKER_FILE .
if [ $? == 0 ]; then
$DOCKER run --rm bugzilla-release-test
else
echo "docker build failed."
fi
exit $?
fi
$DOCKER compose -f $DOCKER_COMPOSE_FILE build
if [ $? == 0 ]; then
$DOCKER compose -f $DOCKER_COMPOSE_FILE run --rm --name bugzilla6.test bugzilla6.test test_bmo -q -f t/bmo/*.t
$DOCKER compose -f $DOCKER_COMPOSE_FILE run --rm --name bugzilla6.test bugzilla6.test $TEST_NAME -q -f t/bmo/*.t
$DOCKER compose -f $DOCKER_COMPOSE_FILE down
else
echo "docker compose build failed."
Expand Down