-
Notifications
You must be signed in to change notification settings - Fork 371
chore: Addition of PyLint,Test WorkFlow and Docker Integartion Workflow file #38
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
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
55bedaa
edit 1
619afa9
edit 2
38aaf58
Repository Governance
3fe801b
added stale-bot
7e7b72e
stalebot test
5a676da
chNGED TO 1 DAY
d20ffde
edit 3
9b55d1a
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
5e568d8
Create test
Harmanpreet-Microsoft 3eb8010
edit1
8b1298f
edit2
683c4a9
edit 4
8ebaa51
edit 5
801d6eb
edit 6
1c845fa
edit 6
82446b2
edit 7
a9f989f
edit 8
3e31574
edit 5
805a8ba
edit 10
ab4c4c5
edit 11
7a5dbb4
edit 12
a32fb8d
edit 13
bec99d7
Update stale-bot.yml
Harmanpreet-Microsoft df179d1
edit 14
d755232
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
955eb5b
edit 15
bc48275
edit 16
e47008f
edit 17
6a56c07
Update stale-bot.yml
Harmanpreet-Microsoft 5905679
Update CODEOWNER
Harmanpreet-Microsoft 40dfc88
Create nwetest
Harmanpreet-Microsoft 07e1d4e
added pylint
06f1c2f
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
9222555
changed flak loc
bc4e843
edit 1
7ddb489
add backend test workflow
aceb522
added test file
47b3741
edit 2
950d330
added sample test file
962b38b
changed py version
f31bf82
made edits to workflow
0fcbff4
pass even if test filesa r not present
4569e80
removed test file
c0a4dae
added sample test file
182db35
Create docker-build-and-push.yml
Harmanpreet-Microsoft d6afd6f
Merge pull request #1 from Harmanpreet-Microsoft/stale_bot_tset
Harmanpreet-Microsoft 0bf1920
Merge pull request #4 from microsoft/main
Harmanpreet-Microsoft c754e9c
Delete test
Harmanpreet-Microsoft 3109279
Delete src/backend/middleware/test_health_check.py
Harmanpreet-Microsoft 23cd01f
Delete .github/nwetest
Harmanpreet-Microsoft a720e12
Delete .github/workflows/CI.yml
Harmanpreet-Microsoft 7791bd8
updated docker
4a1ece9
Merge branch 'main' of https://github.com/Harmanpreet-Microsoft/Multi…
6d92760
Update test.yml
Harmanpreet-Microsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E501 | ||
exclude = .venv, frontend | ||
ignore = E203, W503, G004, G200 |
This file contains hidden or 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,83 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- demo | ||
- hotfix | ||
pull_request: | ||
types: | ||
- opened | ||
- ready_for_review | ||
- reopened | ||
- synchronize | ||
branches: | ||
- main | ||
- dev | ||
- demo | ||
- hotfix | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to Azure Container Registry | ||
if: ${{ github.ref_name == 'main' }} | ||
uses: azure/docker-login@v2 | ||
with: | ||
login-server: ${{ secrets.ACR_LOGIN_SERVER }} | ||
username: ${{ secrets.ACR_USERNAME }} | ||
password: ${{ secrets.ACR_PASSWORD }} | ||
|
||
- name: Log in to Azure Container Registry (Dev/Demo) | ||
if: ${{ github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }} | ||
uses: azure/docker-login@v2 | ||
with: | ||
login-server: ${{ secrets.ACR_DEV_LOGIN_SERVER }} | ||
username: ${{ secrets.ACR_DEV_USERNAME }} | ||
password: ${{ secrets.ACR_DEV_PASSWORD }} | ||
|
||
- name: Set Docker image tag | ||
run: | | ||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
echo "TAG=latest" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then | ||
echo "TAG=dev" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref }}" == "refs/heads/demo" ]]; then | ||
echo "TAG=demo" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref }}" == "refs/heads/hotfix" ]]; then | ||
echo "TAG=hotfix" >> $GITHUB_ENV | ||
fi | ||
- name: Build and push Docker images | ||
if: ${{ github.ref_name == 'main' }} | ||
run: | | ||
cd src/backend | ||
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macae-backend:${{ env.TAG }} -f Dockerfile . && \ | ||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/macae-backend:${{ env.TAG }} && \ | ||
echo "Backend image built and pushed successfully." | ||
cd ../frontend | ||
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/mac-webapp:${{ env.TAG }} -f Dockerfile . && \ | ||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/mac-webapp:${{ env.TAG }} && \ | ||
echo "Frontend image built and pushed successfully." | ||
- name: Build and push Docker images (Dev/Demo/hotfix) | ||
if: ${{ github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }} | ||
run: | | ||
cd src/backend | ||
docker build -t ${{ secrets.ACR_DEV_LOGIN_SERVER }}/macae-backend:${{ env.TAG }} -f Dockerfile . && \ | ||
docker push ${{ secrets.ACR_DEV_LOGIN_SERVER }}/macae-backend:${{ env.TAG }} && \ | ||
echo "Dev/Demo/Hotfix Backend image built and pushed successfully." | ||
cd ../frontend | ||
docker build -t ${{ secrets.ACR_DEV_LOGIN_SERVER }}/mac-webapp:${{ env.TAG }} -f Dockerfile . && \ | ||
docker push ${{ secrets.ACR_DEV_LOGIN_SERVER }}/mac-webapp:${{ env.TAG }} && \ | ||
echo "Dev/Demo/Hotfix Frontend image built and pushed successfully." | ||
|
This file contains hidden or 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,27 @@ | ||
name: Pylint and Flake8 | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r src/backend/requirements.txt | ||
pip install flake8 # Ensure flake8 is installed explicitly | ||
|
||
- name: Run flake8 and pylint | ||
run: | | ||
flake8 --config=.flake8 src/backend # Specify the directory to lint |
This file contains hidden or 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,61 @@ | ||
name: Test Workflow with Coverage | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- demo | ||
- hotfix | ||
pull_request: | ||
types: | ||
- opened | ||
- ready_for_review | ||
- reopened | ||
- synchronize | ||
branches: | ||
- main | ||
- main | ||
- dev | ||
- demo | ||
- hotfix | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r src/backend/requirements.txt | ||
pip install pytest-cov | ||
|
||
- name: Check if test files exist | ||
id: check_tests | ||
run: | | ||
if [ -z "$(find src -type f -name 'test_*.py')" ]; then | ||
echo "No test files found, skipping tests." | ||
echo "skip_tests=true" >> $GITHUB_ENV | ||
else | ||
echo "Test files found, running tests." | ||
echo "skip_tests=false" >> $GITHUB_ENV | ||
fi | ||
|
||
- name: Run tests with coverage | ||
if: env.skip_tests == 'false' | ||
run: | | ||
pytest --cov=. --cov-report=term-missing --cov-report=xml | ||
|
||
- name: Skip coverage report if no tests | ||
if: env.skip_tests == 'true' | ||
run: | | ||
echo "Skipping coverage report because no tests were found." |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.