|
| 1 | +name: Test compose examples |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'compose/**' |
| 7 | + - '.github/workflows/compose.yaml' |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + paths: |
| 12 | + - 'compose/**' |
| 13 | + - '.github/workflows/compose.yaml' |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + lint-actions: |
| 20 | + name: Lint GitHub Actions workflows |
| 21 | + runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 5 |
| 23 | + steps: |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v6 |
| 26 | + |
| 27 | + - name: Lint actions |
| 28 | + run: | |
| 29 | + echo "::add-matcher::.github/actionlint-matcher.json" |
| 30 | + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) |
| 31 | + ./actionlint -color |
| 32 | + shell: bash |
| 33 | + |
| 34 | + compose-test: |
| 35 | + name: Test ${{ matrix.compose-file }} |
| 36 | + needs: lint-actions |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + compose-file: |
| 41 | + - docker-compose.yml |
| 42 | + - docker-compose-postgres.yml |
| 43 | + - docker-compose-mysql.yml |
| 44 | + - docker-compose-mysql-es.yml |
| 45 | + - docker-compose-cass-es.yml |
| 46 | + - docker-compose-postgres-opensearch.yml |
| 47 | + runs-on: ubuntu-latest |
| 48 | + timeout-minutes: 15 |
| 49 | + steps: |
| 50 | + - name: Print build information |
| 51 | + env: |
| 52 | + HEAD_REF: ${{ github.head_ref }} |
| 53 | + REF: ${{ github.ref }} |
| 54 | + COMPOSE_FILE: ${{ matrix.compose-file }} |
| 55 | + run: echo "head_ref=$HEAD_REF ref=$REF compose=$COMPOSE_FILE" |
| 56 | + |
| 57 | + - uses: actions/checkout@v6 |
| 58 | + |
| 59 | + - name: Start compose stack |
| 60 | + working-directory: compose |
| 61 | + run: docker compose -f ${{ matrix.compose-file }} up -d |
| 62 | + |
| 63 | + - name: Run validation |
| 64 | + working-directory: compose |
| 65 | + run: | |
| 66 | + docker compose -f ${{ matrix.compose-file }} -f docker-compose-validate.yml up temporal-validate --exit-code-from temporal-validate |
| 67 | +
|
| 68 | + - name: Print all logs on failure |
| 69 | + if: failure() |
| 70 | + working-directory: compose |
| 71 | + run: | |
| 72 | + echo "=== Printing all container logs ===" |
| 73 | + docker compose -f ${{ matrix.compose-file }} ps -a |
| 74 | + docker compose -f ${{ matrix.compose-file }} logs |
| 75 | +
|
| 76 | + - name: Cleanup |
| 77 | + if: always() |
| 78 | + working-directory: compose |
| 79 | + run: docker compose -f ${{ matrix.compose-file }} -f docker-compose-validate.yml down -v |
| 80 | + |
| 81 | + compose-tls-test: |
| 82 | + name: Test docker-compose-tls.yml |
| 83 | + needs: lint-actions |
| 84 | + runs-on: ubuntu-latest |
| 85 | + timeout-minutes: 20 |
| 86 | + steps: |
| 87 | + - name: Print build information |
| 88 | + env: |
| 89 | + HEAD_REF: ${{ github.head_ref }} |
| 90 | + REF: ${{ github.ref }} |
| 91 | + run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-tls.yml" |
| 92 | + |
| 93 | + - uses: actions/checkout@v6 |
| 94 | + |
| 95 | + - name: Generate TLS certificates |
| 96 | + working-directory: compose |
| 97 | + run: | |
| 98 | + docker build -t temporal_tls:test -f tls/Dockerfile.tls . |
| 99 | + mkdir -p .pki |
| 100 | + docker run --rm -v temporal_tls_pki:/pki -v "${PWD}"/.pki:/pki-out temporal_tls:test |
| 101 | +
|
| 102 | + - name: Build TLS images |
| 103 | + working-directory: compose |
| 104 | + run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml build --no-cache |
| 105 | + |
| 106 | + - name: Start TLS compose stack |
| 107 | + working-directory: compose |
| 108 | + run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml up -d |
| 109 | + |
| 110 | + - name: Run validation |
| 111 | + working-directory: compose |
| 112 | + run: | |
| 113 | + COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml -f docker-compose-validate.yml up temporal-validate --exit-code-from temporal-validate |
| 114 | +
|
| 115 | + - name: Print all logs on failure |
| 116 | + if: failure() |
| 117 | + working-directory: compose |
| 118 | + run: | |
| 119 | + echo "=== Printing all container logs ===" |
| 120 | + COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps -a |
| 121 | + COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs |
| 122 | +
|
| 123 | + - name: Cleanup |
| 124 | + if: always() |
| 125 | + working-directory: compose |
| 126 | + run: | |
| 127 | + COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml -f docker-compose-validate.yml down -v |
| 128 | + docker volume rm temporal_tls_pki || true |
| 129 | + rm -rf .pki |
| 130 | +
|
| 131 | + compose-multirole-test: |
| 132 | + name: Test docker-compose-multirole.yaml |
| 133 | + needs: lint-actions |
| 134 | + runs-on: ubuntu-latest |
| 135 | + timeout-minutes: 20 |
| 136 | + steps: |
| 137 | + - name: Print build information |
| 138 | + env: |
| 139 | + HEAD_REF: ${{ github.head_ref }} |
| 140 | + REF: ${{ github.ref }} |
| 141 | + run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-multirole.yaml" |
| 142 | + |
| 143 | + - uses: actions/checkout@v6 |
| 144 | + |
| 145 | + - name: Install loki Docker plugin |
| 146 | + run: docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
| 147 | + |
| 148 | + - name: Start multirole compose stack |
| 149 | + working-directory: compose |
| 150 | + run: docker compose -f docker-compose-multirole.yaml up -d |
| 151 | + |
| 152 | + - name: Run validation |
| 153 | + working-directory: compose |
| 154 | + run: | |
| 155 | + docker compose -f docker-compose-multirole.yaml -f docker-compose-validate-multirole.yml up temporal-validate --exit-code-from temporal-validate |
| 156 | +
|
| 157 | + - name: Verify temporal services are running |
| 158 | + working-directory: compose |
| 159 | + run: | |
| 160 | + docker compose -f docker-compose-multirole.yaml ps temporal-history temporal-frontend temporal-matching temporal-worker |
| 161 | +
|
| 162 | + - name: Print all logs on failure |
| 163 | + if: failure() |
| 164 | + working-directory: compose |
| 165 | + run: | |
| 166 | + echo "=== Printing all container logs ===" |
| 167 | + docker compose -f docker-compose-multirole.yaml ps -a |
| 168 | + docker compose -f docker-compose-multirole.yaml logs |
| 169 | +
|
| 170 | + - name: Cleanup |
| 171 | + if: always() |
| 172 | + working-directory: compose |
| 173 | + run: docker compose -f docker-compose-multirole.yaml -f docker-compose-validate-multirole.yml down -v |
0 commit comments