Port Docker Compose examples #10
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
| name: Test compose examples | |
| on: | |
| pull_request: | |
| paths: | |
| - 'compose/**' | |
| - '.github/workflows/compose.yaml' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'compose/**' | |
| - '.github/workflows/compose.yaml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-actions: | |
| name: Lint GitHub Actions workflows | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Lint actions | |
| run: | | |
| echo "::add-matcher::.github/actionlint-matcher.json" | |
| bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
| ./actionlint -color | |
| shell: bash | |
| compose-test: | |
| name: Test ${{ matrix.compose-file }} | |
| needs: lint-actions | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compose-file: | |
| - docker-compose.yml | |
| - docker-compose-postgres.yml | |
| - docker-compose-mysql.yml | |
| - docker-compose-mysql-es.yml | |
| - docker-compose-cass-es.yml | |
| - docker-compose-postgres-opensearch.yml | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Print build information | |
| env: | |
| HEAD_REF: ${{ github.head_ref }} | |
| REF: ${{ github.ref }} | |
| COMPOSE_FILE: ${{ matrix.compose-file }} | |
| run: echo "head_ref=$HEAD_REF ref=$REF compose=$COMPOSE_FILE" | |
| - uses: actions/checkout@v6 | |
| - name: Start compose stack | |
| working-directory: compose | |
| run: docker compose -f ${{ matrix.compose-file }} up -d || true | |
| - name: Check admin-tools completion | |
| working-directory: compose | |
| run: | | |
| # Wait a moment for container to start and potentially fail | |
| sleep 10 | |
| # Check if admin-tools container exists and get its exit code | |
| if docker compose -f ${{ matrix.compose-file }} ps -a temporal-admin-tools --format json | jq -e '.[0]' > /dev/null 2>&1; then | |
| EXIT_CODE=$(docker compose -f ${{ matrix.compose-file }} ps -a temporal-admin-tools --format json | jq -r '.[0].ExitCode // "null"') | |
| if [ "$EXIT_CODE" != "0" ] && [ "$EXIT_CODE" != "null" ]; then | |
| echo "Admin-tools failed with exit code: $EXIT_CODE" | |
| docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools | |
| exit 1 | |
| fi | |
| fi | |
| - name: Wait for services to be healthy | |
| working-directory: compose | |
| run: | | |
| echo "Waiting up to 5 minutes for services to be healthy..." | |
| timeout 300 bash -c 'until docker compose -f ${{ matrix.compose-file }} ps | grep -E "(healthy|Started)"; do sleep 5; done' || { | |
| echo "Services failed to become healthy" | |
| docker compose -f ${{ matrix.compose-file }} ps | |
| docker compose -f ${{ matrix.compose-file }} logs | |
| exit 1 | |
| } | |
| - name: Check admin-tools logs | |
| working-directory: compose | |
| run: | | |
| echo "=== Admin-tools logs ===" | |
| docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools 2>&1 | grep -v "level=warning" | |
| echo "=== Checking for errors ===" | |
| if docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools 2>&1 | grep -v "level=warning" | grep -i "error" | grep -v "unable to describe namespace"; then | |
| echo "Found errors in admin-tools logs" | |
| exit 1 | |
| fi | |
| echo "No errors found in admin-tools logs" | |
| - name: Check namespace creation logs | |
| working-directory: compose | |
| run: | | |
| echo "=== Namespace creation logs ===" | |
| docker compose -f ${{ matrix.compose-file }} logs temporal-create-namespace 2>&1 | grep -v "level=warning" | |
| echo "=== Checking for success message ===" | |
| if ! docker compose -f ${{ matrix.compose-file }} logs temporal-create-namespace 2>&1 | grep -v "level=warning" | grep -q "Namespace 'default' created"; then | |
| echo "Namespace creation failed or did not complete" | |
| exit 1 | |
| fi | |
| echo "Namespace creation succeeded" | |
| - name: Verify temporal server is healthy | |
| working-directory: compose | |
| run: | | |
| docker compose -f ${{ matrix.compose-file }} exec -T temporal temporal operator cluster health || { | |
| echo "Temporal server health check failed" | |
| docker compose -f ${{ matrix.compose-file }} logs temporal | |
| exit 1 | |
| } | |
| - name: Cleanup | |
| if: always() | |
| working-directory: compose | |
| run: docker compose -f ${{ matrix.compose-file }} down -v | |
| compose-tls-test: | |
| name: Test docker-compose-tls.yml | |
| needs: lint-actions | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Print build information | |
| env: | |
| HEAD_REF: ${{ github.head_ref }} | |
| REF: ${{ github.ref }} | |
| run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-tls.yml" | |
| - uses: actions/checkout@v6 | |
| - name: Generate TLS certificates | |
| working-directory: compose | |
| run: | | |
| docker build -t temporal_tls:test -f tls/Dockerfile.tls . | |
| mkdir -p .pki | |
| docker run --rm -v temporal_tls_pki:/pki -v "${PWD}"/.pki:/pki-out temporal_tls:test | |
| - name: Build TLS images | |
| working-directory: compose | |
| run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml build --no-cache | |
| - name: Start TLS compose stack | |
| working-directory: compose | |
| run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml up -d || true | |
| - name: Check admin-tools-setup completion | |
| working-directory: compose | |
| run: | | |
| # Wait a moment for container to start and potentially fail | |
| sleep 10 | |
| # Check if admin-tools-setup container exists and get its exit code | |
| if COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps -a temporal-admin-tools-setup --format json | jq -e '.[0]' > /dev/null 2>&1; then | |
| EXIT_CODE=$(COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps -a temporal-admin-tools-setup --format json | jq -r '.[0].ExitCode // "null"') | |
| if [ "$EXIT_CODE" != "0" ] && [ "$EXIT_CODE" != "null" ]; then | |
| echo "Admin-tools-setup failed with exit code: $EXIT_CODE" | |
| COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup | |
| exit 1 | |
| fi | |
| fi | |
| - name: Wait for services to be healthy | |
| working-directory: compose | |
| run: | | |
| echo "Waiting up to 5 minutes for services to be healthy..." | |
| timeout 300 bash -c 'until COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps | grep -E "(healthy|Started)"; do sleep 5; done' || { | |
| echo "Services failed to become healthy" | |
| COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps | |
| COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs | |
| exit 1 | |
| } | |
| - name: Check admin-tools logs | |
| working-directory: compose | |
| run: | | |
| echo "=== Admin-tools-setup logs ===" | |
| COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup 2>&1 | grep -v "level=warning" | |
| echo "=== Checking for errors ===" | |
| if COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup 2>&1 | grep -v "level=warning" | grep -i "error" | grep -v "unable to describe namespace"; then | |
| echo "Found errors in admin-tools logs" | |
| exit 1 | |
| fi | |
| echo "No errors found in admin-tools logs" | |
| - name: Check namespace creation logs | |
| working-directory: compose | |
| run: | | |
| echo "=== Namespace creation logs ===" | |
| COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-create-namespace 2>&1 | grep -v "level=warning" | |
| echo "=== Checking for success message ===" | |
| if ! COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-create-namespace 2>&1 | grep -v "level=warning" | grep -q "Namespace 'default' created"; then | |
| echo "Namespace creation failed or did not complete" | |
| exit 1 | |
| fi | |
| echo "Namespace creation succeeded" | |
| - name: Cleanup | |
| if: always() | |
| working-directory: compose | |
| run: | | |
| COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml down -v | |
| docker volume rm temporal_tls_pki || true | |
| rm -rf .pki | |
| compose-multirole-test: | |
| name: Test docker-compose-multirole.yaml | |
| needs: lint-actions | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Print build information | |
| env: | |
| HEAD_REF: ${{ github.head_ref }} | |
| REF: ${{ github.ref }} | |
| run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-multirole.yaml" | |
| - uses: actions/checkout@v6 | |
| - name: Install loki Docker plugin | |
| run: docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |
| - name: Start multirole compose stack | |
| working-directory: compose | |
| run: docker compose -f docker-compose-multirole.yaml up -d || true | |
| - name: Check setup completion | |
| working-directory: compose | |
| run: | | |
| # Wait a moment for container to start and potentially fail | |
| sleep 10 | |
| # Check if setup container exists and get its exit code | |
| if docker compose -f docker-compose-multirole.yaml ps -a temporal-setup --format json | jq -e '.[0]' > /dev/null 2>&1; then | |
| EXIT_CODE=$(docker compose -f docker-compose-multirole.yaml ps -a temporal-setup --format json | jq -r '.[0].ExitCode // "null"') | |
| if [ "$EXIT_CODE" != "0" ] && [ "$EXIT_CODE" != "null" ]; then | |
| echo "Setup failed with exit code: $EXIT_CODE" | |
| docker compose -f docker-compose-multirole.yaml logs temporal-setup | |
| exit 1 | |
| fi | |
| fi | |
| - name: Wait for services to be healthy | |
| working-directory: compose | |
| run: | | |
| echo "Waiting up to 5 minutes for services to be healthy..." | |
| timeout 300 bash -c 'until docker compose -f docker-compose-multirole.yaml ps | grep -E "(healthy|Started)"; do sleep 5; done' || { | |
| echo "Services failed to become healthy" | |
| docker compose -f docker-compose-multirole.yaml ps | |
| docker compose -f docker-compose-multirole.yaml logs | |
| exit 1 | |
| } | |
| - name: Check setup logs | |
| working-directory: compose | |
| run: | | |
| echo "=== Setup logs ===" | |
| docker compose -f docker-compose-multirole.yaml logs temporal-setup 2>&1 | grep -v "level=warning" | |
| echo "=== Checking for errors ===" | |
| if docker compose -f docker-compose-multirole.yaml logs temporal-setup 2>&1 | grep -v "level=warning" | grep -i "error" | grep -v "unable to describe namespace"; then | |
| echo "Found errors in setup logs" | |
| exit 1 | |
| fi | |
| echo "No errors found in setup logs" | |
| - name: Verify temporal services are running | |
| working-directory: compose | |
| run: | | |
| docker compose -f docker-compose-multirole.yaml ps temporal-history temporal-frontend temporal-matching temporal-worker | |
| - name: Cleanup | |
| if: always() | |
| working-directory: compose | |
| run: docker compose -f docker-compose-multirole.yaml down -v |