Skip to content

Enable some more Ruff rules #2621

Enable some more Ruff rules

Enable some more Ruff rules #2621

Workflow file for this run

---
name: Tests
on:
pull_request:
paths:
- '**'
push:
branches:
- develop
- integrate_1.9
paths:
- '**'
release:
types:
- published
workflow_dispatch:
env:
DOCKER_IMAGE: ghcr.io/opendatacube/explorer:tests
permissions: {}
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
integration-tests:
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
# Tests take a long time, so split them over multiple CI jobs.
# Ignoring tests inverts the logic which makes it harder to understand,
# but ignoring tests ensures that any added test will be run by at least
# one CI job, even if the test was added outside the current structure.
ignored-tests:
- "test_{[a-oq-z],pages}" # Tests test_page_loads
- "test_{[a-rt-z],s2,stores,su}" # Tests test_stac
- "test_{[a-rt-z],s2,stac,stores}" # Tests test_summarise_data
- "test_{page_,stac,summarise}" # Tests remaining tests
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Get Git commit timestamps
run: |
TIMESTAMP=$(git log -1 --pretty=%ct pyproject.toml uv.lock cubedash)
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
- name: Build Docker
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: Dockerfile
context: .
build-args: |
ENVIRONMENT=test
tags: ${{ env.DOCKER_IMAGE }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Run tests
shell: bash
run: |
files=$(ls integration_tests/${{ matrix.ignored-tests }}*.py)
[ $? = 0 ] || (echo "Listing tests failed" && exit 1)
for f in $files; do
ig="$ig --ignore=$f";
done
export LOCAL_UID=$(id -u $USER)
export LOCAL_GID=$(id -g $USER)
make up-d
make PYTEST_PARAMS="$ig" test-docker
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
files: ./coverage.xml
disable_search: true
fail_ci_if_error: false
use_oidc: true
test-package:
timeout-minutes: 15
runs-on: ubuntu-latest
needs: integration-tests
permissions:
id-token: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
- name: Build Packages
run: |
uv build
uv tool run twine check --strict dist/*
# Uses to OIDC identification between GitHub and PyPI
- name: Upload package to PyPI on GitHub Release
if: "github.repository_owner == 'opendatacube' && github.event.action == 'published'"
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0