Minimal setup to pull the HCD image for integration testing #2
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: Run integration tests on HCD + Data API | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write # required for OIDC | |
| contents: read # required for actions/checkout if you use it | |
| env: | |
| AWS_ECR_REGION: ${{ secrets.AWS_ECR_REGION }} | |
| AWS_ECR_ACCOUNT_ID: ${{ secrets.AWS_ECR_ACCOUNT_ID }} | |
| AWS_ECR_ROLE_NAME: ${{ secrets.AWS_ECR_ROLE_NAME }} | |
| AWS_ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }} | |
| AWS_ECR_REGISTRY: ${{ secrets.AWS_ECR_REGISTRY }} | |
| AWS_ECR_HCD_IMAGE_TAG: "1.2.3" | |
| jobs: | |
| test: | |
| env: | |
| # template: some might be needed (OpenAI API Key, "reranking API Key" ?) | |
| VAR_NAME: ${{ secrets.VAR_NAME }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Configure AWS credentials from OIDC | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::${{ env.AWS_ECR_ACCOUNT_ID }}:role/${{ env.AWS_ECR_ROLE_NAME }} | |
| aws-region: ${{ env.AWS_ECR_REGION }} | |
| - name: Login to Amazon ECR | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Pull the image | |
| run: | | |
| docker pull $AWS_ECR_REGISTRY/$AWS_ECR_REPOSITORY:$AWS_ECR_HCD_IMAGE_TAG | |
| # TODO maybe replace this step with 'testcontainers' ? | |
| - name: Start HCD + Data API | |
| run: | | |
| docker compose up -d | |
| working-directory: docker-compose | |
| - name: A few seconds for the Data API to fully start | |
| run: sleep 10 | |
| # TODO remove this mock step | |
| - name: Issue a request to the Data API | |
| run: | | |
| curl -XPOST \ | |
| http://localhost:8181/v1/ \ | |
| -H "token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"findKeyspaces": {}}' | |
| # TODO set up runtime, dependencies, whatever is needed to run the c# tests | |
| # TODO run the tests |