Skip to content

Commit

Permalink
Merge branch 'main' into ingest-2024
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTiemannOSC authored May 21, 2024
2 parents f3ea3e3 + c1649c2 commit ccdce85
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ jobs:
# Only updates file if it has changed
selective_file_copy() {
# Receives a single file path as argument
SHA_SRC=$(sha1sum "$DEVOPS_DIR"/"$1" | awk '{print $1}')
SHA_DST=$(sha1sum "$1" 2>/dev/null | awk '{print $1}' || :)
if [ "$SHA_SRC" != "$SHA_DST" ]; then
# SHA_SRC=$(sha1sum "$DEVOPS_DIR/$1" | awk '{print $1}')
# SHA_DST=$(sha1sum "$1" 2>/dev/null | awk '{print $1}' || :)
# if [ "$SHA_SRC" != "$SHA_DST" ]; then
if ! (cmp "$DEVOPS_DIR/$1" "$1"); then
echo "Copying: $1"
cp "$DEVOPS_DIR/$1" "$1"
git add "$1"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/notebooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:
pip install .
pip install pytest nbmake
- name: "Test notebooks: pytest --nbmake"
- name: "Testing notebooks"
run: |
echo "testing notebooks"
echo "Testing notebooks using: pytest --nbmake -- **/test_*.ipynb"
pytest --nbmake -- **/test_*.ipynb
- name: Upload logs as artefacts
Expand Down
16 changes: 9 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ repos:
- id: markdownlint
args: ["--fix"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
- id: black-jupyter
# - repo: https://github.com/psf/black-pre-commit-mirror
# rev: 24.4.2
# hooks:
# - id: black
# - id: black-jupyter

# - repo: https://github.com/tomcatling/black-nb
# rev: '0.7'
Expand Down Expand Up @@ -113,6 +113,8 @@ repos:
rev: "7.0.0"
hooks:
- id: flake8
additional_dependencies:
- pep8-naming

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
Expand All @@ -125,11 +127,11 @@ repos:
hooks:
- id: mypy
verbose: true
args: [--show-error-codes]
args: ["--show-error-codes", "--install-types", "--non-interactive"]
additional_dependencies: ["pytest", "types-requests"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
rev: v0.4.4
hooks:
- id: ruff
files: ^(scripts|tests|custom_components)/.+\.py$
Expand Down
16 changes: 13 additions & 3 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SOURCE_FILE="bootstrap.yaml"
WGET_URL="https://raw.githubusercontent.com/os-climate/devops-toolkit/main/.github/workflows/$SOURCE_FILE"
AUTOMATION_BRANCH="update-devops-tooling"
DEVOPS_DIR=".devops"
FETCH_MODE="wget"

### Checks ###

Expand All @@ -21,14 +22,17 @@ fi

WGET_CMD=$(which wget)
if [ ! -x "$WGET_CMD" ]; then
echo "WGET command was NOT found in PATH"; exit 1
echo "WGET command was NOT found in PATH; using CURL"
FETCH_MODE="curl"
fi

MKTEMP_CMD=$(which mktemp)
if [ ! -x "$MKTEMP_CMD" ]; then
echo "MKTEMP command was NOT found in PATH"; exit 1
fi



SHELL_SCRIPT=$(mktemp -t script-XXXXXXXX.sh)

### Functions ###
Expand Down Expand Up @@ -95,9 +99,15 @@ if [ -f "$SOURCE_FILE" ]; then
echo "Removing existing copy of: $SOURCE_FILE"
rm "$SOURCE_FILE"
fi
echo "Pulling latest DevOps bootstrap workflow from:"
echo "Pulling latest DevOps bootstrap YAML from:"
echo " $WGET_URL"
"$WGET_CMD" -q "$WGET_URL"
if [ "$FETCH_MODE" = "wget" ]; then
"$WGET_CMD" -q "$WGET_URL" > /dev/null 2>&1
fi
if [ ! -f "$SOURCE_FILE" ]; then
echo "Attempting to retrieve YAML file with CURL"
curl "$WGET_URL" > "$SOURCE_FILE"
fi

# The section below extracts shell code from the YAML file
echo "Extracting shell code from: $SOURCE_FILE"
Expand Down

0 comments on commit ccdce85

Please sign in to comment.