Skip to content

Add eslint and typescript checking 2 #40

Add eslint and typescript checking 2

Add eslint and typescript checking 2 #40

Workflow file for this run

name: CI
on:
# push: -- just run on PRs for now
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:13-3.0
env:
POSTGRES_PASSWORD: postgis
POSTGRES_DB: arches_rdm_example_project
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Install Java, GDAL, and other system dependencies
run: |
sudo apt update
sudo apt-get install libxml2-dev libpq-dev openjdk-8-jdk libgdal-dev libxslt-dev
echo Postgres and ES dependencies installed
- name: Install python packages
run: |
python -m pip install --upgrade pip
pip install .
pip install -r arches_rdm_example_project/install/requirements.txt
pip install -r arches_rdm_example_project/install/requirements_dev.txt
echo Python packages installed
- uses: ankane/setup-elasticsearch@v1
with:
elasticsearch-version: 8
- name: Check for missing migrations
run: |
python manage.py makemigrations --check
- name: Run Arches unit tests
run: |
python -W default::DeprecationWarning -m coverage run manage.py test tests --pattern="*.py" --settings="tests.test_settings"
- name: Report coverage
run: |
coverage report
- name: Show contents of .coverage file
run: |
git fetch origin main:main
coverage_file_contents=$(git show main:.coverage)
echo "$coverage_file_contents" > .coverage_contents
cat .coverage_contents
- name: Retrieve baseline coverage
run: |
git fetch origin main:main
baseline_coverage=$(git show main:.coverage | coverage report -m | sed -n '/TOTAL/ s/.*\s\([0-9.]*%\).*/\1/p' | sed 's/%//')
echo "Baseline Coverage: $baseline_coverage"
echo "$baseline_coverage" > .coverage_baseline
- name: Compare coverage with baseline
run: |
current_coverage=$(coverage report -m | sed -n '/TOTAL/ s/.*\s\([0-9.]*%\).*/\1/p' | sed 's/%//')
baseline_coverage=$(cat .coverage_baseline)
echo "FOOFOOFOO from $baseline_coverage% to $current_coverage%"
if (( current_coverage < baseline_coverage )); then
echo "Coverage decreased from $baseline_coverage% to $current_coverage%"
exit 1
fi