File tree Expand file tree Collapse file tree 3 files changed +90
-0
lines changed
Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1111 Build :
1212 environment : Development
1313 runs-on : ubuntu-latest
14+ if : github.event.pull_request.merged == true
1415 steps :
1516 - uses : actions/checkout@v2
1617 - uses : azure/docker-login@v1
Original file line number Diff line number Diff line change 1+ ---
2+ # ######## Stage Workflow ########
3+ on :
4+ pull_request :
5+ branches : [stage]
6+ types :
7+ - closed
8+ workflow_dispatch :
9+
10+ jobs :
11+ Build :
12+ environment : Stage
13+ runs-on : ubuntu-latest
14+ if : github.event.pull_request.merged == true
15+ steps :
16+ - uses : actions/checkout@v2
17+ - uses : azure/docker-login@v1
18+ with :
19+ login-server : ${{ secrets.REGISTRY_DOMAIN }}
20+ username : ${{ secrets.REGISTRY_USERNAME }}
21+ password : ${{ secrets.REGISTRY_PASSWORD }}
22+ - name : Publish image to Azure Registry
23+ run : |
24+ docker build -t ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }} -t ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.ref_name == 'master' && 'prod' || github.ref_name }}${{ github.ref_name != 'master' && '-latest' || 'latest' }} .
25+ docker push ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }} --all-tags
26+ Deploy :
27+ needs : Build
28+ environment :
29+ name : Development
30+ runs-on : ubuntu-latest
31+ steps :
32+ - name : Deploy to Stage
33+ uses : azure/webapps-deploy@v2
34+ with :
35+ app-name : ${{ secrets.AZURE_WEBAPP_NAME }}
36+ publish-profile : ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
37+ images : ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }}.
Original file line number Diff line number Diff line change 1+ ---
2+ name : Unit Tests
3+
4+ # ############################
5+ # Start the job on all push #
6+ # ############################
7+ on :
8+ push :
9+ branches-ignore :
10+ - ' **'
11+ # Remove the line above to run when pushing to master
12+ pull_request :
13+ branches : [master, dev]
14+
15+ # ##############
16+ # Set the Job #
17+ # ##############
18+ jobs :
19+ UnitTest :
20+ name : Unit Test Cases
21+ # Set the agent to run on
22+ runs-on : ubuntu-latest
23+ steps :
24+ - name : Checkout code
25+ uses : actions/checkout@v3
26+
27+ - name : Set up Python
28+ uses : actions/setup-python@v4
29+ with :
30+ python-version : " 3.10" # Use the appropriate Python version
31+
32+ - name : Install dependencies
33+ run : |
34+ pip install -r requirements.txt
35+ pip install -i https://test.pypi.org/simple/ python-osw-validation==0.0.3
36+
37+ - name : Run unit tests
38+ run : |
39+ python test_report.py
40+ coverage run --source=src -m unittest discover -s tests/
41+ coverage report -m
42+ exit_status=$?
43+
44+ # Set the exit status as an output for later use
45+ echo "::set-output name=exit_status::$exit_status"
46+
47+ - name : Archive Coverage Report
48+ if : ${{ always() }} # Upload the coverage report even if tests fail
49+ uses : actions/upload-artifact@v2
50+ with :
51+ name : htmlcov
52+ path : htmlcov
You can’t perform that action at this time.
0 commit comments