Skip to content

Commit

Permalink
CI and testing infrastructure improvements. (#3896)
Browse files Browse the repository at this point in the history
* Update micromamba docker image and setup-micromamba action

* Re-lock dependencies and update pre-commit hooks

* Update to pre-commit 4.0.0

* Only try to remove pudl-dev conda env if it exists.

* Use standard 4-core GHA runner

* Re-lock conda dependencies
  • Loading branch information
zaneselvans authored Oct 7, 2024
1 parent d02333c commit b05ee89
Show file tree
Hide file tree
Showing 11 changed files with 1,060 additions and 2,533 deletions.
3 changes: 0 additions & 3 deletions .github/actionlint.yaml

This file was deleted.

12 changes: 5 additions & 7 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fetch-depth: 2

- name: Install conda-lock environment with micromamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environments/conda-lock.yml
environment-name: pudl-dev
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
fetch-depth: 2

- name: Install conda-lock environment with micromamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environments/conda-lock.yml
environment-name: pudl-dev
Expand Down Expand Up @@ -120,9 +120,7 @@ jobs:
path: .coverage

ci-integration:
runs-on:
group: large-runner-group
labels: ubuntu-latest-4core
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.merge_group
permissions:
contents: read
Expand All @@ -139,7 +137,7 @@ jobs:
fetch-depth: 2

- name: Install Conda environment using mamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environments/conda-lock.yml
environment-name: pudl-dev
Expand Down Expand Up @@ -224,7 +222,7 @@ jobs:
run: |
find coverage -type f
- name: Install Micromamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
environment-name: coverage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-conda-lockfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
with:
token: ${{ secrets.PUDL_BOT_PAT }}
- name: Install Micromamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-name: conda-lock
create-args: >-
python=3.12
conda-lock>=2.5.2
conda-lock>=2.5.7
prettier
- name: Run conda-lock to recreate lockfile from scratch
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zenodo-cache-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Conda environment using mamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environments/conda-lock.yml
environment-name: pudl-dev
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:

# Other file formatting, plus common Git mistakes & text file standardization:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files # Don't accidentally commit giant files.
- id: check-merge-conflict # Watch for lingering merge markers.
Expand All @@ -29,7 +29,7 @@ repos:
# Formatters: hooks that re-write Python & documentation files
####################################################################################
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down Expand Up @@ -60,7 +60,7 @@ repos:

# Check Github Actions
- repo: https://github.com/rhysd/actionlint
rev: v1.7.2
rev: v1.7.3
hooks:
- id: actionlint

Expand All @@ -71,7 +71,7 @@ repos:
hooks:
- id: nb-output-clear
name: nb-output-clear
stages: [commit]
stages: [pre-commit]
language: system
verbose: false
files: ".*\\.ipynb"
Expand All @@ -81,7 +81,7 @@ repos:

- id: unit-tests
name: unit-tests
stages: [commit]
stages: [pre-commit]
language: system
verbose: false
pass_filenames: false
Expand All @@ -90,7 +90,7 @@ repos:

- id: conda-lock
name: conda-lock
stages: [commit]
stages: [pre-commit]
language: system
verbose: false
files: "pyproject.toml"
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ conda-lock.yml: pyproject.toml
.PHONY: pudl-dev
pudl-dev:
${mamba} run --name base ${mamba} install --quiet --yes "conda-lock>=2.5.7"
${mamba} run --name base ${mamba} env remove --yes --name pudl-dev
# Only attempt to remove the pudl-dev environment if it already exists.
if ${mamba} env list | grep -q pudl-dev; then \
${mamba} env remove --quiet --yes --name pudl-dev; \
fi
${mamba} run --name base conda-lock install \
--name pudl-dev \
--${mamba} \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mambaorg/micromamba:1.5.9
FROM mambaorg/micromamba:1.5.10

ENV PGDATA=${CONTAINER_HOME}/pgdata

Check warning on line 3 in docker/Dockerfile

View workflow job for this annotation

GitHub Actions / Test building the PUDL ETL Docker image

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CONTAINER_HOME' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 3 in docker/Dockerfile

View workflow job for this annotation

GitHub Actions / Build Docker image, push to Docker Hub and deploy to Google Batch

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CONTAINER_HOME' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Expand Down
Loading

0 comments on commit b05ee89

Please sign in to comment.