Skip to content

save screenshots to artefacts #80

save screenshots to artefacts

save screenshots to artefacts #80

Workflow file for this run

name: Keboola Component Deployment Pipeline
on: [ push ]
concurrency: ci-${{ github.ref }} # to avoid tag collisions in the ECR
env:
DOCKERHUB_USER: "keboolabot"
KBC_DEVELOPERPORTAL_APP: "kds-team.ex-heureka"
KBC_DEVELOPERPORTAL_VENDOR: "kds-team"
KBC_DEVELOPERPORTAL_USERNAME: "kds-team+github"
# to be set in repository secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} # required for pushing to ECR
# KBC_STORAGE_TOKEN: ${{ secrets.KBC_STORAGE_TOKEN }} # required for running KBC tests (optional)
# KBC_DEVELOPERPORTAL_PASSWORD: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
outputs:
app_image_tag: ${{ steps.tag.outputs.app_image_tag }}
is_semantic_tag: ${{ steps.tag.outputs.is_semantic_tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Docker login
if: env.DOCKERHUB_TOKEN
run: docker login --username "${{ env.DOCKERHUB_USER }}" --password "${{ env.DOCKERHUB_TOKEN }}"
- name: Build image
run: docker build -t "${{ env.KBC_DEVELOPERPORTAL_APP }}" .
- 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: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
tag: ${{ steps.tag.outputs.app_image_tag }}
push_latest: ${{ steps.tag.outputs.is_semantic_tag }}
source_image: ${{ env.KBC_DEVELOPERPORTAL_APP }}
tests:
runs-on: ubuntu-latest
needs:
- build
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: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
tag: ${{ needs.build.outputs.app_image_tag }}
target_image: ${{ env.KBC_DEVELOPERPORTAL_APP}}
tag_as_latest: true
- name: Run tests
run: |
docker run ${{ env.KBC_DEVELOPERPORTAL_APP }} flake8 . --config=flake8.cfg
echo "Running unit-tests..."
docker run ${{ env.KBC_DEVELOPERPORTAL_APP }} python -m unittest discover
tests-kbc:
env:
KBC_TEST_PROJECT_CONFIGS: ${{ vars.KBC_TEST_PROJECT_CONFIGS }}
KBC_STORAGE_TOKEN: ${{ secrets.KBC_STORAGE_TOKEN }}
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Run KBC test jobs
if: ${{ env.KBC_TEST_PROJECT_CONFIGS != '' }} && ${{ env.KBC_STORAGE_TOKEN != '' }}
uses: keboola/action-run-configs-parallel@master
with:
token: ${{ secrets.KBC_STORAGE_TOKEN }}
componentId: ${{ env.KBC_DEVELOPERPORTAL_APP }}
tag: ${{ needs.build.outputs.app_image_tag }}
configs: ${{ env.KBC_TEST_PROJECT_CONFIGS }}
deploy:
env:
KBC_DEVELOPERPORTAL_PASSWORD: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
needs:
- build
- tests
- tests-kbc
if : startsWith(github.ref, 'refs/tags/') && needs.build.outputs.is_semantic_tag == 'true'
runs-on: ubuntu-latest
steps:
- name: Set tag in the Developer 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: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}
tag: ${{ needs.build.outputs.app_image_tag }}
- name: Checkout Repository
uses: actions/checkout@v4
- name: Update developer portal properties
run: |
chmod +x scripts/update_dev_portal_properties.sh
scripts/update_dev_portal_properties.sh