[OSDEV-1117] Contribution record integration #3649
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 Quality | |
on: | |
pull_request: | |
types: [synchronize, opened, reopened] | |
jobs: | |
# code quality for the frontend | |
get-base-branch-fe-cov: | |
runs-on: ubuntu-latest | |
environment: Quality Environment | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Run the Jest tests and generate code cov report | |
run: docker compose run --rm --no-deps react yarn test | |
- name: Upload Jest code cov for the base branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base-branch-fe-jest-code-cov | |
path: ./src/react/coverage/lcov.info | |
run-fe-code-quality: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Run the Jest tests and generate code cov report | |
run: docker compose run --rm --no-deps react yarn test | |
- name: Upload Jest code cov for the feature branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: feature-branch-fe-jest-code-cov | |
path: ./src/react/coverage/lcov.info | |
check-fe-code-cov: | |
environment: Quality Environment | |
needs: | |
- get-base-branch-fe-cov | |
- run-fe-code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Jest code cov reports | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-jest-code-cov" | |
- name: Verify Jest code cov | |
uses: barecheck/code-coverage-action@v1 | |
with: | |
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
lcov-file: "./feature-branch-fe-jest-code-cov/lcov.info" | |
base-lcov-file: "./base-branch-fe-jest-code-cov/lcov.info" | |
minimum-ratio: 1 | |
send-summary-comment: true | |
show-annotations: "warning" | |
app-name: React App | Jest test suite | |
# code quality for the Django app | |
get-base-branch-django-cov: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh django \ | |
-c "coverage run --data-file=./coverage/django/.coverage manage.py test --no-input ./api/tests \ | |
&& coverage lcov --data-file=./coverage/django/.coverage -o ./coverage/django/coverage.lcov \ | |
--include='./api/*' --omit='./api/migrations/*,./api/tests/*'" | |
- name: Upload unittest code cov for the base branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base-branch-django-unittest-code-cov | |
path: ./src/django/coverage/django/coverage.lcov | |
run-django-code-quality: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh django \ | |
-c "coverage run --data-file=./coverage/django/.coverage manage.py test --no-input ./api/tests \ | |
&& coverage lcov --data-file=./coverage/django/.coverage -o ./coverage/django/coverage.lcov \ | |
--include='./api/*' --omit='./api/migrations/*,./api/tests/*'" | |
- name: Upload unittest code cov for the feature branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: feature-branch-django-unittest-code-cov | |
path: ./src/django/coverage/django/coverage.lcov | |
check-django-code-cov: | |
environment: Quality Environment | |
needs: | |
- get-base-branch-django-cov | |
- run-django-code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download unittest code cov reports | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-unittest-code-cov" | |
- name: Verify unittest code cov | |
uses: barecheck/code-coverage-action@v1 | |
with: | |
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
lcov-file: "./feature-branch-django-unittest-code-cov/coverage.lcov" | |
base-lcov-file: "./base-branch-django-unittest-code-cov/coverage.lcov" | |
minimum-ratio: 1 | |
send-summary-comment: true | |
show-annotations: "warning" | |
app-name: Django App | Unittest test suite | |
# code quality for the Countries | |
get-base-branch-countries-cov: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh django \ | |
-c "coverage run --data-file=./coverage/countries/.coverage manage.py test --no-input ./countries/tests \ | |
&& coverage lcov --data-file=./coverage/countries/.coverage -o ./coverage/countries/coverage.lcov \ | |
--include='./countries/*' --omit='./countries/tests/*'" | |
- name: Upload unittest code cov for the base branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base-branch-countries-unittest-code-cov | |
path: ./src/django/coverage/countries/coverage.lcov | |
run-countries-code-quality: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh django \ | |
-c "coverage run --data-file=./coverage/countries/.coverage manage.py test --no-input ./countries/tests \ | |
&& coverage lcov --data-file=./coverage/countries/.coverage -o ./coverage/countries/coverage.lcov \ | |
--include='./countries/*' --omit='./countries/tests/*'" | |
- name: Upload unittest code cov for the feature branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: feature-branch-countries-unittest-code-cov | |
path: ./src/django/coverage/countries/coverage.lcov | |
check-countries-code-cov: | |
environment: Quality Environment | |
needs: | |
- get-base-branch-countries-cov | |
- run-countries-code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download unittest code cov reports | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-unittest-code-cov" | |
- name: Verify unittest code cov | |
uses: barecheck/code-coverage-action@v1 | |
with: | |
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
lcov-file: "./feature-branch-countries-unittest-code-cov/coverage.lcov" | |
base-lcov-file: "./base-branch-countries-unittest-code-cov/coverage.lcov" | |
minimum-ratio: 1 | |
send-summary-comment: true | |
show-annotations: "warning" | |
app-name: Countries App | Unittest test suite | |
# code quality for the Contricleaner | |
get-base-branch-contricleaner-cov: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh django \ | |
-c "coverage run --data-file=./coverage/contricleaner/.coverage manage.py test --no-input ./contricleaner/tests \ | |
&& coverage lcov --data-file=./coverage/contricleaner/.coverage -o ./coverage/contricleaner/coverage.lcov \ | |
--include='./contricleaner/*' --omit='./contricleaner/tests/*'" | |
- name: Upload unittest code cov for the base branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base-branch-contricleaner-unittest-code-cov | |
path: ./src/django/coverage/contricleaner/coverage.lcov | |
run-contricleaner-code-quality: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh django \ | |
-c "coverage run --data-file=./coverage/contricleaner/.coverage manage.py test --no-input ./contricleaner/tests \ | |
&& coverage lcov --data-file=./coverage/contricleaner/.coverage -o ./coverage/contricleaner/coverage.lcov \ | |
--include='./contricleaner/*' --omit='./contricleaner/tests/*'" | |
- name: Upload unittest code cov for the feature branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: feature-branch-contricleaner-unittest-code-cov | |
path: ./src/django/coverage/contricleaner/coverage.lcov | |
check-contricleaner-code-cov: | |
environment: Quality Environment | |
needs: | |
- get-base-branch-contricleaner-cov | |
- run-contricleaner-code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download unittest code cov reports | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-unittest-code-cov" | |
- name: Verify unittest code cov | |
uses: barecheck/code-coverage-action@v1 | |
with: | |
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
lcov-file: "./feature-branch-contricleaner-unittest-code-cov/coverage.lcov" | |
base-lcov-file: "./base-branch-contricleaner-unittest-code-cov/coverage.lcov" | |
minimum-ratio: 1 | |
send-summary-comment: true | |
show-annotations: "warning" | |
app-name: Contricleaner App | Unittest test suite | |
# code quality for the Dedupe Hub | |
get-base-branch-dd-cov: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Dedupe Hub image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh api-app \ | |
-c "coverage run --source=app --data-file=./coverage/.coverage -m unittest \ | |
&& coverage lcov --data-file=./coverage/.coverage -o ./coverage/coverage.lcov \ | |
--include='./app/*' --omit='./tests/*, ./app/config.py'" | |
- name: Upload unittest code cov for the base branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base-branch-dd-unittest-code-cov | |
path: ./src/dedupe-hub/api/coverage/coverage.lcov | |
run-dd-code-quality: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Dedupe Hub image | |
run: docker compose build | |
- name: Run the unittest tests and generate code cov report | |
run: | | |
docker compose \ | |
run --rm --entrypoint /bin/sh api-app \ | |
-c "coverage run --source=app --data-file=./coverage/.coverage -m unittest \ | |
&& coverage lcov --data-file=./coverage/.coverage -o ./coverage/coverage.lcov \ | |
--include='./app/*' --omit='./tests/*, ./app/config.py'" | |
- name: Upload unittest code cov for the feature branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: feature-branch-dd-unittest-code-cov | |
path: ./src/dedupe-hub/api/coverage/coverage.lcov | |
check-dd-code-cov: | |
environment: Quality Environment | |
needs: | |
- get-base-branch-dd-cov | |
- run-dd-code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download unittest code cov reports | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-unittest-code-cov" | |
- name: Verify unittest code cov | |
uses: barecheck/code-coverage-action@v1 | |
with: | |
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
lcov-file: "./feature-branch-dd-unittest-code-cov/coverage.lcov" | |
base-lcov-file: "./base-branch-dd-unittest-code-cov/coverage.lcov" | |
minimum-ratio: 1 | |
send-summary-comment: true | |
show-annotations: "warning" | |
app-name: Dedupe Hub App | Unittest test suite | |
# code quality integration test | |
run-integration-test-code-quality: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build & Run OS Hub | |
run: scripts/start_code_quality_dev | |
- name: Waiting for all OS Hub services live processes completed | |
run: sleep 60 | |
- name: Build Integration Test image | |
run: docker compose -f docker-compose.tests.yml build | |
- name: Run Integration Test | |
run: | | |
docker compose -f docker-compose.tests.yml \ | |
run --rm --entrypoint /bin/sh integration-test \ | |
-c "python -m unittest" | |
- name: Run Playwright Test | |
run: | | |
docker compose -f docker-compose.tests.yml run --rm --build \ | |
--entrypoint "npx playwright test -c playwright.config.ts" \ | |
playwright-test | |
# code quality formatting | |
run-bash-script-linter: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run the shellcheck linter check | |
run: shellcheck scripts/* | |
run-flake8-linter: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Build Django image | |
run: docker compose build | |
- name: Run the Flake8 linter check | |
run: | | |
docker compose \ | |
run --rm --no-deps --entrypoint flake8 django \ | |
--exclude settings.py,manage.py,*.pyc,api/migrations/* | |
run-eslint-linter-and-prettier-formatter: | |
environment: Quality Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create required env file | |
run: | | |
echo '${{ secrets.CODE_QUALITY_ENV_FILE }}' > .env | |
- name: Run the ESLint linter check | |
run: | | |
docker compose \ | |
run --rm --entrypoint ./node_modules/.bin/eslint \ | |
react src/ --ext .js --ext .jsx | |
- name: Run the Prettier formatting check | |
run: | | |
docker compose \ | |
run --rm --no-deps react yarn prettier \ | |
--config .prettierrc \ | |
--check 'src/**/*.js' 'src/**/*.jsx' |