-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ba1502
commit ac17315
Showing
7 changed files
with
600 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,46 @@ | ||
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 | ||
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 }}" |
This file contains 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,9 @@ | ||
.PHONY: get_changed_files python_tests | ||
|
||
changed_files := | ||
|
||
get_changed_files: | ||
python3 ./scripts/changed_files/changed_files.py $(changed_files) | ||
|
||
python_tests: | ||
python3 -m unittest discover -s ./scripts/tests -p "*.py" |
This file contains 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,14 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains 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,32 @@ | ||
import json | ||
|
||
""" | ||
Identifies files that were changed to produce a matrix to run in git hub actions for updating the appropriate docker images. | ||
""" | ||
|
||
import sys | ||
|
||
files = sys.argv[1:] | ||
|
||
services = set(["auth-service", "sneaker-service", "order-service", "payment-service"]) | ||
|
||
""" | ||
Generates a matrix of service names returning an array of strings | ||
""" | ||
def get_changed_files(files): | ||
|
||
matrix = set() | ||
|
||
for service in files: | ||
service_directory = service.split("/")[0] | ||
|
||
if service_directory in services: | ||
matrix.add(service_directory) | ||
|
||
|
||
return list(matrix) | ||
|
||
changed_files = get_changed_files(files) | ||
|
||
# Set as Output in github actions | ||
print(f"::set-output name=files_matrix::{json.dumps(changed_files)}") |
Oops, something went wrong.