|
| 1 | +name: Main Check |
| 2 | +run-name: ${{ github.actor }} made changes |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | +jobs: |
| 9 | + detect-changes: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + container: |
| 12 | + image: node:16-alpine3.15 |
| 13 | + outputs: |
| 14 | + # ui: ${{ steps.filter.outputs.ui }} |
| 15 | + # server: ${{ steps.filter.outputs.server }} |
| 16 | + # python_client: ${{ steps.filter.outputs.python_client }} |
| 17 | + # func_tests: ${{ steps.filter.outputs.func_tests }} |
| 18 | + # black_formating: ${{ steps.filter.outputs.black_formating }} |
| 19 | + # embedded_ml_sdk: ${{ steps.filter.outputs.embedded_ml_sdk }} |
| 20 | + ui: 'false' |
| 21 | + server: 'true' |
| 22 | + python_client: 'false' |
| 23 | + func_tests: 'false' |
| 24 | + black_formating: 'false' |
| 25 | + server_unit_tests: 'false' |
| 26 | + embedded_ml_sdk: 'false' |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - name: Check diff |
| 30 | + id: filter |
| 31 | + uses: dorny/paths-filter@v3 |
| 32 | + with: |
| 33 | + base: 'main' |
| 34 | + filters: | |
| 35 | + ui: |
| 36 | + - 'src/ui/**' |
| 37 | + server: |
| 38 | + - 'src/server/**' |
| 39 | + python_client: |
| 40 | + - 'src/python_client/**' |
| 41 | + func_tests: |
| 42 | + - 'func_tests/**' |
| 43 | + embedded_ml_sdk: |
| 44 | + - 'src/embedded_ml_sdk/**' |
| 45 | + - name: Set black formating |
| 46 | + run: echo '' |
| 47 | + outputs: |
| 48 | + black_formating: ${{ steps.filter.outputs.server == 'true' || steps.filter.outputs.python_client == 'true' || steps.filter.outputs.func_tests == 'true' }} |
| 49 | + server_unit_tests: ${{ steps.filter.outputs.server == 'true' || steps.filter.outputs.python_client == 'true }} |
| 50 | + |
| 51 | + check-ui: |
| 52 | + name: Check Formatting UI / UI Unit tests running |
| 53 | + needs: detect-changes |
| 54 | + if: ${{ needs.detect-changes.outputs.ui == 'true' }} |
| 55 | + |
| 56 | + runs-on: ubuntu-latest |
| 57 | + container: |
| 58 | + image: node:16-alpine3.15 |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - name: Install node packages |
| 63 | + run: yarn --cwd src/ui install |
| 64 | + - name: Run Eslint |
| 65 | + run: yarn --cwd src/ui eslint |
| 66 | + - name: Run Unit Tests |
| 67 | + run: yarn --cwd src/ui test |
| 68 | + |
| 69 | + check-black-formating: |
| 70 | + name: Check Formatting Black |
| 71 | + needs: detect-changes |
| 72 | + if: ${{ needs.detect-changes.outputs.black_formating == 'true' }} |
| 73 | + |
| 74 | + runs-on: ubuntu-latest |
| 75 | + container: |
| 76 | + user: sml-app |
| 77 | + image: sensiml/base |
| 78 | + |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + - run: pip install black==24.4.2 |
| 82 | + |
| 83 | + - name: Check Formatting Server |
| 84 | + if: ${{ needs.detect-changes.outputs.server == 'true' }} |
| 85 | + run: python -m black --check src/server/ |
| 86 | + |
| 87 | + - name: Check Formatting Python Client |
| 88 | + if: ${{ needs.detect-changes.outputs.python_client == 'true' }} |
| 89 | + run: python -m black --check src/python_client |
| 90 | + |
| 91 | + - name: Check Formatting Function Test |
| 92 | + if: ${{ needs.detect-changes.outputs.func_tests == 'true' }} |
| 93 | + run: python -m black --check func_tests/ |
| 94 | + |
| 95 | + run-server-unit-tests: |
| 96 | + name: "Run Server Unit Test" |
| 97 | + needs: |
| 98 | + - detect-changes |
| 99 | + if: ${{ needs.detect-changes.outputs.server_unit_tests == 'true' }} |
| 100 | + |
| 101 | + runs-on: ubuntu-latest |
| 102 | + container: |
| 103 | + user: sml-app |
| 104 | + image: sensiml/base |
| 105 | + services: |
| 106 | + db: |
| 107 | + image: postgres |
| 108 | + env: |
| 109 | + POSTGRES_DB: piccolodb |
| 110 | + POSTGRES_USER: piccoloadmin |
| 111 | + POSTGRES_PASSWORD: piccoloadmin3 |
| 112 | + ports: |
| 113 | + - 5432:5432 |
| 114 | + |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v4 |
| 117 | + - run: | |
| 118 | + export DJANGO_ENV=docker |
| 119 | + export DJANGO_ENV_PATH=${{github.workspace}}/src/server/config/env/ |
| 120 | + py.test --durations=0 --junitxml=report_out.xml --html=unittest_report.html --cov=./ --cov-report html:cov_html -n 6 |
| 121 | +
|
| 122 | + run-embedded-ml-unit-tests: |
| 123 | + name: "Run Embedded ML Unit Test" |
| 124 | + needs: |
| 125 | + - detect-changes |
| 126 | + if: ${{ needs.detect-changes.outputs.embedded_ml_sdk == 'true' }} |
| 127 | + |
| 128 | + runs-on: ubuntu-latest |
| 129 | + container: |
| 130 | + image: sensiml/base |
| 131 | + steps: |
| 132 | + - run: | |
| 133 | + yes Y | apt install libgtest-dev build-essential cmake |
| 134 | + cd /usr/src/googletest && cmake . |
| 135 | + cmake --build . --target install |
| 136 | + - run: | |
| 137 | + cd src/embedded_ml_sdk/utest |
| 138 | + ls -lh |
| 139 | + sudo bash build.sh |
| 140 | +
|
0 commit comments