-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #626 from NASA-IMPACT/dev
September, 2024 production deploy
- Loading branch information
Showing
7 changed files
with
112 additions
and
302 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,62 +6,53 @@ on: | |
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: python:3.11.7 | ||
strategy: | ||
matrix: | ||
python-version: ['3.11'] | ||
defaults: | ||
run: | ||
working-directory: ./app | ||
|
||
env: | ||
DB_ENGINE: django.contrib.gis.db.backends.postgis | ||
DB_NAME: admg | ||
DB_USER: postgres | ||
DB_PASSWORD: postgres | ||
DB_HOST: postgres # 127.0.0.1 | ||
DB_USER: admg | ||
DB_PASSWORD: admg | ||
DB_HOST: 127.0.0.1 | ||
DB_PORT: 5432 | ||
DJANGO_SETTINGS_MODULE: config.settings.local | ||
DJANGO_SECRET_KEY: "secret key here" | ||
DJANGO_ADMIN_URL: admg/ | ||
GH_TOKEN: faketokenhere | ||
GCMD_SYNC_SOURCE_EMAIL: gcmdadmg@localhost | ||
GCMD_SYNC_RECIPIENTS: gcmd@localhost | ||
CELERY_BROKER_URL: amqp://guest:guest@rabbitmq:5672/ | ||
|
||
services: | ||
postgres: | ||
image: postgis/postgis:13-3.2 | ||
env: | ||
POSTGRES_DB: admg | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
rabbitmq: | ||
image: rabbitmq:latest | ||
env: | ||
RABBITMQ_DEFAULT_USER: guest | ||
RABBITMQ_DEFAULT_PASS: guest | ||
ports: | ||
- 5672:5672 | ||
CELERY_BROKER_URL: amqp://guest:guest@localhost:5672/ | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install GDAL | ||
run: | | ||
apt-get update -y | ||
apt-get install -y libgdal-dev | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
- name: Setup PostgreSQL with Postgis | ||
uses: huaxk/[email protected] | ||
with: | ||
python-version: 3.11.7 | ||
# cache: pip # Unable to use caching, https://github.com/actions/setup-python/issues/719 | ||
postgresql version: latest | ||
postgresql db: admg | ||
postgresql user: admg | ||
postgresql password: admg | ||
|
||
- name: Setup RabbitMQ | ||
uses: nijel/[email protected] | ||
with: | ||
rabbitmq version: latest | ||
|
||
- name: Install GDAL | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libgdal-dev | ||
- name: Set user-site-path | ||
id: user-site | ||
|
@@ -114,51 +105,3 @@ jobs: | |
name: code_coverage | ||
path: app/coverage.json | ||
|
||
compare-coverage: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: ${{ github.ref_name != 'dev'}} | ||
defaults: | ||
run: | ||
working-directory: ./app | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get Commit Coverage | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: code_coverage | ||
path: new_cov | ||
|
||
- name: Get Dev Coverage | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
branch: dev | ||
name: code_coverage | ||
path: dev_cov | ||
if_no_artifact_found: fail | ||
|
||
- name: Calculate Coverage | ||
id: calculate_coverage | ||
run: | | ||
new_cov=$(cat ../new_cov/coverage.json) | ||
echo "new_cov=${new_cov//'%'/'%25'}" >> $GITHUB_OUTPUT | ||
dev_cov=$(cat ../dev_cov/coverage.json) | ||
echo "dev_cov=${dev_cov//'%'/'%25'}" >> $GITHUB_OUTPUT | ||
- name: Compare Coverage | ||
id: compare_coverage | ||
run: | | ||
dev_total="${{fromJson(steps.calculate_coverage.outputs.dev_cov).totals.percent_covered}}" | ||
new_total="${{fromJson(steps.calculate_coverage.outputs.new_cov).totals.percent_covered}}" | ||
coverage_diff=$(echo "$dev_total - $new_total" | bc -l) | ||
(( $(echo "$coverage_diff > 1.0" | bc -l) )) && result=failure || result=success | ||
echo "Coverage comparison: $result" | ||
- name: Report result | ||
if: ${{steps.compare_coverage.outputs.result=='failure'}} | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
core.setFailed('Test coverage on source branch is lower than on dev branch') |
Oops, something went wrong.