Skip to content

Commit

Permalink
TEST-1234 Update example.spec.ts (#16)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description 💬
<!--- Describe your changes in detail -->

## Motivation and Context 🥅
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How has this been tested? 🧪
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how
-->
<!--- your change affects other areas of the code, etc. -->
- [ ] Local build ⚒️
- [ ] Local tests 🧪
- [ ] (optional) Local run and endpoint tested in swagger 🚀

## Screenshots (if appropriate) 💻

## Types of changes 🌊
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

## Checklist ☑️

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] The pull request title starts with the jira case number (when
applicable), e.g. "TEST-1234 Add some feature"
- [ ] The person responsible for following up on requested review
changes has been assigned to the pull request
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.

## Highly optional checks, only use these if you have a reason to do so
✔️

- [ ] This PR changes the database so I have added the *create-diagram*
label to assist reviewers with a db diagram
- [ ] This PR changes platform or backend and I need others to be able
to test against these changes before merging to dev, so I have added the
*deploy-azure* label to deploy before merging the PR

## Checklist for the approver ✅

- [ ] I've checked the files view for spelling issues, code quality
warnings and similar
- [ ] I've waited until all checks have passed (green check/without
error)
- [ ] I've checked that only the intended files are changed
  • Loading branch information
hwinther authored May 3, 2024
1 parent 9f11b9a commit 7005125
Show file tree
Hide file tree
Showing 48 changed files with 2,592 additions and 183 deletions.
15 changes: 5 additions & 10 deletions .github/actions/backend-deploy/action.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
name: "Backend deploy"
description: "Deploys backend component"
branding:
icon: server
color: black

inputs:
deploy_target:
required: true
type: string
description: prod|qa|test|dev
repo_name:
required: true
type: string
description: main|qa|test|dev (repo name defined separate because main maps to prod)
labels:
required: true
type: string
description: labels from conditions in trigger workflow
base_name:
required: true
type: string
description: basil|gsi|login|ext
project_type:
required: true
type: string
description: function|app
dockerfile_path:
required: true
type: string
description: path to dockerfile
docker_image_name:
required: true
type: string
description: docker image name
azure_resource_name:
required: true
type: string
description: azure resource name
skip_setup:
required: false
default: false
type: bool
default: "false"
description: if true skips setting up .net and nuget package restore

runs:
Expand Down
149 changes: 149 additions & 0 deletions .github/actions/frontend-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: "Frontend build"
description: "Frontend (node) build and linting"
branding:
icon: table
color: black

inputs:
working_directory:
required: true
description: root folder of the node project, e.g. ./src/frontend/
package_manager:
required: false
description: npm|yarn
default: "yarn"

runs:
using: "composite"
steps:
- uses: actions/setup-node@v4
name: Setup node (npm)
if: inputs.working_directory == 'npm'
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
cache-dependency-path: "${{ inputs.working_directory }}/package-lock.json"

- uses: actions/setup-node@v4
name: Setup node (yarn)
if: inputs.working_directory == 'yarn'
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: "${{ inputs.working_directory }}/yarn.lock"

- name: Install dependencies
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
echo "::group::Install dependencies"
[[ "${{ inputs.package_manager }}" == "npm" ]] && npm ci || true
[[ "${{ inputs.package_manager }}" == "yarn" ]] && yarn install --immutable --immutable-cache --check-cache || true
echo "::endgroup::"
- name: Build
id: node-build
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
echo "::group::Build"
[[ "${{ inputs.package_manager }}" == "npm" ]] && npm run build 1>build.out 2>&1 || (exit 0)
[[ "${{ inputs.package_manager }}" == "yarn" ]] && yarn build 1>build.out 2>&1 || (exit 0)
echo -e "\nBuild output:\n"
cat build.out
grep "): error " build.out > build.err || (exit 0)
if [ ! -s build.err ]
then
echo "## ✅ Build successful" > build.md
else
# Reformat error output as github error annotations
error_regex="(.+)\(([0-9]+),[0-9]+\): error (.+)"
cat build.err | while read line
do
if [[ $line =~ $error_regex ]]; then
echo "::error file=${BASH_REMATCH[1]},line=${BASH_REMATCH[2]}::${BASH_REMATCH[3]}"
fi
done
cp build.err build.md
sed -i '/^$/d' build.md # removes empty lines
sed -i -e 's/^/- ❌ /' build.md # prefix with markdown list item and cross mark emoji
echo "## ❌ The following build issues should be fixed:" | cat - build.md > build.md.temp && mv build.md.temp build.md
fi
echo "result<<EOF"$'\n'"$(cat build.md)"$'\n'EOF >> $GITHUB_OUTPUT
cat build.md >> $GITHUB_STEP_SUMMARY
if [ -s build.err ]
then
exit 1
fi
echo "::endgroup::"
- name: Lint
if: always()
id: node-lint
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
echo "::group::Lint"
[[ "${{ inputs.package_manager }}" == "npm" ]] && npm run lint -- -f compact 1>lint.out 2>&1 || (exit 0)
[[ "${{ inputs.package_manager }}" == "yarn" ]] && yarn lint -f compact 1>lint.out 2>&1 || (exit 0)
echo -e "\nLint output:\n"
cat lint.out
cat lint.out | grep ": line " | sed -e 's|${{ env.TRAILING_AGENT_WORK_PATH }}||' >lint.err || (exit 0)
if [ ! -s lint.err ]
then
echo "## ✅ No linting issues 🎊" > lint.md
else
# Reformat lint output as github error annotations
error_regex="(.+): line ([0-9]+), col [0-9]+, [A-Za-z]+ - (.+)"
cat lint.err | while read line
do
if [[ $line =~ $error_regex ]]; then
echo "::error file=${BASH_REMATCH[1]},line=${BASH_REMATCH[2]}::${BASH_REMATCH[3]}"
fi
done
cp lint.err lint.md
sed -i '/^$/d' lint.md # removes empty lines
sed -i -e 's/^/- ❌ /' lint.md # prefix with markdown list item and cross mark emoji
echo "## ❌ The following linting issues should be fixed:" | cat - lint.md > lint.md.temp && mv lint.md.temp lint.md
fi
echo "result<<EOF"$'\n'"$(cat lint.md)"$'\n'EOF >> $GITHUB_OUTPUT
cat lint.md >> $GITHUB_STEP_SUMMARY
if [ -s lint.err ]
then
exit 1
fi
echo "::endgroup::"
- name: Combine outputs to single PR comment
if: always()
id: pr-comment-combiner
shell: bash
working-directory: ${{ inputs.working_directory }}
run: |
echo "# ${{ env.WORKFLOW_SHORT_NAME }}" > combined.md
cat build.md >> combined.md
cat lint.md >> combined.md
echo "result<<EOF"$'\n'"$(cat combined.md)"$'\n'EOF >> $GITHUB_OUTPUT
- name: "Create or Update PR Comment"
uses: im-open/[email protected]
if: always() && github.event_name == 'pull_request'
with:
github-token: ${{ env.GH_TOKEN }}
comment-identifier: "${{ env.WORKFLOW_SHORT_NAME }}-results"
comment-content: ${{ steps.pr-comment-combiner.outputs.result }}

- name: Create Todo Comments
uses: gkampitakis/github-action-todo-commenter@v1
with:
github-token: ${{ env.GH_TOKEN }}
review-message: "Please take a look :eyes:"
tags: "TODO:,FIXME:,BUG:"
10 changes: 5 additions & 5 deletions .github/actions/platform-deploy/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: "Backend deploy"
name: "Platform deploy"
description: "Deploys platform component"
branding:
icon: layers
color: black

inputs:
deploy_target:
required: true
type: string
description: prod|qa|test|dev
working_directory:
required: true
type: string
description: root folder where the main terraform plan resides, e.g. ./templates/terraform/
config_path:
required: true
type: string
description: .conf file relative to working_directory
var_path:
required: true
type: string
description: .var file path relative to working_directory

runs:
Expand Down
33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ updates:
assignees:
- "hwinther"

- package-ecosystem: "docker"
directory: "/"
open-pull-requests-limit: 20
target-branch: "dev"
schedule:
interval: "daily"
assignees:
- "hwinther"

- package-ecosystem: "nuget"
directory: "/src/backend"
open-pull-requests-limit: 20
Expand Down Expand Up @@ -54,3 +63,27 @@ updates:
- "@typescript-eslint/*"
- "*/eslint-plugin"
- "*/eslint-plugin-*"

- package-ecosystem: "npm"
directory: "/tests/playwright"
open-pull-requests-limit: 20
target-branch: "dev"
schedule:
interval: "weekly"
day: "sunday"
assignees:
- "hwinther"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
groups:
types:
patterns:
- "@types/*"
eslint:
patterns:
- "eslint"
- "eslint-*"
- "@typescript-eslint/*"
- "*/eslint-plugin"
- "*/eslint-plugin-*"
28 changes: 26 additions & 2 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ permissions:
contents: read
checks: write
pull-requests: write
actions: read # for super-linter
statuses: write # for super-linter

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
Expand All @@ -35,6 +37,7 @@ concurrency:
env:
DOTNET_VERSION: "8.0.x"
BACKEND_SOLUTION_PATH: "src/backend"
BACKEND_SOLUTION_FILE: "Backend.sln"
WORKFLOW_SHORT_NAME: "backend-ci"
WORKFLOW_AGENT_PATH: "/home/runner/work/test/test/"

Expand Down Expand Up @@ -63,15 +66,15 @@ jobs:
key: nuget-${{ hashFiles('**/packages.lock.json') }}

- name: dotnet restore
run: dotnet restore --locked-mode
run: dotnet restore --locked-mode ${{ env.BACKEND_SOLUTION_FILE }}

- name: dotnet tool restore
run: dotnet tool restore

- name: Build
id: dotnet-build
run: |
dotnet build -c Release --no-restore --nologo -consoleLoggerParameters:NoSummary -verbosity:quiet 1>build.out 2>&1 || (exit 0)
dotnet build ${{ env.BACKEND_SOLUTION_FILE }} -c Release --no-restore --nologo -consoleLoggerParameters:NoSummary -verbosity:quiet 1>build.out 2>&1 || (exit 0)
grep "): error " build.out > build.err || (exit 0)
if [ ! -s build.err ]
Expand Down Expand Up @@ -110,6 +113,27 @@ jobs:
comment-identifier: "${{ env.WORKFLOW_SHORT_NAME }}-build-results"
comment-content: ${{ steps.dotnet-build.outputs.result }}

- name: Create Todo Comments
uses: gkampitakis/github-action-todo-commenter@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
review-message: "Please take a look :eyes:"
tags: "TODO:,FIXME:,BUG:"

# # TODO: move?
# - name: Super-linter
# uses: super-linter/[email protected]
# env:
# # To report GitHub Actions status checks
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CREATE_LOG_FILE: true
# LOG_FILE: super-linter.out
# DISABLE_ERRORS: true

# - run: |
# ls -la ${{ env.WORKFLOW_AGENT_PATH }}
# sudo cat ${{ env.WORKFLOW_AGENT_PATH }}super-linter.out >> $GITHUB_STEP_SUMMARY

- name: WebApi Tests
run: dotnet test ../../tests/backend/WebApi.Tests --no-restore --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx" /p:CollectCoverage=true /p:CoverletOutput="../../tests/backend/WebApi.Tests/TestResults/" /p:CoverletOutputFormat=cobertura

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/frontend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Frontend CI"

on:
workflow_dispatch:
push:
branches:
- dev
tags:
- "v*"
paths:
- "src/frontend/**"
pull_request:
branches:
- main
- test
- dev
paths:
- "src/frontend/**"
- ".github/workflows/frontend-ci.yml"
types: [opened, reopened, labeled, synchronize, ready_for_review]

# Sets permissions of the GITHUB_TOKEN to allow creating checks and updating PR
permissions:
contents: read
checks: write
pull-requests: write

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

env:
NODE_VERSION: "20"
WORKFLOW_SHORT_NAME: "frontend"
FRONTEND_PATH: "src/frontend"
TRAILING_AGENT_WORK_PATH: "/home/runner/work/test/test/"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
defaults:
run:
working-directory: ${{ env.FRONTEND_PATH }}
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/actions/frontend-build
with:
working_directory: ${{ env.FRONTEND_PATH }}
3 changes: 3 additions & 0 deletions .github/workflows/playwright-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- test
pull_request:
branches:
- main
- qa
- test
- dev
- "feature/*"
- "bugfix/*"
Expand Down
Loading

0 comments on commit 7005125

Please sign in to comment.