Skip to content

[pre-commit.ci] pre-commit autoupdate #2751

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #2751

Workflow file for this run

---
name: Tests
on:
pull_request:
branches:
- 'develop'
- 'develop-1.9'
paths:
- '**'
- '!docs/**'
- '!*.rst'
- '!*.md'
- '!datacube_ows/__init__.py'
- '!.github/**'
- '.github/workflows/test.yml'
push:
branches:
- 'develop'
- 'develop-1.9'
paths:
- '**'
- '!docs/**'
- '!*.rst'
- '!*.md'
- '!datacube_ows/__init__.py'
- '!.github/**'
- '.github/workflows/test.yml'
release:
types:
- published
workflow_dispatch:
env:
DOCKER_IMAGE: ghcr.io/opendatacube/ows: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:
unit-integration-performance-tests:
timeout-minutes: 45
runs-on: ubuntu-latest
permissions:
id-token: write
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 datacube_ows)
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: Test and lint dev OWS image
run: |
mkdir artifacts
docker run -e LOCAL_UID=$(id -u $USER) -e LOCAL_GID=$(id -g $USER) -v ./:/src -v ${PWD}/artifacts:/mnt/artifacts ${{ env.DOCKER_IMAGE }} /bin/sh -c "cd /src && ./check-code.sh"
mv ./artifacts/coverage.xml ./artifacts/coverage-unit.xml
- name: Dockerized Integration Pytest
run: |
export LOCAL_UID=$(id -u $USER)
export LOCAL_GID=$(id -g $USER)
export $(grep -v '^#' .env_simple | xargs)
docker compose -f docker-compose.yaml -f docker-compose.db.yaml up --quiet-pull -d --wait
docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows /bin/sh -c "cd /src && ./check-code-all.sh"
docker compose -f docker-compose.yaml -f docker-compose.db.yaml down
- name: Upload All coverage to Codecov
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
with:
directory: ./artifacts/
fail_ci_if_error: false
use_oidc: true
- name: Install uv
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.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@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4