-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action with e2e tests (#1278)
Signed-off-by: Simon Misencik <[email protected]>
- Loading branch information
1 parent
25a19c4
commit 0d4cd16
Showing
1 changed file
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: E2E tests trigger | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
keep_fm: | ||
description: 'Keep Frinx-machine instance' | ||
required: true | ||
default: 'false' | ||
type: choice | ||
options: | ||
- true | ||
- false | ||
fm_branch: | ||
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.var.outputs.short_sha }}", | ||
"ref": "${{ github.ref }}", | ||
"head": "${{ github.head_ref }}", | ||
"workflow": "${{ github.workflow }}", | ||
"slack_channel": "common/slack-webhook/fx_env_demo_azure", | ||
"path": "/workspace/charts/frinx-machine/", | ||
"keep_fm": "${{ github.event.inputs.keep_fm }}", | ||
"fm_branch": "${{ github.event.inputs.fm_branch }}", | ||
"image_tag": "${{ steps.var.outputs.image_tag }}", | ||
"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 }} | ||
run: | | ||
echo "::notice::Frinx-machine is deployed at ui-${{ steps.var.outputs.short_sha }}-frinx.csf.elisa.fi(behind Elisa VPN)" | ||
echo "::warning::Please delete the instance after use(Resume workflow in argo-workflow)!" |