Skip to content

Commit

Permalink
ci: fix path for mac realpath (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
purarue authored Jun 7, 2024
1 parent fbf0e6c commit e723be8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
exclude:
[
{ platform: macos-latest, python-version: "3.8" },
{ platform: macos-latest, python-version: "3.9" },
{ platform: macos-latest, python-version: "3.10" },
{ platform: macos-latest, python-version: "3.11" },
Expand Down
17 changes: 14 additions & 3 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,25 @@ required_commands() {
havecmd git || return $?
}

ci_realpath() {
if ci; then
if [[ "$OSTYPE" == "darwin"* ]]; then
# need to use g-prefixed things on CI
grealpath "$@"
return $?
fi
fi
realpath "$@"
}

setup_fork() {
local FORK_ABBREV UPSTREAM_URL UPSTREAM_DIR
echo 'Setting up upstream fork...' | maybe_boxes

FORK_ABBREV="${HPI_UPSTREAM_FOLDER_NAME:-HPI-karlicoss}"
UPSTREAM_URL='https://github.com/karlicoss/HPI'

UPSTREAM_DIR="$(realpath "../${FORK_ABBREV}")"
UPSTREAM_DIR="$(ci_realpath "../${FORK_ABBREV}")"

# clone my fork one level up from here if it does not exist
if [[ ! -e "${UPSTREAM_DIR}" ]]; then
Expand Down Expand Up @@ -172,7 +183,7 @@ module_dependencies() {
}

ci_config() {
CONF="$(realpath "${BASE_DIR}/tests/my")" || return $?
CONF="$(ci_realpath "${BASE_DIR}/tests/my")" || return $?
MY_CONFIG="${CONF}" python3 -m my.core config check 1>&2 || return $?
echo "${CONF}"
}
Expand Down Expand Up @@ -212,7 +223,7 @@ main() {
install_dependencies || prompt_if_fails || return $?
required_commands || prompt_if_fails || return $?
# use realpath to make sure BASE_DIR is set properly
BASE_DIR="$(realpath "${BASE_DIR}")" || return $?
BASE_DIR="$(ci_realpath "${BASE_DIR}")" || return $?
(setup_fork) || prompt_if_fails || return $?
module_dependencies || prompt_if_fails || return $?
ci_run || return $?
Expand Down
1 change: 0 additions & 1 deletion tests/my/my/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Config file used for testing in CI; so that config is defined
"""


import tempfile
from pathlib import Path
from typing import Optional, Sequence, Callable
Expand Down

0 comments on commit e723be8

Please sign in to comment.