Skip to content

Fix tests #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
927c9b3
Remove unused GitHub Pages workflow
Oct 29, 2024
4d96f94
Add first workflow for GitHub Actions
Oct 29, 2024
2820e75
Add GitHub Actions workflow for shipping to production
Oct 29, 2024
c45f990
Add issue trigger to first workflow
Oct 29, 2024
bacefb4
Update first workflow to include secret variable and environment vari…
Oct 29, 2024
0d9517f
Update first workflow to include secret variable and environment vari…
Oct 29, 2024
dfbbb72
Update first workflow to include secret variable and environment vari…
Oct 29, 2024
daf6b00
Update first workflow to remove secret variable and environment variable
Oct 29, 2024
1a31dc1
Refactor message entity and add validation for text content length Re…
Oct 29, 2024
51152e0
Merge pull request #5 from marcelloraffaele/fix-message-size
marcelloraffaele Oct 29, 2024
f338cb2
Refactor Azure Bicep deployment workflow and update container registr…
Oct 29, 2024
3044d9c
Refactor Azure Bicep deployment workflow and update container registr…
Oct 29, 2024
05e25df
Refactor Azure Bicep deployment workflow and update container registr…
Oct 29, 2024
faa9d82
Refactor Azure Bicep deployment workflow to include environment selec…
Oct 29, 2024
2c00aa1
Refactor Azure Bicep deployment workflow to include environment selec…
Oct 30, 2024
337ece4
Refactor Azure Bicep deployment workflow to include environment selec…
Oct 30, 2024
db20a69
Refactor Azure Bicep deployment workflow and add missing newline in R…
Oct 30, 2024
2f61b7e
Refactor Azure Bicep deployment workflow and fix missing newline in R…
Oct 30, 2024
191bd1a
Refactor AppDbContext and Message classes
Oct 30, 2024
eba1370
Refactor Azure Bicep deployment workflow to include environment selec…
Oct 30, 2024
bf6add2
Refactor Azure Bicep deployment workflow to include environment selec…
Oct 30, 2024
91e4251
Add CODEOWNERS file
Oct 30, 2024
6c21804
Update README.md
marcelloraffaele Oct 30, 2024
a52a54d
Update README.md
marcelloraffaele Oct 30, 2024
a06e804
Update README.md
marcelloraffaele Oct 30, 2024
1d887b4
Merge pull request #6 from marcelloraffaele/feature-one
marcelloraffaele Oct 30, 2024
3584e76
Create codeql-analysis.yml
marcelloraffaele Oct 30, 2024
5857660
Merge pull request #7 from marcelloraffaele/codeql
marcelloraffaele Oct 30, 2024
463cdf2
Bump rexml from 3.3.6 to 3.3.9
dependabot[bot] Oct 30, 2024
5e7a2c5
Delete .github/workflows/codeql-analysis.yml
marcelloraffaele Oct 30, 2024
49a9db6
Merge pull request #9 from marcelloraffaele/marcelloraffaele-patch-1
marcelloraffaele Oct 30, 2024
d79b111
Create codeql.yml
marcelloraffaele Oct 30, 2024
6426306
Merge pull request #10 from marcelloraffaele/marcelloraffaele-patch-1
marcelloraffaele Oct 30, 2024
7337500
Merge pull request #8 from marcelloraffaele/dependabot/bundler/rexml-…
marcelloraffaele Oct 30, 2024
4dd06f2
Update .gitignore to include src/Application/src/RazorPagesTestSample…
Oct 30, 2024
d2769b0
Merge pull request #12 from marcelloraffaele/security-fixes
marcelloraffaele Oct 30, 2024
67ce996
Fix code scanning alert no. 2: Arbitrary file access during archive e…
marcelloraffaele Oct 30, 2024
4d664c6
Merge pull request #13 from marcelloraffaele/alert-autofix-2
marcelloraffaele Oct 30, 2024
c361421
Refactor message analysis logic for better performance and readabilit…
Oct 30, 2024
13d7d99
Merge pull request #15 from marcelloraffaele/performance-improvement
marcelloraffaele Oct 30, 2024
8c4f9b8
Update Index.cshtml.cs
marcelloraffaele Oct 30, 2024
8df7c2e
Merge pull request #16 from marcelloraffaele/perf-impr
marcelloraffaele Oct 30, 2024
b4a8cb3
Refactor Redis cache configuration for better performance and reliabi…
Oct 30, 2024
3dc5d9b
Merge pull request #18 from marcelloraffaele/add-redis
marcelloraffaele Oct 30, 2024
30e2c11
Refactor test setup for DataAccessLayerTest
Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [email protected] @marcelloraffaele @[email protected] @rmarcello
94 changes: 94 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '19 19 * * 6'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: csharp
build-mode: none
- language: ruby
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Azure Bicep

on:
workflow_dispatch:
inputs:
appenv:
type: choice
description: Choose the target environment
options:
- dev
- test
- prod

jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
# Checkout code
- uses: actions/checkout@main

# Log into Azure
- uses: azure/[email protected]
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true

# Deploy ARM template
- name: Run ARM deploy
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
resourceGroupName: ${{ secrets.AZURE_RG }}
template: ./src/InfrastructureAsCode/main.bicep
parameters: environment=${{ github.event.inputs.appenv }}
135 changes: 135 additions & 0 deletions .github/workflows/dotnet-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: .NET CI

env:
registryName: cq5qj5cc3ob6mmpnpreg.azurecr.io
repositoryName: techexcel/dotnetcoreapp
dockerFolderPath: ./src/Application/src/RazorPagesTestSample
tag: ${{github.run_number}}

on:
push:
branches: [ main ]
paths: src/Application/**
pull_request:
branches: [ main ]
paths: src/Application/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0

- name: Restore dependencies
run: dotnet restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
- name: Build
run: dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
- name: Test
run: dotnet test --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
- uses: actions/github-script@v6
if: failure()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
let body = "${{ env.build_name }} Workflow Failure \n Build Number: ${{ github.run_number }} \n Build Log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \n SHA: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) \n";
github.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "${{ env.build_name }} Workflow ${{ github.run_number }} Failed! ",
body: body
});

dockerBuildPush:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v3

- name: Docker Login
# You may pin to the exact commit or the version.
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/[email protected]
with:
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ${{ secrets.ACR_LOGIN_SERVER }}
# Username used to log against the Docker registry
username: ${{ secrets.ACR_USERNAME }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.ACR_PASSWORD }}
# Log out from the Docker registry at the end of a job
logout: true

- name: Docker Build
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath

- name: Docker Push
run: docker push $registryName/$repositoryName:$tag

deploy-to-dev:

runs-on: ubuntu-latest
needs: dockerBuildPush
environment:
name: dev
url: https://cq5qj5cc3ob6m-dev.azurewebsites.net/

steps:
- name: 'Login via Azure CLI'
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/webapps-deploy@v2
with:
app-name: 'cq5qj5cc3ob6m-dev'
images: cq5qj5cc3ob6mmpnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}

deploy-to-test:

runs-on: ubuntu-latest
needs: deploy-to-dev
environment:
name: test
url: https://cq5qj5cc3ob6m-test.azurewebsites.net/

steps:
- uses: actions/checkout@v3

- name: 'Login via Azure CLI'
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/webapps-deploy@v2
with:
app-name: 'cq5qj5cc3ob6m-test'
images: cq5qj5cc3ob6mmpnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}

deploy-to-prod:

runs-on: ubuntu-latest
needs: deploy-to-test
environment:
name: prod
url: https://cq5qj5cc3ob6m-prod.azurewebsites.net/

steps:
- uses: actions/checkout@v3

- name: 'Login via Azure CLI'
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/webapps-deploy@v2
with:
app-name: 'cq5qj5cc3ob6m-prod'
images: cq5qj5cc3ob6mmpnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
23 changes: 23 additions & 0 deletions .github/workflows/first-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: First Workflow
on:
workflow_dispatch:
issues:
types: [opened]

jobs:
job1:
runs-on: ubuntu-latest
steps:
- name: Echo Job 1
env:
SECRET: ${{ secrets.MY_SECRET_VAR }}
run: echo $SECRET

job2:
runs-on: ubuntu-latest
steps:
- name: Ship it
uses: mscoutermarsh/cowsays-action@master
with:
text: 'Ready for prod–ship it!'
color: 'magenta'
62 changes: 0 additions & 62 deletions .github/workflows/pages.yml

This file was deleted.

Loading
Loading