From 7b8356383aa930069e264d869ecabdcfa72dd074 Mon Sep 17 00:00:00 2001 From: Andrea Borghi Date: Tue, 1 Oct 2024 16:10:18 +0200 Subject: [PATCH] Enable normal build workflows again --- .github/workflows/build.yaml | 46 ++++++++++------------------- .github/workflows/pull-request.yaml | 28 ++++++++++++++++-- Makefile | 22 ++++++++++---- compose/acceptance.yml | 2 -- 4 files changed, 59 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e387d320e..6bf5d5013 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,39 +23,25 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - # - name: Setup Java - # uses: actions/setup-java@v2 - # with: - # distribution: 'temurin' - # java-version: '21' - # cache: 'maven' - - name: Install CI dependencies - run: python3 -m pip install --user --requirement=ci/requirements.txt - - # - name: Validate source code formatting - # run: make lint - - # - name: Build and test - # run: | - # make install test + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '21' + cache: 'maven' - # - name: Build docker images - # run: | - # make build-image + - name: Validate source code formatting + run: make lint - - name: Run acceptance tests + - name: Build and test run: | - make acceptance-tests + make install test - - name: Print docker compose logs - run: (cd compose && c2cciutils-docker-logs) - if: always() - - - name: Cleanup acceptance tests + - name: Build docker images run: | - make stop-acceptance-tests + make build-image - # - name: Remove project jars from cached repository - # run: | - # rm -rf ~/.m2/repository/org/geoserver - # find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {} + - name: Remove project jars from cached repository + run: | + rm -rf ~/.m2/repository/org/geoserver + find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {} diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 58d5b3071..d82bb7058 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -47,9 +47,33 @@ jobs: run: | make build-image - - name: Run acceptance tests + - name: Install CI dependencies + run: python3 -m pip install --user --requirement=ci/requirements.txt + + - name: Run acceptance tests datadir + run: | + make acceptance-tests-datadir + + - name: Print docker compose logs datadir + run: (cd compose && c2cciutils-docker-logs) + if: always() + + - name: Cleanup acceptance tests datadir run: | - make acceptance-tests + make clean-acceptance-tests-datadir + + # FIXME: fix pgconfig discrepancies before reactivating + # - name: Run acceptance tests pgconfig + # run: | + # make acceptance-tests-pgconfig + + # - name: Print docker compose logs pgconfig + # run: (cd compose && c2cciutils-docker-logs) + # if: always() + + # - name: Cleanup acceptance tests pgconfig + # run: | + # make clean-acceptance-tests-pgconfig - name: Remove project jars from cached repository run: | diff --git a/Makefile b/Makefile index df51ac21b..f23a4f28e 100644 --- a/Makefile +++ b/Makefile @@ -88,12 +88,24 @@ verify-image: build-acceptance: docker build --tag=acceptance:$(TAG) acceptance_tests -.PHONY: acceptance-tests -acceptance-tests: -acceptance-tests: build-acceptance +.PHONY: acceptance-tests-pgconfig +acceptance-tests-pgconfig: +acceptance-tests-pgconfig: build-acceptance + (cd compose/ && TAG=$(TAG) GS_USER=$(UID):$(GID) docker compose $(COMPOSE_ACCEPTANCE_PGCONFIG_OPTIONS) up -d) + (cd compose/ && TAG=$(TAG) GS_USER=$(UID):$(GID) docker compose $(COMPOSE_ACCEPTANCE_PGCONFIG_OPTIONS) exec -T acceptance bash -c 'until [ -f /tmp/healthcheck ]; do echo "Waiting for /tmp/healthcheck to be available..."; sleep 5; done && pytest . -vvv --color=yes') + +.PHONY: clean-acceptance-tests-pgconfig +clean-acceptance-tests-pgconfig: + (cd compose/ && TAG=$(TAG) GS_USER=$(UID):$(GID) docker compose $(COMPOSE_ACCEPTANCE_PGCONFIG_OPTIONS) down -v) + +.PHONY: acceptance-tests-datadir +acceptance-tests-datadir: +acceptance-tests-datadir: build-acceptance (cd compose/ && TAG=$(TAG) GS_USER=$(UID):$(GID) docker compose $(COMPOSE_ACCEPTANCE_DATADIR_OPTIONS) up -d) (cd compose/ && TAG=$(TAG) GS_USER=$(UID):$(GID) docker compose $(COMPOSE_ACCEPTANCE_DATADIR_OPTIONS) exec -T acceptance bash -c 'until [ -f /tmp/healthcheck ]; do echo "Waiting for /tmp/healthcheck to be available..."; sleep 5; done && pytest . -vvv --color=yes') -.PHONY: stop-acceptance-tests -stop-acceptance-tests: build-acceptance +.PHONY: clean-acceptance-tests-datadir +clean-acceptance-tests-datadir: (cd compose/ && TAG=$(TAG) GS_USER=$(UID):$(GID) docker compose $(COMPOSE_ACCEPTANCE_DATADIR_OPTIONS) down -v) + rm -rf compose/catalog-datadir/* + touch compose/catalog-datadir/.keep diff --git a/compose/acceptance.yml b/compose/acceptance.yml index e6d35fa98..f1244be38 100644 --- a/compose/acceptance.yml +++ b/compose/acceptance.yml @@ -20,8 +20,6 @@ services: depends_on: geodatabase: condition: service_healthy - init-datadir: - condition: service_completed_successfully gateway: condition: service_healthy discovery: