update pipeline to use docker compose #23
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: tmm-api-integration-test | |
| on: | |
| push: | |
| paths: | |
| - "services/tmm-api/**" | |
| - "docker-compose.int-test.yaml" | |
| - ".github/workflows/tmm-api-integration-test.yml" | |
| env: | |
| REGISTRY: ghcr.io | |
| REPOSITORY: ${{ github.repository }} | |
| STACK_NAME: tmm-api | |
| jobs: | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| TMM_API_IMAGE_NAME: ${{ steps.image-name.outputs.TMM_API_IMAGE_NAME}} | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Set image name | |
| id: image-name | |
| run: | | |
| TMM_API_IMAGE_NAME=${REGISTRY}/${REPOSITORY}/${STACK_NAME}:latest | |
| echo "TMM_API_IMAGE_NAME=${TMM_API_IMAGE_NAME}" >> $GITHUB_ENV | |
| echo "TMM_API_IMAGE_NAME=${TMM_API_IMAGE_NAME}" >> $GITHUB_OUTPUT | |
| - uses: buildpacks/github-actions/setup-pack@v4.8.1 | |
| - name: Build tmm-api image | |
| working-directory: "services/tmm-api" | |
| run: docker build -t ${TMM_API_IMAGE_NAME} . | |
| - name: Start service | |
| run: docker compose -f docker-compose.int-test.yaml up -d | |
| - name: Check service is up | |
| # TODO: Add some propper tests. | |
| run: | | |
| sleep 10 | |
| curl -f localhost:5000/internal/health/self | |
| curl -f localhost:5000/internal/health/int | |
| - name: Service Logs | |
| if: failure() | |
| run: docker compose -f docker-compose.int-test.yaml logs | |
| - name: Stop service | |
| if: always() | |
| run: docker compose -f docker-compose.int-test.yaml down |