Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
98c58158
Unverified
Commit
98c58158
authored
Mar 13, 2023
by
Philip Meier
Committed by
GitHub
Mar 13, 2023
Browse files
simplify ci env setup (#7411)
parent
7d2acaa7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
33 deletions
+20
-33
.github/scripts/setup-env.sh
.github/scripts/setup-env.sh
+15
-33
.github/workflows/lint.yml
.github/workflows/lint.yml
+2
-0
.github/workflows/test-linux.yml
.github/workflows/test-linux.yml
+2
-0
.github/workflows/test-macos.yml
.github/workflows/test-macos.yml
+1
-0
No files found.
.github/scripts/setup-env.sh
View file @
98c58158
...
@@ -5,7 +5,6 @@ set -euo pipefail
...
@@ -5,7 +5,6 @@ set -euo pipefail
# Prepare conda
# Prepare conda
CONDA_PATH
=
$(
which conda
)
CONDA_PATH
=
$(
which conda
)
eval
"
$(
${
CONDA_PATH
}
shell.bash hook
)
"
eval
"
$(
${
CONDA_PATH
}
shell.bash hook
)
"
conda config
--set
channel_priority strict
# Setup the OS_TYPE environment variable that should be used for conditions involving the OS below.
# Setup the OS_TYPE environment variable that should be used for conditions involving the OS below.
case
$(
uname
)
in
case
$(
uname
)
in
...
@@ -33,43 +32,15 @@ if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then
...
@@ -33,43 +32,15 @@ if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then
fi
fi
echo
'::endgroup::'
echo
'::endgroup::'
echo
'::group::Set PyTorch conda channel and wheel index'
# TODO: Can we maybe have this as environment variable in the job template? For example, `IS_RELEASE`.
if
[[
(
${
GITHUB_EVENT_NAME
}
=
'pull_request'
&&
(
${
GITHUB_BASE_REF
}
=
'release'
*
))
||
(
${
GITHUB_REF
}
=
'refs/heads/release'
*
)
]]
;
then
CHANNEL_ID
=
test
else
CHANNEL_ID
=
nightly
fi
PYTORCH_CONDA_CHANNEL
=
pytorch-
"
${
CHANNEL_ID
}
"
echo
"PYTORCH_CONDA_CHANNEL=
${
PYTORCH_CONDA_CHANNEL
}
"
case
$GPU_ARCH_TYPE
in
cpu
)
GPU_ARCH_ID
=
"cpu"
;;
cuda
)
VERSION_WITHOUT_DOT
=
$(
echo
"
${
GPU_ARCH_VERSION
}
"
|
sed
's/\.//'
)
GPU_ARCH_ID
=
"cu
${
VERSION_WITHOUT_DOT
}
"
;;
*
)
echo
"Unknown GPU_ARCH_TYPE=
${
GPU_ARCH_TYPE
}
"
exit
1
;;
esac
PYTORCH_WHEEL_INDEX
=
"https://download.pytorch.org/whl/
${
CHANNEL_ID
}
/
${
GPU_ARCH_ID
}
"
echo
"PYTORCH_WHEEL_INDEX=
${
PYTORCH_WHEEL_INDEX
}
"
echo
'::endgroup::'
echo
'::group::Create build environment'
echo
'::group::Create build environment'
# See https://github.com/pytorch/vision/issues/7296 for ffmpeg
# See https://github.com/pytorch/vision/issues/7296 for ffmpeg
conda create
\
conda create
\
--name
ci
\
--name
ci
\
--quiet
--yes
\
--quiet
--yes
\
python
=
"
${
PYTHON_VERSION
}
"
pip
\
python
=
"
${
PYTHON_VERSION
}
"
pip
\
ninja libpng jpeg
\
ninja
\
'ffmpeg<4.3'
\
libpng jpeg
\
-c
"
${
PYTORCH_CONDA_CHANNEL
}
"
\
'ffmpeg<4.3'
-c
defaults
conda activate ci
conda activate ci
pip
install
--progress-bar
=
off
--upgrade
setuptools
pip
install
--progress-bar
=
off
--upgrade
setuptools
...
@@ -81,7 +52,18 @@ fi
...
@@ -81,7 +52,18 @@ fi
echo
'::endgroup::'
echo
'::endgroup::'
echo
'::group::Install PyTorch'
echo
'::group::Install PyTorch'
pip
install
--progress-bar
=
off
--pre
torch
--index-url
=
"
${
PYTORCH_WHEEL_INDEX
}
"
# TODO: Can we maybe have this as environment variable in the job template? For example, `IS_RELEASE`.
if
[[
(
${
GITHUB_EVENT_NAME
}
=
'pull_request'
&&
(
${
GITHUB_BASE_REF
}
=
'release'
*
))
||
(
${
GITHUB_REF
}
=
'refs/heads/release'
*
)
]]
;
then
CHANNEL
=
test
else
CHANNEL
=
nightly
fi
pip
install
--progress-bar
=
off light-the-torch
ltt
install
--progress-bar
=
off
\
--pytorch-computation-backend
=
"
${
GPU_ARCH_TYPE
}${
GPU_ARCH_VERSION
}
"
\
--pytorch-channel
=
"
${
CHANNEL
}
"
\
torch
if
[[
$GPU_ARCH_TYPE
==
'cuda'
]]
;
then
if
[[
$GPU_ARCH_TYPE
==
'cuda'
]]
;
then
python3
-c
"import torch; exit(not torch.cuda.is_available())"
python3
-c
"import torch; exit(not torch.cuda.is_available())"
...
...
.github/workflows/lint.yml
View file @
98c58158
...
@@ -81,6 +81,8 @@ jobs:
...
@@ -81,6 +81,8 @@ jobs:
export PYTHON_VERSION=3.8
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
./.github/scripts/setup-env.sh
CONDA_PATH=$(which conda)
CONDA_PATH=$(which conda)
...
...
.github/workflows/test-linux.yml
View file @
98c58158
...
@@ -51,6 +51,7 @@ jobs:
...
@@ -51,6 +51,7 @@ jobs:
export PYTHON_VERSION=3.8
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
./.github/scripts/setup-env.sh
...
@@ -80,6 +81,7 @@ jobs:
...
@@ -80,6 +81,7 @@ jobs:
export PYTHON_VERSION=3.8
export PYTHON_VERSION=3.8
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/setup-env.sh
./.github/scripts/setup-env.sh
...
...
.github/workflows/test-macos.yml
View file @
98c58158
...
@@ -35,5 +35,6 @@ jobs:
...
@@ -35,5 +35,6 @@ jobs:
export PYTHON_VERSION=${{ matrix.python-version }}
export PYTHON_VERSION=${{ matrix.python-version }}
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_TYPE=cpu
export GPU_ARCH_VERSION=''
./.github/scripts/unittest.sh
./.github/scripts/unittest.sh
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment