move to production #12402
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: code-coverage-workflow | |
on: [push, pull_request] | |
jobs: | |
# setup for auth-service and device-registry microservice | |
auth-service-device-registry: | |
strategy: | |
matrix: | |
service: [auth-service, device-registry] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
defaults: | |
run: | |
working-directory: src/${{ matrix.service }} | |
name: Code Coverage for ${{ matrix.service }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests and collect coverage | |
continue-on-error: true | |
run: npm run test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
directory: src/${{ matrix.service }}/coverage | |
env: | |
SESSION_SECRET: ${{ secrets.SESSION_SECRET }} | |
REDIS_SERVER: ${{ secrets.REDIS_SERVER }} | |
REDIS_PORT: ${{ secrets.REDIS_PORT }} | |
# setup for workflows and predict microservices | |
workflows-predict: | |
strategy: | |
matrix: | |
microservice: [workflows, predict] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
name: Code coverage for ${{ matrix.microservice }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies and run tests | |
continue-on-error: true | |
run: | | |
cd src/${{ matrix.microservice }} | |
pip install -r requirements.txt | |
if [ "${{ matrix.microservice }}" == "workflows" ]; then | |
pytest --cov airqo_etl_utils/tests/ --cov-report=xml | |
else | |
pytest --cov api/tests/ --cov-report=xml | |
fi | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: src/${{ matrix.microservice }}/coverage.xml |