Skip to content

Add github action with e2e tests #20

Add github action with e2e tests

Add github action with e2e tests #20

Workflow file for this run

name: E2E tests
on:
pull_request:
inputs:
keep_fm:
description: 'Keep Frinx-machine instance'
required: true
default: 'true'
host:
description: 'frinx-machine helm-chart branch'
required: true
default: 'main'
workflow_dispatch:
inputs:
keep_fm:
description: 'Keep Frinx-machine instance'
required: true
default: 'true'
host:
description: 'frinx-machine helm-chart branch'
required: true
default: 'main'
jobs:
trigger-test:
runs-on: [self-hosted, kaas]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create image tag
id: var
run: |
calculatedSha=$(git rev-parse --short HEAD)
latestVersion=$(git describe --tags --abbrev=0 --match="v[0-9]*" | sed -e 's/^v//')
echo "short_sha=$calculatedSha" >> $GITHUB_OUTPUT
echo "image_tag=$latestVersion-$calculatedSha" >> $GITHUB_OUTPUT
- name: Echo tag
run: |
echo ${{ steps.var.outputs.image_tag }}
# - name: Login to DockerHub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Build and push latest
# id: docker_build
# env:
# TAG: ${{ steps.var.outputs.image_tag }}
# uses: docker/build-push-action@v4
# with:
# push: true
# tags: |
# frinx/frinx-frontend:${{ env.TAG }}
# build-args: |
# COMMIT_HASH=${{ github.sha }}
# PRIVATE_GH_TOKEN=${{ secrets.PACKAGE_TOKEN }}
# PRIVATE_NPM_TOKEN=${{ secrets.PUBLISH_TOKEN }}
- name: Invoke argo-event hook
run: |
curl --location --request POST '${{ secrets.ARGO_EVENT_URL }}' \
--header 'Authorization: ${{ secrets.ARGO_EVENT_SECRET }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "${{ github.event.pull_request.title }}",
"pr_number": "${{ github.event.number }}",
"event": "${{ github.event_name }}",
"repository": "${{ github.event.repository.name }}",
"owner": "${{ github.repository_owner }}",
"commit": "${{ github.event.pull_request.head.sha }}",
"commit_short": "${{ steps.vars.outputs.short_sha }}",
"ref": "${{ github.ref }}",
"head": "${{ github.head_ref }}",
"workflow": "${{ github.workflow }}",
"slack_channel": "common/slack-webhook/fx_env_demo_azure",
"path": "/workspace/frinx-machine/staging/app/",
"internal_page": "true",
"cypress": {
"branch": "ui-1.0.38+",
"spec": "cypress/e2e/0-check-main-page/*",
"host": "localhost:8080",
"auth0_username": "",
"auth0_password": "",
"auth0_tenant_id": "",
"auth0_scope": "",
"auth0_client_id": "",
"auth0_client_secret": "",
"numTestsKeptInMemory": 0
}
}'
- name: Start job notification
run: |
docker run \
-e state=pending \
-e target_url=https://argo-frinx.csf.elisa.fi/workflows/ \
-e description="Workflow for argo workflow to take job" \
-e context="Argo Workflows" \
-e access_token="${{ secrets.ARGO_WF_NOTIFICATION_GH_TOKEN }}" \
-e organisation=FRINXio \
-e app_repo="frinx-frontend" \
-e git_sha="${{ github.event.pull_request.head.sha }}" \
ghcr.io/sendible-labs/ci-github-notifier:stable
- name: Print url
if: ${{ github.event.inputs.keep_fm || 'true' == 'true' }}
run: |
echo "::notice::Frinx-machine is deployed at ui-${{ steps.var.outputs.short_sha }}-frinx.csf.elisa.fi(behind Elisa VPN)"
- name: Print url
if: ${{ github.event.inputs.keep_fm || 'true' == 'true' }}
run: |
echo "::warning::Please delete the instance after use(Resume workflow in argo-workflow)!"