Skip to content

Commit 0c3d161

Browse files
committed
Merge branch 'v1.0.1'
2 parents e3257b1 + 0407094 commit 0c3d161

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

.github/workflows/run_tests.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
push:
88
branches: [ "main" ]
99
pull_request:
10-
branches: [ "main" ]
1110

1211
permissions:
1312
contents: read
@@ -23,19 +22,34 @@ jobs:
2322
uses: actions/setup-python@v3
2423
with:
2524
python-version: "3.10"
25+
26+
- name: Install zsh
27+
run: sudo apt-get update; sudo apt-get install -y zsh
28+
2629
- name: Install dependencies
2730
run: |
2831
python3.10 -m venv .venv --prompt="venv-cli"
2932
. .venv/bin/activate
3033
python -m pip install --require-virtualenv --upgrade pip
3134
python -m pip install --require-virtualenv -r dev-requirements.txt
35+
3236
- name: Check linting/formatting
3337
run: |
3438
. .venv/bin/activate
3539
python -m isort --check .
3640
python -m black --config pyproject.toml --check .
3741
python -m mypy --config-file pyproject.toml
38-
- name: Test with pytest
42+
43+
- name: Test with pytest (bash)
44+
run: |
45+
export SHELL="/usr/bin/bash"
46+
. .venv/bin/activate
47+
python -m pytest -n auto .
48+
shell: /usr/bin/bash -e {0}
49+
50+
- name: Test with pytest (zsh)
3951
run: |
52+
export SHELL="/usr/bin/zsh"
4053
. .venv/bin/activate
4154
python -m pytest -n auto .
55+
shell: /usr/bin/zsh -e {0}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
## [v1.0.1](https://github.com/SallingGroup-AI-and-ML/venv-cli/releases/tag/v1.0.1) (2023-08-02)
4+
5+
* Added support for `zsh` shell.
6+
* Added `CHANGELOG.md`
7+
8+
## [1.0.0](https://github.com/SallingGroup-AI-and-ML/venv-cli/releases/tag/v1.0.0) (2023-07-13)
9+
10+
This is the first release of the `venv-cli` tool.

src/venv-cli/venv.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ _green="\033[32m"
55
_yellow="\033[01;33m"
66
_red="\033[31m"
77

8-
_version="1.0.0"
8+
_version="v1.0.1"
99

1010
venv::_version() {
1111
echo "venv-cli ${_version}"
@@ -26,7 +26,7 @@ venv::raise() {
2626
}
2727

2828
venv::_check_if_help_requested() {
29-
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
29+
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
3030
return 0
3131
fi
3232
return 1
@@ -153,7 +153,7 @@ venv::install() {
153153
fi
154154

155155
local requirements_file
156-
if [ -z "$1" ] || [ "$1" == "--skip-lock" ]; then
156+
if [ -z "$1" ] || [ "$1" = "--skip-lock" ]; then
157157
# If no argument passed
158158
requirements_file="requirements.txt"
159159

@@ -169,16 +169,18 @@ venv::install() {
169169
fi
170170

171171
local skip_lock=false
172-
if [ "$1" == "--skip-lock" ]; then
172+
if [ "$1" = "--skip-lock" ]; then
173173
skip_lock=true
174174
shift
175175
fi
176176

177177
venv::color_echo "${_green}" "Installing requirements from ${requirements_file}"
178-
pip install --require-virtualenv -r "${requirements_file}" "$@"
178+
if ! pip install --require-virtualenv -r "${requirements_file}" "$@"; then
179+
return 1
180+
fi
179181

180182
local lock_file="${requirements_file/.txt/.lock}" # Replace ".txt" with ".lock"
181-
if "${skip_lock}" || [ "${requirements_file}" == "${lock_file}" ]; then
183+
if "${skip_lock}" || [ "${requirements_file}" = "${lock_file}" ]; then
182184
venv::color_echo "${_yellow}" "Skipping locking packages to ${lock_file}"
183185
return 0
184186
fi
@@ -215,7 +217,7 @@ venv::lock() {
215217
if [ -z "$1" ]; then
216218
lock_file="requirements.lock"
217219

218-
elif [[ "$1" == *"."* ]]; then
220+
elif [[ "$1" = *"."* ]]; then
219221
if venv::_check_lock_requirements_file "$1"; then
220222
lock_file="$1"
221223
shift

tests/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import subprocess
23
import sys
34
from pathlib import Path
@@ -8,7 +9,7 @@
89

910

1011
def _command_setup(venv_cli_path: Path, activate: bool = False) -> list[str]:
11-
bash = ["/bin/bash", "-c"]
12+
bash = [os.environ["SHELL"], "-c"]
1213
source_command = f". {venv_cli_path}"
1314

1415
additional_commands: list[str] = []

0 commit comments

Comments
 (0)