From ee3b7ce12621107c80dab103a1bc1788f4876e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borna=20Be=C5=A1i=C4=87?= Date: Mon, 14 Oct 2024 17:26:45 +0200 Subject: [PATCH] Run base Odoo tests in the pipeline --- .github/workflows/{build.yaml => main.yaml} | 20 +++++++++++++++++++ tests/docker-compose.yml | 22 +++++++++++++++++++++ 2 files changed, 42 insertions(+) rename .github/workflows/{build.yaml => main.yaml} (87%) create mode 100644 tests/docker-compose.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/main.yaml similarity index 87% rename from .github/workflows/build.yaml rename to .github/workflows/main.yaml index 9b35311126e1f..d024681070077 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/main.yaml @@ -109,6 +109,8 @@ jobs: packages: write env: GHCR_IMAGE_NAME: ghcr.io/jobrad-gmbh/odoo + outputs: + IMAGE_REV: ${{ steps.manifest.outputs.IMAGE_REV }} steps: - name: Create variables shell: bash @@ -131,6 +133,7 @@ jobs: password: ${{ secrets.ARTIFACTORY_TOKEN }} - name: Combine Docker images into a single multi-architecture image + id: manifest shell: bash run: | IMAGE_AMD64="${GHCR_IMAGE_NAME}:${SHORT_REV}-amd64" @@ -145,4 +148,21 @@ jobs: docker manifest create "${IMAGE_REV}" "${IMAGE_AMD64}" "${IMAGE_ARM64}" docker manifest push "${IMAGE_BRANCH}" docker manifest push "${IMAGE_REV}" + echo "IMAGE_REV=${IMAGE_REV}" >> $GITHUB_OUTPUT # TODO Push to artifactory + + test: + runs-on: self-hosted + needs: combine-docker + steps: + - uses: actions/checkout@v3 + + - name: Run base Odoo tests + run: | + export ODOO_IMAGE=${{ needs.combine-docker.outputs.IMAGE_REV }} + docker compose -f tests/docker-compose.yml run --rm --remove-orphans odoo ./odoo-bin -d test --test-enable --stop + + - name: Cleanup + if: always() + run: | + docker compose -f tests/docker-compose.yml down -v diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml new file mode 100644 index 0000000000000..7bdb72d425346 --- /dev/null +++ b/tests/docker-compose.yml @@ -0,0 +1,22 @@ +services: + postgres: + image: ghcr.io/jobrad-gmbh/postgis:13-3.4-alpine + environment: + POSTGRES_USER: &pguser odoo + POSTGRES_PASSWORD: &pgpassword odoo + healthcheck: + test: ["CMD-SHELL", "pg_isready"] + interval: 1s + timeout: 5s + retries: 5 + + odoo: + image: ${ODOO_IMAGE:-ghcr.io/jobrad-gmbh/odoo:jobrad-15.0} + tty: True + depends_on: + postgres: + condition: service_healthy + environment: + PGHOST: postgres + PGUSER: *pguser + PGPASSWORD: *pgpassword