test: add test for separate_server option #304
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group <https://www.opalmedapps.com> | |
| # | |
| # SPDX-License-Identifier: MIT | |
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || '' }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: pre-commit/action@v3.0.1 | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| # simulate a separate DB server | |
| external-db: | |
| image: mariadb:10.11.15-jammy | |
| ports: | |
| - 3307:3306 | |
| env: | |
| MARIADB_ROOT_PASSWORD: root-password | |
| # https://docs.github.com/en/actions/tutorials/use-containerized-services/use-docker-service-containers#running-jobs-in-a-container | |
| container: | |
| image: docker:29 | |
| # volumes: | |
| # - /var/run/docker.sock:/var/run/docker.sock | |
| options: "--add-host external-db:external-db" | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| id: setup-uv | |
| with: | |
| # renovate: datasource=pypi dependency=uv | |
| version: "0.9.26" | |
| - name: Test template using copier-template-tester | |
| run: | | |
| apk add --no-cache bind-tools | |
| cat /etc/hosts | |
| DB_IP=$(dig +short external-db) | |
| echo "$DB_IP external-db" >> /etc/hosts | |
| cat /etc/hosts | |
| docker container ps | |
| docker network ls | |
| ping -c 4 external-db | |
| docker run --rm --interactive --add-host "external-db:$DB_IP" alpine sh -c "apk add --no-cache iputils-ping && ping -c 4 external-db && exit 1" | |
| uv run --with copier --with copier-templates-extensions --with bcrypt --with copier-template-tester ctt | |
| - name: Show running containers | |
| run: | | |
| docker ps |