-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #461 from adessoSE/dev
Version 1.6.4
- Loading branch information
Showing
78 changed files
with
16,199 additions
and
20,057 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,53 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'Seed-Test_v*' | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Get Tag Name | ||
id: get_tag_name | ||
run: | | ||
version=$(echo $GITHUB_REF | sed 's/refs\/tags\///' | sed 's/.*_//') | ||
echo "version=${version}" >> ${GITHUB_OUTPUT} | ||
# BACKEND | ||
- name: Build Docker Image | ||
run: docker build -t seed-test-backend:${{ steps.get_tag_name.outputs.version }} ./backend | ||
|
||
- name: Tag Docker Image as Latest | ||
run: | | ||
docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} | ||
docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest | ||
- name: Push Docker Image to Docker Hub | ||
run: | | ||
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} | ||
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest | ||
# FRONTEND | ||
- name: Build Docker Image | ||
run: docker build -t seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ./frontend | ||
|
||
- name: Tag Docker Image as Latest | ||
run: | | ||
docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} | ||
docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest | ||
- name: Push Docker Image to Docker Hub | ||
run: | | ||
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} | ||
docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest |
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,196 @@ | ||
name: Start Docker Stack | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
start-docker-stack: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Dependencies | ||
run: npm install node-fetch | ||
|
||
- name: Use Docker | ||
uses: actions-hub/docker/cli@master | ||
env: | ||
SKIP_LOGIN: true | ||
|
||
- name: Create .env file backend | ||
run: | | ||
echo "DATABASE_URI=${{secrets.DB_URI}}" > backend/.env | ||
echo "EMAIL_AUTH=${{secrets.EMAIL_AUTH}}" >> backend/.env | ||
echo "EMAIL_PW=${{secrets.EMAIL_PW}}" >> backend/.env | ||
echo "EMAIL_PORT=${{secrets.EMAIL_PORT}}" >> backend/.env | ||
echo "EMAIL_HOST=${{secrets.EMAIL_HOST}}" >> backend/.env | ||
echo "FRONTEND_URL=${{secrets.FRONTEND_URL}}" >> backend/.env | ||
echo "GITHUB_CLIENT_SECRET=${{secrets.G_CLIENT_SECRET}}" >> backend/.env | ||
echo "GITHUB_CLIENT_ID=${{secrets.G_CLIENT_ID}}" >> backend/.env | ||
echo "PASSPORT_GITHUB_LOCAL_PW_FIELD=${{secrets.PASSPORT_GITHUB_LOCAL_PW_FIELD}}" >> backend/.env | ||
- name: Create .env file fronted | ||
run: | | ||
echo "API_SERVER=${{secrets.API_SERVER}}" > frontend/.env | ||
echo "GITHUB_CLIENT_ID=${{secrets.G_CLIENT_ID}}" >> frontend/.env | ||
echo "EMAIL_PW=${{secrets.EMAIL_PW}}" >> frontend/.env | ||
echo "VERSION=SET" >> frontend/.env | ||
- name: Build and start Docker stack | ||
run: | | ||
docker compose -f docker-test.yml up -d | ||
- name: Send failure notification | ||
if: ${{ failure() }} | ||
uses: ./actions/fullReport | ||
with: | ||
prnumber: ${{ github.event.pull_request.number }} | ||
originBranch: ${{ github.event.pull_request.head.ref }} | ||
destinationBranch: ${{ github.event.pull_request.base.ref }} | ||
requestor: ${{ github.event.pull_request.user.login }} | ||
date: ${{ github.event.pull_request.created_at }} | ||
description: ${{ github.event.pull_request.body }} | ||
dockerStatus: "failed" | ||
workflowLink: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
|
||
- name: Wait for 1/2 minute | ||
run: sleep 30 | ||
|
||
# execute npm test in the backend container --------------------------------------------------------------- | ||
- name: Run npm test backend | ||
run: | | ||
docker exec Seed-backend npm test > testResultsBackend.txt 2>&1 | ||
continue-on-error: true | ||
|
||
- name: Clean up the result backend | ||
run: | | ||
awk '/Test Suites:/{flag=1; print; next} /Ran all test suites\./{flag=0} flag' testResultsBackend.txt > cleanResultsBackend.txt | ||
echo "" >> cleanResultsBackend.txt | ||
printf "$(cat cleanResultsBackend.txt)" > cleanResultsBackend.txt | ||
- name: Get passed, failed and total backend | ||
run: | | ||
passed=$(awk '/Tests:/ { match($0, /[0-9]+ passed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsBackend.txt) | ||
failed=$(awk '/Tests:/ { match($0, /[0-9]+ failed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsBackend.txt) | ||
echo "passedTests=${passed}" >> "${GITHUB_OUTPUT}" | ||
echo "failedTests=${failed}" >> "${GITHUB_OUTPUT}" | ||
passedSuites=$(awk '/Suites:/ { match($0, /[0-9]+ passed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsBackend.txt) | ||
failedSuites=$(awk '/Suites:/ { match($0, /[0-9]+ failed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsBackend.txt) | ||
echo "passedSuites=${passedSuites}" >> ${GITHUB_OUTPUT} | ||
echo "failedSuites=${failedSuites}" >> ${GITHUB_OUTPUT} | ||
bottomText=$(awk '/Snapshots:/{flag=1;print}/^$/{flag=0}flag' cleanResultsBackend.txt | tr -d '\n') | ||
echo "bottomText=${bottomText}" >> ${GITHUB_OUTPUT} | ||
id: passed-total-backend | ||
|
||
- name: Upload Artifact Backend | ||
if: ${{ !env.ACT }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results-backend | ||
path: | | ||
testResultsBackend.txt | ||
# execute npm test in the frontend container -------------------------------------------------------------- | ||
- name: Run npm test frontend | ||
run: | | ||
docker exec Seed-frontend npm test > testResultsFrontend.txt 2>&1 | ||
continue-on-error: true | ||
|
||
- name: Clean up the result frontend | ||
run: | | ||
awk '/Test Suites:/{flag=1; print; next} /Ran all test suites\./{flag=0} flag' testResultsFrontend.txt > cleanResultsFrontend.txt | ||
echo "" >> cleanResultsFrontend.txt | ||
printf "$(cat cleanResultsFrontend.txt)" > cleanResultsFrontend.txt | ||
- name: Get passed and total frontend | ||
run: | | ||
passed=$(awk '/Tests:/ { match($0, /[0-9]+ passed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsFrontend.txt) | ||
failed=$(awk '/Tests:/ { match($0, /[0-9]+ failed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsFrontend.txt) | ||
echo "passedTests=${passed}" >> "${GITHUB_OUTPUT}" | ||
echo "failedTests=${failed}" >> "${GITHUB_OUTPUT}" | ||
passedSuites=$(awk '/Suites:/ { match($0, /[0-9]+ passed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsFrontend.txt) | ||
failedSuites=$(awk '/Suites:/ { match($0, /[0-9]+ failed/); print substr($0, RSTART, RLENGTH-7) }' cleanResultsFrontend.txt) | ||
echo "passedSuites=${passedSuites}" >> ${GITHUB_OUTPUT} | ||
echo "failedSuites=${failedSuites}" >> ${GITHUB_OUTPUT} | ||
bottomText=$(awk '/Snapshots:/{flag=1;print}/^$/{flag=0}flag' cleanResultsFrontend.txt | tr -d '\n') | ||
echo "bottomText=${bottomText}" >> ${GITHUB_OUTPUT} | ||
id: passed-total-frontend | ||
|
||
- name: Upload Artifact Frontend | ||
if: ${{ !env.ACT }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results-frontend | ||
path: | | ||
testResultsFrontend.txt | ||
# SANITY CHECK -------------------------------------------------------------------------------------------- | ||
- name: Send sanity POST request and store response | ||
env: | ||
# <-- api url for sanity test -->/<---- repository_id --->/<------ group_id ------> | ||
API_URL: localhost:8080/api/sanity/test/632893aad3bd45536c41b684/6400a70f5eda22409c4d2ed9 | ||
run: | | ||
curl -X POST -H 'Content-Type: application/json' -d '{"email": "${{ secrets.SEED_EMAIL }}", "password": "${{ secrets.SEED_PW }}", "stayLoggedIn": true, "repository": "Seed-Test", "source": "db"}' "$API_URL" > sanityReport.txt | ||
- name: print sanity | ||
run: | | ||
echo $(cat sanityReport.txt) | ||
- name: Get passed and total sanity | ||
run: | | ||
passed=$(awk '/Steps:/ { match($0, /[0-9]+ passed/); print substr($0, RSTART, RLENGTH-7) }' sanityReport.txt) | ||
failed=$(awk '/Steps:/ { match($0, /[0-9]+ failed/); print substr($0, RSTART, RLENGTH-7) }' sanityReport.txt) | ||
skipped=$(awk '/Steps:/ { match($0, /[0-9]+ skipped/); print substr($0, RSTART, RLENGTH-8) }' sanityReport.txt) | ||
echo "passedSteps=${passed}" >> "${GITHUB_OUTPUT}" | ||
echo "failedSteps=${failed}" >> "${GITHUB_OUTPUT}" | ||
echo "skippedSteps=${skipped}" >> "${GITHUB_OUTPUT}" | ||
passedScenarios=$(awk '/Scenarios:/ { match($0, /[0-9]+ passed/); print substr($0, RSTART, RLENGTH-7) }' sanityReport.txt) | ||
failedScenarios=$(awk '/Scenarios:/ { match($0, /[0-9]+ failed/); print substr($0, RSTART, RLENGTH-7) }' sanityReport.txt) | ||
echo "passedScenarios=${passedScenarios}" >> ${GITHUB_OUTPUT} | ||
echo "failedScenarios=${failedScenarios}" >> ${GITHUB_OUTPUT} | ||
bottomText=bottomText=$(awk '/Snapshots:/{flag=1;next}/^$/{flag=0}flag' sanityReport.txt | tr -d '\n') | ||
echo "bottomText=${bottomText}" >> ${GITHUB_OUTPUT} | ||
id: passed-total-sanity | ||
|
||
- name: Upload Artifact Sanity | ||
if: ${{ !env.ACT }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: sanity-report | ||
path: | | ||
sanityReport.txt | ||
# SEND FULL REPORT --------------------------------------------------------------------------------------- | ||
- name: Send Teams Message | ||
uses: ./actions/fullReport | ||
with: | ||
prnumber: ${{ github.event.pull_request.number }} | ||
prlink: ${{ github.event.pull_request.html_url }} | ||
originBranch: ${{ github.event.pull_request.head.ref }} | ||
destinationBranch: ${{ github.event.pull_request.base.ref }} | ||
requestor: ${{ github.event.pull_request.user.login }} | ||
date: ${{ github.event.pull_request.created_at }} | ||
description: ${{ github.event.pull_request.body }} | ||
dockerStatus: "success" | ||
frontendSuitsPassed: ${{ steps.passed-total-frontend.outputs.passedSuites }} | ||
frontendSuitsFailed: ${{ steps.passed-total-frontend.outputs.failedSuites }} | ||
frontendTestsPassed: ${{ steps.passed-total-frontend.outputs.passedTests }} | ||
frontendTestsFailed: ${{ steps.passed-total-frontend.outputs.failedTests }} | ||
frontendBottomText: ${{ steps.passed-total-frontend.outputs.bottomText }} | ||
backendSuitsPassed: ${{ steps.passed-total-backend.outputs.passedSuites }} | ||
backendSuitsFailed: ${{ steps.passed-total-backend.outputs.failedSuites }} | ||
backendTestsPassed: ${{ steps.passed-total-backend.outputs.passedTests }} | ||
backendTestsFailed: ${{ steps.passed-total-backend.outputs.failedTests }} | ||
backendBottomText: ${{ steps.passed-total-backend.outputs.bottomText }} | ||
sanityScenariosPassed: ${{ steps.passed-total-sanity.outputs.passedScenarios }} | ||
sanityScenariosFailed: ${{ steps.passed-total-sanity.outputs.failedScenarios }} | ||
sanityStepsPassed: ${{ steps.passed-total-sanity.outputs.passedSteps }} | ||
sanityStepsFailed: ${{ steps.passed-total-sanity.outputs.failedSteps }} | ||
sanityStepsSkipped: ${{ steps.passed-total-sanity.outputs.skippedSteps }} | ||
workflowLink: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} |
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,39 @@ | ||
on: | ||
# Trigger analysis when pushing in master or pull requests, and when creating | ||
# a pull request. | ||
gollum | ||
name: SonarCloud | ||
jobs: | ||
sonarcloud: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Disabling shallow clone is recommended for improving relevancy of reporting | ||
fetch-depth: 0 | ||
- name: SonarCloud Scan | ||
id: sonarcloud-scan | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
- name: Send simple notification | ||
if: ${{ failure() }} | ||
uses: mikesprague/teams-incoming-webhook-action@v1 | ||
with: | ||
github-token: ${{ github.token }} | ||
webhook-url: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
title: 'SonarCloud Scan failed' | ||
deploy-card: true | ||
timestamp: Europe/Berlin | ||
color: 'failure' | ||
- name: Send simple notification | ||
if: ${{ success() }} | ||
uses: mikesprague/teams-incoming-webhook-action@v1 | ||
with: | ||
github-token: ${{ github.token }} | ||
webhook-url: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
title: 'SonarCloud Scan succesfull' | ||
deploy-card: true | ||
timestamp: Europe/Berlin | ||
color: 'success' |
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
Oops, something went wrong.