Skip to content

Commit 6de0063

Browse files
ci: [TT-412] adds ci workflow when push to master
1 parent a6fcb35 commit 6de0063

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

.github/workflows/time-tracker-v1-on-pull-request-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Time Tacker V1 CI
1+
name: Time Tacker V1 CI - ON PR
22

33
on:
44
pull_request:
55
branches: [master]
66

77
jobs:
8-
time-tracker-ci:
8+
time-tracker-ci-v1-on-pr:
99
runs-on: ubuntu-latest
1010

1111
strategy:
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Time Tacker V1 CI - ON PUSH
2+
3+
on:
4+
push:
5+
# update to master
6+
branches: [TT-412-onpush]
7+
8+
jobs:
9+
time-tracker-ci-v1-on-push:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
python-version: [3.9]
15+
16+
steps:
17+
- name: Checking out code from the repository
18+
uses: actions/checkout@v2
19+
20+
- name: Setting up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements/time_tracker_api/dev.txt
29+
pip install -r requirements/time_tracker_events/dev.txt
30+
31+
- name: Login to azure
32+
uses: Azure/login@v1
33+
with:
34+
creds: ${{ secrets.AZURE_CREDENTIALS }}
35+
36+
- name: Get vault from azure
37+
uses: Azure/get-keyvault-secrets@v1
38+
with:
39+
keyvault: "time-tracker-secrets"
40+
secrets: "MS-CLIENT-ID, MS-AUTHORITY, MS-SCOPE, MS-SECRET, MS-ENDPOINT, USERID, AZURE-APP-CONFIGURATION-CONNECTION-STRING, DATABASE-ACCOUNT-URI, DATABASE-MASTER-KEY, DATABASE-NAME, AZURE-STORAGE-ACCOUNT-KEY"
41+
id: timeTrackerAzureVault
42+
43+
- name: Run tests
44+
env:
45+
MS_AUTHORITY: ${{ steps.timeTrackerAzureVault.outputs.MS-AUTHORITY }}
46+
MS_CLIENT_ID: ${{ steps.timeTrackerAzureVault.outputs.MS-CLIENT-ID }}
47+
MS_SCOPE: ${{ steps.timeTrackerAzureVault.outputs.MS-SCOPE }}
48+
MS_SECRET: ${{ steps.timeTrackerAzureVault.outputs.MS-SECRET }}
49+
MS_ENDPOINT: ${{ steps.timeTrackerAzureVault.outputs.MS-ENDPOINT }}
50+
USERID: ${{ steps.timeTrackerAzureVault.outputs.USERID }}
51+
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ steps.timeTrackerAzureVault.outputs.AZURE-APP-CONFIGURATION-CONNECTION-STRING }}
52+
DATABASE_ACCOUNT_URI: ${{ steps.timeTrackerAzureVault.outputs.DATABASE-ACCOUNT-URI }}
53+
DATABASE_MASTER_KEY: ${{ steps.timeTrackerAzureVault.outputs.DATABASE-MASTER-KEY }}
54+
DATABASE_NAME: ${{ steps.timeTrackerAzureVault.outputs.DATABASE-NAME }}
55+
AZURE_STORAGE_ACCOUNT_KEY: ${{ steps.timeTrackerAzureVault.outputs.AZURE-STORAGE-ACCOUNT-KEY }}
56+
run: |
57+
pytest tests
58+
59+
- name: Build and push image
60+
uses: azure/docker-login@v1
61+
with:
62+
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
63+
username: ${{ secrets.REGISTRY_USERNAME }}
64+
password: ${{ secrets.REGISTRY_PASSWORD }}
65+
run: |
66+
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/timetrackerapi:${{ github.sha }}
67+
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/timetrackerapi:${{ github.sha }}

0 commit comments

Comments
 (0)