-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (78 loc) · 2.4 KB
/
ci.yml
File metadata and controls
96 lines (78 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build
# MATRIX APPROACH USED SO WE CAN BUILD THE DOCKER IMAGES IN PARALLEL (quicker ci)
on:
push:
branches:
- master
jobs:
python-unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set Up Python
uses: actions/setup-python@v4
- name: Run Python Unit Tests
run: |
make python_tests
terraform-validate:
strategy:
matrix:
env: [dev]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Terraform via Docker and Validate
run: |
cd terraform
docker build -t ${{ matrix.env }}-tf-test --build-arg ENV=${{ matrix.env }} .
changed-files:
runs-on: ubuntu-latest
needs:
- python-unit-tests
outputs:
files_matrix: ${{ steps.print-changed-files.outputs.files_matrix }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Run Python Unit Tests
run: |
make python_tests
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v45
- name: Print Changed Files
id: print-changed-files
run: |
make get_changed_files changed_files="${{ steps.changed-files.outputs.all_changed_files }}"
build:
needs: changed-files
if: ${{ needs.changed-files.outputs.files_matrix != '[]' }}
strategy:
matrix:
service_name: ${{ fromJson(needs.changed-files.outputs.files_matrix) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Disable UNIT TEST for now
- name: Run Unit Tests
run: |
sudo apt-get install libcurl4
export ENVIRONMENT=ci
export JWT_SECRET=secret123
cd ${{ matrix.service_name }} && npm install && npm run test
- name: Build and Push Docker Images
run: |
docker build ./${{ matrix.service_name }} -t eddie1322/${{ matrix.service_name }}:latest
docker push eddie1322/${{ matrix.service_name }}:latest