Skip to content

Commit

Permalink
Merge branch 'main' into add-additional-message-verbs
Browse files Browse the repository at this point in the history
  • Loading branch information
KipSigei committed Jul 25, 2024
2 parents dc188ba + 98064d1 commit 3f02904
Show file tree
Hide file tree
Showing 422 changed files with 30,798 additions and 16,974 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
**/*tests
**/*test
**/*__pycache__
onadata/media
onadata/test_data_media
onadata/test_media
docs/_build
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
max-line-length = 88
select = C,E,F,W,B,B950
extend-ignore = E203,E501
extend-ignore = E203,E501,W503
per-file-ignores = __init__.py:F401
102 changes: 25 additions & 77 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: "x64"
Expand All @@ -46,70 +46,19 @@ jobs:
pip install -r requirements/azure.pip
- name: Install linting tools
run:
pip install prospector==1.7.7 pylint==2.14.5
run: pip install prospector==1.7.7 pylint==2.14.5

- name: Run Prospector
run: prospector -X -s veryhigh onadata
unit-tests-1:
name: Django Unit Tests (Libraries, Main, RestServices, SMS Support, Viewer, Messaging)
runs-on: ubuntu-22.04
needs: static-analysis
env:
DJANGO_SETTINGS_MODULE: onadata.settings.github_actions_test
services:
postgres:
image: postgis/postgis:13-3.0
env:
POSTGRES_PASSWORD: onadata
POSTGRES_DB: onadata
POSTGRES_USER: onadata
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "8"

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: "x64"
cache: "pip"
cache-dependency-path: |
requirements/base.pip
requirements/dev.pip
requirements/azure.pip
- name: Update apt sources
run: sudo apt-get update

- name: Install APT requirements
run: sudo apt-get install -y --no-install-recommends libjpeg-dev zlib1g-dev software-properties-common ghostscript libxslt1-dev binutils libproj-dev gdal-bin memcached libmemcached-dev libxml2-dev libxslt-dev

- name: Install Pip requirements
run: |
pip install -U pip
pip install -r requirements/base.pip
pip install -r requirements/dev.pip
- name: Run tests
run: |
python manage.py test onadata/libs onadata/apps/main onadata/apps/restservice onadata/apps/sms_support onadata/apps/viewer onadata/apps/messaging --noinput --timing --settings=onadata.settings.github_actions_test --verbosity=2 --parallel=4
unit-tests-2:
name: Django Unit Tests (API, Logger)
unit-tests:
strategy:
fail-fast: false
matrix:
test_path:
- [" Django Unit Tests (Libraries, Main, RestServices, SMS Support, Viewer, Messaging)", "python manage.py test onadata/libs onadata/apps/main onadata/apps/restservice onadata/apps/sms_support onadata/apps/viewer onadata/apps/messaging --noinput --timing --settings=onadata.settings.github_actions_test --verbosity=2 --parallel=4"]
- ["Django Unit Tests API", "python manage.py test onadata/apps/api --noinput --timing --settings=onadata.settings.github_actions_test --verbosity=2 --parallel=4"]
- ["Django Unit Tests Logger", "python manage.py test onadata/apps/logger --noinput --timing --settings=onadata.settings.github_actions_test --verbosity=2 --parallel=4"]
name: "${{ matrix.test_path[0] }}"
runs-on: ubuntu-22.04
needs: static-analysis
env:
Expand All @@ -131,16 +80,16 @@ jobs:
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: "8"

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: "x64"
Expand All @@ -165,13 +114,13 @@ jobs:
- name: Run tests
run: |
python manage.py test onadata/apps/api onadata/apps/logger --noinput --timing --settings=onadata.settings.github_actions_test --verbosity=2 --parallel=4
${{ matrix.test_path[1] }}
security-check:
name: Trivy Security Checks
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Update apt sources
run: sudo apt-get update
Expand All @@ -182,7 +131,7 @@ jobs:
run: echo "version=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Build Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/onadata-uwsgi/Dockerfile.ubuntu
Expand All @@ -200,9 +149,8 @@ jobs:
image-ref: onaio/onadata:${{ github.head_ref || github.base_ref || env.version }}
format: sarif
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
exit-code: '1'
output: 'trivy_results.sarif'
severity: "CRITICAL,HIGH"
output: "trivy_results.sarif"

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand All @@ -211,13 +159,13 @@ jobs:
image-ref: onaio/onadata:${{ github.head_ref || github.base_ref || env.version }}
format: sarif
ignore-unfixed: true
output: 'trivy_results.sarif'
output: "trivy_results.sarif"

- name: Upload vulnerability scan results
uses: github/codeql-action/upload-sarif@v2
if: github.event_name == 'push'
uses: github/codeql-action/upload-sarif@v3
if: github.event_name == 'push' || github.event_name == 'pull_request'
with:
sarif_file: 'trivy_results.sarif'
sarif_file: "trivy_results.sarif"

- name: Run Trivy vulnerability for Slack summary
uses: aquasecurity/trivy-action@master
Expand All @@ -226,7 +174,7 @@ jobs:
image-ref: onaio/onadata:${{ github.head_ref || github.base_ref || env.version }}
format: json
ignore-unfixed: true
output: 'trivy_results.json'
output: "trivy_results.json"

- name: Create summary of trivy issues
if: github.event_name == 'push'
Expand Down
Loading

0 comments on commit 3f02904

Please sign in to comment.