name: ๐Ÿš€ Docker Build and Push on: push: branches: - main jobs: build-and-push: runs-on: ubuntu-latest strategy: matrix: pg_version: [15, 16, 17, 18] steps: - name: ๐Ÿ“ฅ Checkout code uses: https://github.com/actions/checkout@v4 - name: ๐Ÿ› ๏ธ Set up Docker Buildx uses: https://github.com/docker/setup-buildx-action@v3 - name: ๐Ÿ” Login to Gitea Registry uses: https://github.com/docker/login-action@v3 with: registry: gitea.killinger.fr username: maxime.killinger password: ${{ secrets.DOCKER_TOKEN }} - name: ๐Ÿ“ฆ Build Docker image uses: https://github.com/docker/build-push-action@v5 with: context: . load: true build-args: | PG_VERSION=${{ matrix.pg_version }} tags: | postgres-ts-vectors:pg${{ matrix.pg_version }}-test - name: ๐Ÿงช Test image - Start container run: | docker run -d --name test-pg${{ matrix.pg_version }} \ -e POSTGRES_PASSWORD=testpass \ postgres-ts-vectors:pg${{ matrix.pg_version }}-test # Wait for PostgreSQL to be ready echo "Waiting for PostgreSQL to start..." for i in {1..30}; do if docker exec test-pg${{ matrix.pg_version }} pg_isready -U postgres > /dev/null 2>&1; then echo "PostgreSQL is ready!" break fi sleep 2 done - name: โš™๏ธ Setup Tests run: | # Wait for valid startup sleep 10 docker cp tests/ test-pg${{ matrix.pg_version }}:/tmp/tests/ - name: "๐Ÿงช Test 1: Configuration" run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-1-config.sql - name: "๐Ÿงช Test 2: TimescaleDB" run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-2-timescale.sql - name: "๐Ÿงช Test 3: VectorChord" run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-3-vector.sql - name: "๐Ÿงช Test 4: Hybrid Scenarios" run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-4-hybrid.sql - name: ๐Ÿงน Cleanup test container if: always() run: docker rm -f test-pg${{ matrix.pg_version }} || true - name: ๐Ÿš€ Push Docker image uses: https://github.com/docker/build-push-action@v5 with: context: . push: true build-args: | PG_VERSION=${{ matrix.pg_version }} tags: | gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:pg${{ matrix.pg_version }} - name: ๐Ÿท๏ธ Tag latest (PG18 only) if: matrix.pg_version == 18 uses: https://github.com/docker/build-push-action@v5 with: context: . push: true build-args: | PG_VERSION=18 tags: | gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:latest - name: ๐Ÿงน Cleanup Docker images if: always() run: | docker rmi postgres-ts-vectors:pg${{ matrix.pg_version }}-test || true docker image prune -f