Skip to content

Update dependencies #308

Update dependencies

Update dependencies #308

Workflow file for this run

name: Test and Push
on:
push:
branches:
- main
paths:
- 'datacube_alchemist/**'
- 'tests/**'
- '.github/workflows/test-and-push.yml'
- '.pre-commit-config.yaml'
- 'Dockerfile'
- 'docker-compose.yml'
- 'pyproject.toml'
- 'requirements.in'
- 'requirements.txt'
- 'setup.cfg'
- 'setup.py'
pull_request:
branches:
- main
paths:
- 'datacube_alchemist/**'
- 'tests/**'
- '.github/workflows/test-and-push.yml'
- '.pre-commit-config.yaml'
- 'Dockerfile'
- 'docker-compose.yml'
- 'pyproject.toml'
- 'requirements.in'
- 'requirements.txt'
- 'setup.cfg'
- 'setup.py'
release:
types: [created, edited]
env:
IMAGE_NAME: opendatacube/datacube-alchemist
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:
test:
timeout-minutes: 35
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
with:
args: 'format --check --diff'
- name: Build the docker container
run: |
docker compose build
- name: Bring up the docker container
run: |
docker compose up -d --wait --quiet-pull
- name: Run tests
run: |
docker compose exec -T alchemist /bin/bash --login -c \
"datacube system init && \
pytest --cov=./datacube_alchemist --cov-report=xml tests"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
use_oidc: true
fail_ci_if_error: false
push:
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
needs: test
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
# Build and Push for main branch
# Docker
- name: Get git commit hash for push to main
if: github.event_name != 'release'
run: |
git fetch --all --tags
echo "GITHASH=$(git describe --tags)" >> $GITHUB_ENV
- name: Build and Push unstable Docker Image for push to main
uses: whoan/docker-build-with-cache-action@d8d3ad518e7ac382b880720d0751815e656fe032 # v8.1.0
if: github.event_name != 'release'
with:
image_name: ${{ env.IMAGE_NAME }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
image_tag: latest,${{ env.GITHASH }}
# Build and Push for release
# Python
- name: Build the package
if: github.event_name == 'release'
run: |
pip install build
python -m build
# Docker
- name: Get tag for this build if it exists
if: github.event_name == 'release'
run: |
echo "RELEASE=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_ENV
- name: Build and Push semver tagged Docker Image for Release
uses: whoan/docker-build-with-cache-action@d8d3ad518e7ac382b880720d0751815e656fe032 # v8.1.0
if: github.event_name == 'release'
with:
image_name: ${{ env.IMAGE_NAME }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
image_tag: ${{ env.RELEASE }}