Skip to content

Run Code Checks

Run Code Checks #889

Workflow file for this run

name: Run Code Checks
on:
push:
branches-ignore: [develop]
paths:
- '**'
- '!docker/**'
- '!.github/workflows/statistician-*'
- '!notebooks/**'
- '!docs/**'
- '!k8s/**'
- '!README.md'
tags:
- '**'
workflow_run:
workflows: ["Create a new tag"]
types:
- completed
permissions:
contents: read
packages: read
jobs:
build-wheels:
if: |
github.event_name == 'push' || (github.ref == 'refs/heads/develop'
&& github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
id: wheels_cache
with:
path: ./wheels
key: wheels-${{ github.sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade \
setuptools \
setuptools-scm
python -m pip install --upgrade \
toml \
wheel \
twine \
packaging
python -m pip freeze
- name: Build Clean Packages
run: |
mkdir -p ./wheels/clean
python setup.py bdist_wheel --dist-dir ./wheels/clean/
python setup.py sdist --dist-dir ./wheels/clean/
find ./wheels/clean -type f
test-wheels:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
services:
postgres:
image: postgis/postgis:10-2.5
env:
POSTGRES_DB: opendatacube
POSTGRES_PASSWORD: opendatacubepassword
POSTGRES_USER: opendatacube
needs:
- build-wheels
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
shell: bash
run: |
apt update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
--fix-missing --no-install-recommends \
nodejs \
zstd
python -m pip install --upgrade --no-cache pip
pip install --upgrade --no-cache -r \
tests/requirements.txt
pip freeze
- name: Get Wheels from Cache
uses: actions/cache@v4
id: wheels_cache
with:
path: ./wheels
key: wheels-${{ github.sha }}
- name: Install wheels for testing
shell: bash
run: |
which python
which datacube
ls -lh wheels/clean
pip install --no-deps --no-cache wheels/clean/*whl
pip check || true
pip show odc-stats
which odc-stats | xargs ls -alt
odc-stats --version
- name: Run Tests
shell: bash
run: |
echo "Init DB"
./tests/init_db.sh
echo "Running unit tests"
pytest --cov=. \
--cov-report=html \
--cov-report=xml:coverage.xml \
--timeout=30 tests
echo "Running integration tests"
./tests/integration_test.sh
env:
DB_HOSTNAME: postgres
DB_USERNAME: opendatacube
DB_PASSWORD: opendatacubepassword
DB_DATABASE: opendatacube
AWS_NO_SIGN_REQUEST: true
AWS_DEFAULT_REGION: ap-southeast-2
AWS_REGION: ap-southeast-2
STAC_API_URL: https://earth-search.aws.element84.com/v0/
GDAL_HTTP_MAX_RETRY: 5
- name: Upload Coverage
if: |
github.repository == 'opendatacube/odc-stats'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: false