diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 6bd880b9..deb55c84 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -1,4 +1,4 @@ -name: "Backend CI - placeholder" +name: "Backend CI" on: workflow_dispatch: @@ -35,6 +35,8 @@ concurrency: env: DOTNET_VERSION: "8.0.x" BACKEND_SOLUTION_PATH: "src/backend" + WORKFLOW_SHORT_NAME: "backend-ci" + WORKFLOW_AGENT_PATH: "/home/runner/work/test/test/" jobs: build: @@ -63,5 +65,55 @@ jobs: - name: dotnet restore run: dotnet restore --locked-mode - - name: dotnet build - run: dotnet build -c Release --no-restore + - name: Build + id: npm-build + run: | + dotnet build -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 ] + then + echo "## ✅ Build successful" > build.md + else + # Reformat error output as github error annotations + error_regex="(.+)\(([0-9]+),([0-9]+)\): error (.+) \[(.+)\]" + # Capture groups: 1=file path 2=line 3=character 4=warn: message 5=project path + cat build.err | while read line + do + if [[ $line =~ $error_regex ]]; then + echo "::error file=${BASH_REMATCH[1]},line=${BASH_REMATCH[2]}::${BASH_REMATCH[4]}" + fi + done + + cat build.err | sed 's|${{ env.WORKFLOW_AGENT_PATH }}|| ; s|${{ env.WORKFLOW_AGENT_PATH }}||' > 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<> $GITHUB_OUTPUT + cat build.md >> $GITHUB_STEP_SUMMARY + + if [ -s build.err ] + then + exit 1 + fi + + - name: "Create or Update PR Comment" + uses: im-open/update-pr-comment@v1.2.2 + if: ${{ always() && github.event_name == 'pull_request' }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + comment-identifier: "${{ env.WORKFLOW_SHORT_NAME }}-build-results" + comment-content: ${{ steps.npm-build.outputs.result }} + + - name: Inspect code + uses: muno92/resharper_inspectcode@v1 + if: always() + with: + workingDirectory: ${{ env.BACKEND_SOLUTION_PATH }} + solutionPath: Backend.sln + dotnetVersion: ${{ env.DOTNET_VERSION }} + failOnIssue: false + include: | + **.cs diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 0ea450c8..46ed93fe 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -60,32 +60,32 @@ jobs: - name: Build id: npm-build run: | - npm run build 1>npm-npm.out 2>&1 || (exit 0) - grep "): error " npm-npm.out > npm-npm.err || (exit 0) + npm run build 1>build.out 2>&1 || (exit 0) + grep "): error " build.out > build.err || (exit 0) - if [ ! -s npm-npm.err ] + if [ ! -s build.err ] then - echo "## ✅ Build successful" > npm-npm.md + echo "## ✅ Build successful" > build.md else # Reformat error output as github error annotations error_regex="(.+)\(([0-9]+),[0-9]+\): error (.+)" - cat npm-npm.err | while read line + 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 npm-npm.err npm-npm.md - sed -i '/^$/d' npm-npm.md # removes empty lines - sed -i -e 's/^/- ❌ /' npm-npm.md # prefix with markdown list item and cross mark emoji - echo "## ❌ The following build issues should be fixed:" | cat - npm-npm.md > npm-npm.md.temp && mv npm-npm.md.temp npm-npm.md + 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<> $GITHUB_OUTPUT - cat npm-npm.md >> $GITHUB_STEP_SUMMARY + echo "result<> $GITHUB_OUTPUT + cat build.md >> $GITHUB_STEP_SUMMARY - if [ -s npm-npm.err ] + if [ -s build.err ] then exit 1 fi @@ -203,25 +203,25 @@ jobs: job-summary: true icon-style: "emojis" - - name: Convert markdown to slack format - uses: denis-trofimov/slackify-markdown-action@v1.0.0 - if: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target' || github.event_name == 'push') && always() }} - id: slackify-markdown - with: - text: ${{ steps.playwright-report-summary.outputs.summary }} - - - name: Send custom JSON data to Slack workflow - if: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target' || github.event_name == 'push') && always() }} - id: slack - uses: slackapi/slack-github-action@v1.25.0 - with: - payload: | - { - "message": "${{ steps.slackify-markdown.outputs.text }}", - "deploy_target": "${{ inputs.deploy_target }}" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + # - name: Convert markdown to slack format + # uses: denis-trofimov/slackify-markdown-action@v1.0.0 + # if: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target' || github.event_name == 'push') && always() }} + # id: slackify-markdown + # with: + # text: ${{ steps.playwright-report-summary.outputs.summary }} + + # - name: Send custom JSON data to Slack workflow + # if: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target' || github.event_name == 'push') && always() }} + # id: slack + # uses: slackapi/slack-github-action@v1.25.0 + # with: + # payload: | + # { + # "message": "${{ steps.slackify-markdown.outputs.text }}", + # "deploy_target": "${{ inputs.deploy_target }}" + # } + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - uses: actions/upload-artifact@v4 if: always() diff --git a/src/backend/.config/dotnet-tools.json b/src/backend/.config/dotnet-tools.json new file mode 100644 index 00000000..677ed3f7 --- /dev/null +++ b/src/backend/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "8.0.4", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file