Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 11 additions & 44 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,63 +12,30 @@ on:
- main

jobs:
run_tests:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
python-version:
- "3.12"

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: goats

- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
auto-update-conda: true
enable-cache: true
cache-dependency-glob: uv.lock
python-version: ${{ matrix.python-version }}
miniforge-version: latest
activate-environment: goats-env
channels: conda-forge, http://astroconda.gemini.edu/public
channel-priority: strict
auto-activate-base: false
conda-remove-defaults: "true"

- name: Get date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash

- name: Cache conda env
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
hashFiles('goats/ci_environment.yaml', 'goats/pyproject.toml') }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if goats/ci_environment.yaml has not changed.
CACHE_NUMBER: 0
id: cache

- name: Update environment
run: |
conda env update -n goats-env -f goats/ci_environment.yaml
cd goats
uv pip install -v -e . --group dev
if: steps.cache.outputs.cache-hit != 'true'
- name: Install the project
run: uv sync --locked --dev --group github

- name: Run tests and calculate coverage
run: |
cd goats
pytest -r A -v -n auto --cov=src --cov-report=xml --cov=tests --cov-branch
uv run pytest -r A -v -n auto --cov=src --cov-report=xml --cov=tests --cov-branch

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
Expand Down
1 change: 1 addition & 0 deletions docs/changes/322.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved build time for unit tests on GitHub by using `uv`: Removed the dependency for `conda` and install `dragons` and `fits_storage` from their respective repos. This removes the need for `conda` and the bloated install.
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ docs = [
"sphinx-rtd-theme>=3.0.2",
"sphinxcontrib-video>=0.4.1",
]
github = [
"dragons",
"fits-storage",
]
notebook = ["ipykernel>=6.29.5"]

[tool.setuptools.packages.find]
Expand Down Expand Up @@ -143,3 +147,7 @@ skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"

[tool.uv.sources]
dragons = { git = "https://github.com/GeminiDRSoftware/DRAGONS", tag = "v4.0.0" }
fits-storage = { git = "https://github.com/GeminiDRSoftware/FitsStorage", tag = "v3.4.0" }
Loading