Migrating device-monitoring into device-registry microservice #4956
Workflow file for this run
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
name: run-tests | |
on: | |
pull_request: | |
branches: | |
- staging | |
jobs: | |
check: | |
name: check changed microservice(s) | |
outputs: | |
test_view_api: ${{ steps.check_files.outputs.test_view_api }} # view | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: check modified microserivces | |
id: check_files | |
run: | | |
echo "=============== list modified files ===============" | |
git diff --name-only HEAD^ HEAD | |
echo "========== check paths of modified files ==========" | |
git diff --name-only HEAD^ HEAD > files.txt | |
echo "test_view_api=false" >>$GITHUB_OUTPUT | |
while IFS= read -r file | |
do | |
echo $file | |
if [[ $file == src/view/* ]]; then | |
echo "test_view_api=true" >>$GITHUB_OUTPUT | |
fi | |
done < files.txt | |
view-api: | |
name: test-view-api | |
needs: [check] | |
if: needs.check.outputs.test_view_api == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
checks: write | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "adopt" | |
- name: Packaging | |
run: | | |
cd src/view/ | |
mvn --batch-mode -DskipTests package | |
- name: Testing | |
run: | | |
cd src/view/ | |
mvn --batch-mode -Dmaven.test.failure.ignore=true test | |
- name: Reporting test results | |
uses: dorny/[email protected] | |
if: always() | |
with: | |
working-directory: "src/view/" | |
name: Maven Tests | |
path: target/surefire-reports/*.xml | |
reporter: java-junit | |
fail-on-error: true |