Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix path for mac realpath #54

Merged
merged 3 commits into from
Jun 7, 2024
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
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
Loading