Convert EO datasets and products to EO3 #5226
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
paths: | |
- '**' | |
- '!docs/**' | |
- '!contrib/**' | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
DOCKER_IMAGE: ghcr.io/opendatacube/datacube-core: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: | |
main: | |
timeout-minutes: 45 | |
runs-on: ubuntu-latest | |
# Permit authenticating to PyPI/CodeCov. | |
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 examples) | |
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV | |
- name: Build Docker | |
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
with: | |
file: docker/Dockerfile | |
context: . | |
tags: ${{ env.DOCKER_IMAGE }} | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
env: | |
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} | |
- name: Verify and Run Tests | |
run: | | |
export LOCAL_UID=$(id -u $USER) | |
export LOCAL_GID=$(id -g $USER) | |
docker compose up --quiet-pull --wait -d | |
docker compose exec --user ubuntu -T core /bin/bash --login -c \ | |
"source /app/bin/activate && \ | |
rio --show-versions && \ | |
pytest -r a \ | |
--cov datacube \ | |
--cov-report=xml \ | |
--doctest-ignore-import-errors \ | |
--durations=5 \ | |
datacube \ | |
tests \ | |
integration_tests" | |
docker compose down | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0 | |
with: | |
files: ./coverage.xml | |
disable_search: true | |
fail_ci_if_error: false | |
use_oidc: true | |
- name: Install uv | |
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1 | |
- 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 # release/v1 |