docs: add test verification comment to README #203
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: GitHub Actions | |
| on: [ push ] | |
| concurrency: ci-${{ github.ref }} # to avoid tag collisions in the ECR | |
| env: | |
| # Name of the image in the ECR | |
| APP_IMAGE: keboola-component | |
| # Developer portal login | |
| KBC_DEVELOPERPORTAL_VENDOR: "keboola" | |
| KBC_DEVELOPERPORTAL_APP: "keboola.project-restore" | |
| KBC_DEVELOPERPORTAL_USERNAME: "keboola+ci_project_restore_gh_actions" | |
| KBC_DEVELOPERPORTAL_PASSWORD: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }} | |
| # AWS Credentials | |
| TEST_AWS_ACCESS_KEY_ID: "AKIATDSWT52453UJH7T6" | |
| TEST_AWS_SECRET_ACCESS_KEY: "${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}" | |
| TEST_AWS_REGION: "us-east-1" | |
| TEST_AWS_S3_BUCKET: "ci-app-project-restore-s3filesbucket-wyeyj070cgcb" | |
| # Azure Credentials | |
| TEST_AZURE_ACCOUNT_NAME: "projectmigration" | |
| TEST_AZURE_ACCOUNT_KEY: "${{ secrets.TEST_AZURE_ACCOUNT_KEY }}" | |
| TEST_AZURE_CONTAINER_NAME: "test-app-restore-project" | |
| # GCP Credentials | |
| TEST_GCP_SERVICE_ACCOUNT: "${{ secrets.TEST_GCP_SERVICE_ACCOUNT }}" | |
| TEST_GCP_BUCKET: "ci-app-project-restore" | |
| # KBC Credentials | |
| # https://connection.keboola.com/admin/projects/9019/dashboard | |
| TEST_STORAGE_API_URL: "https://connection.keboola.com/" | |
| TEST_STORAGE_API_TOKEN: "${{ secrets.TEST_STORAGE_API_TOKEN }}" | |
| TEST_COMPONENT_ID: "keboola.project-restore" | |
| # DockerHub login | |
| DOCKERHUB_USER: "keboolabot" | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| app_image_tag: ${{ steps.tag.outputs.app_image_tag }} | |
| is_semantic_tag: ${{ steps.tag.outputs.is_semantic_tag }} | |
| steps: | |
| - | |
| name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - | |
| name: Print Docker version | |
| run: docker -v | |
| - | |
| name: Docker login | |
| if: env.DOCKERHUB_TOKEN | |
| run: docker login --username "$DOCKERHUB_USER" --password "$DOCKERHUB_TOKEN" | |
| - | |
| name: Build image | |
| run: docker build -t $APP_IMAGE . | |
| - | |
| name: Set image tag | |
| id: tag | |
| run: | | |
| TAG="${GITHUB_REF##*/}" | |
| IS_SEMANTIC_TAG=$(echo "$TAG" | grep -q '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$' && echo true || echo false) | |
| echo "Tag = '$TAG', is semantic tag = '$IS_SEMANTIC_TAG'" | |
| echo "is_semantic_tag=$IS_SEMANTIC_TAG" >> $GITHUB_OUTPUT | |
| echo "app_image_tag=$TAG" >> $GITHUB_OUTPUT | |
| - | |
| name: Push image to ECR | |
| uses: keboola/action-push-to-ecr@master | |
| with: | |
| vendor: ${{ env.KBC_DEVELOPERPORTAL_VENDOR }} | |
| app_id: ${{ env.KBC_DEVELOPERPORTAL_APP }} | |
| username: ${{ env.KBC_DEVELOPERPORTAL_USERNAME }} | |
| password: ${{ env.KBC_DEVELOPERPORTAL_PASSWORD }} | |
| tag: ${{ steps.tag.outputs.app_image_tag }} | |
| push_latest: ${{ steps.tag.outputs.is_semantic_tag }} | |
| source_image: ${{ env.APP_IMAGE}} | |
| tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - | |
| name: Pull image from ECR | |
| uses: keboola/action-pull-from-ecr@master | |
| with: | |
| vendor: ${{ env.KBC_DEVELOPERPORTAL_VENDOR }} | |
| app_id: ${{ env.KBC_DEVELOPERPORTAL_APP }} | |
| username: ${{ env.KBC_DEVELOPERPORTAL_USERNAME }} | |
| password: ${{ env.KBC_DEVELOPERPORTAL_PASSWORD }} | |
| tag: ${{ needs.build.outputs.app_image_tag }} | |
| target_image: ${{ env.APP_IMAGE}} | |
| tag_as_latest: true | |
| - | |
| name: Run tests | |
| run: docker run --rm | |
| -e TEST_COMPONENT_ID | |
| -e TEST_STORAGE_API_URL | |
| -e TEST_STORAGE_API_TOKEN | |
| -e TEST_AWS_ACCESS_KEY_ID | |
| -e TEST_AWS_SECRET_ACCESS_KEY | |
| -e TEST_AWS_REGION | |
| -e TEST_AWS_S3_BUCKET | |
| -e TEST_AZURE_ACCOUNT_NAME | |
| -e TEST_AZURE_ACCOUNT_KEY | |
| -e TEST_AZURE_CONTAINER_NAME | |
| -e TEST_GCP_SERVICE_ACCOUNT | |
| -e TEST_GCP_BUCKET | |
| ${{env.APP_IMAGE}} composer ci | |
| deploy: | |
| needs: | |
| - build | |
| - tests | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') && needs.build.outputs.is_semantic_tag == 'true' | |
| steps: | |
| - | |
| name: Set tag in the Deloper Portal | |
| uses: keboola/action-set-tag-developer-portal@master | |
| with: | |
| vendor: ${{ env.KBC_DEVELOPERPORTAL_VENDOR }} | |
| app_id: ${{ env.KBC_DEVELOPERPORTAL_APP }} | |
| username: ${{ env.KBC_DEVELOPERPORTAL_USERNAME }} | |
| password: ${{ env.KBC_DEVELOPERPORTAL_PASSWORD }} | |
| tag: ${{ needs.build.outputs.app_image_tag }} |