Skip to content

Commit

Permalink
Merge pull request #131 from SnowEx/master
Browse files Browse the repository at this point in the history
Catch up with master
  • Loading branch information
jomey authored Sep 18, 2024
2 parents 59d69d5 + 76d8c92 commit 0a885b7
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 92 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/setup-python@v5.1.1
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.10"
Expand All @@ -49,7 +49,7 @@ jobs:
ls -ltrh
ls -ltrh dist
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
uses: pypa/gh-action-pypi-publish@v1.10.1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
Expand Down Expand Up @@ -98,5 +98,5 @@ jobs:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.9.0
- uses: pypa/gh-action-pypi-publish@v1.10.1
if: startsWith(github.ref, 'refs/tags')
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Code Quality
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
run:
runs-on: ubuntu-latest
services:
postgis:
image: kartoza/postgis:14-3.2
env:
POSTGRES_PASSWORD: db_builder
POSTGRES_USER: builder
POSTGRES_DB: test
TZ: 'UTC'
PGTZ: 'UTC'
POSTGIS_GDAL_ENABLED_DRIVERS: 'ENABLE_ALL'
POSTGIS_ENABLE_OUTDB_RASTERS: 'True'
ports:
- 5432:5432
volumes:
- /home/runner/work/:/home/runner/work/
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: python3 -m pip install -e ".[dev]"
- name: Run tests and collect coverage
run: pytest --cov snowexsql --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43 changes: 3 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: snowexsql testing
name: Pytest

# Controls when the action will run.
on:
Expand Down Expand Up @@ -36,54 +36,17 @@ jobs:
- /home/runner/work/:/home/runner/work/

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y postgis gdal-bin
python3 -m pip install --upgrade pip
python3 -m pip install pytest coverage
python3 -m pip install -e ".[dev]"
- name: Test with pytest
run: |
pytest -s
# Run coverage only once
- if: ${{ matrix.python-version == '3.9'}}
name: Get Coverage for badge
run: |
# Run coverage save the results
coverage run --source snowexsql -m pytest
SUMMARY=`coverage report -m | grep TOTAL`
# Save results as ENV var
COVERAGE=$(python -c "print('$SUMMARY'.split(' ')[-1])")
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
# var REF = 'refs/pull/27/merge.json';
REF=${{ github.ref }}
# console.log('github.ref: ' + REF);
echo "github.ref: $REF"
# var PATHS = REF.split('/');
IFS='/' read -ra PATHS <<< "$REF"
# var BRANCH_NAME = PATHS[1] + PATHS[2];
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
# console.log(BRANCH_NAME); // 'pull_27'
echo $BRANCH_NAME
# process.env.BRANCH = 'pull_27';
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- if: ${{ matrix.python-version == '3.9'}}
name: Create the Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 2034019acc40a963bd02d2fcbb31c5a9
filename: snowexsql__${{ env.BRANCH }}.json
label: Coverage
message: ${{ env.COVERAGE }}
color: green
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Welcome to snowexsql
:target: https://pypi.org/project/snowexsql/
:alt: Code Coverage

.. image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/micahjohnson150/2034019acc40a963bd02d2fcbb31c5a9/raw/snowexsql__heads_master.json
:alt: Code Coverage
.. image:: https://codecov.io/gh/SnowEx/snowexsql/graph/badge.svg?token=B27OKGBOTR
:target: https://codecov.io/gh/SnowEx/snowexsql

About
-----
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ dependencies = [

[project.optional-dependencies]
dev = [
"pip==23.3",
"coverage==5.5",
"pytest==6.2.4",
"pytest-cov==2.12.1",
"pytest",
"pytest-cov",
"sphinx-autobuild<=2024.5",
]
docs = [
Expand Down
27 changes: 0 additions & 27 deletions snowexsql/analysis.py

This file was deleted.

15 changes: 0 additions & 15 deletions tests/test_analysis.py

This file was deleted.

0 comments on commit 0a885b7

Please sign in to comment.