Factor out common environment setup GHA steps
This commit is contained in:
parent
aaf19fbf93
commit
d0b6cfeca4
3 changed files with 30 additions and 37 deletions
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
|
|
@ -258,24 +258,7 @@ jobs:
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
|
source Tools/CI-linux-environment.sh
|
||||||
# Repeat language specific environment setup
|
|
||||||
case "$SWIGLANG" in
|
|
||||||
javascript)
|
|
||||||
case "$ENGINE" in
|
|
||||||
node)
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
||||||
nvm use ${VER}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
|
|
||||||
ruby)
|
|
||||||
source $HOME/.rvm/scripts/rvm
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -n '${{ matrix.CONFIGOPTS }}'; then
|
if test -n '${{ matrix.CONFIGOPTS }}'; then
|
||||||
CONFIGOPTS=${{ matrix.CONFIGOPTS }}
|
CONFIGOPTS=${{ matrix.CONFIGOPTS }}
|
||||||
|
|
@ -298,24 +281,7 @@ jobs:
|
||||||
working-directory: build/build
|
working-directory: build/build
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
|
source Tools/CI-linux-environment.sh
|
||||||
# Repeat language specific environment setup
|
|
||||||
case "$SWIGLANG" in
|
|
||||||
javascript)
|
|
||||||
case "$ENGINE" in
|
|
||||||
node)
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
||||||
nvm use ${VER}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
|
|
||||||
ruby)
|
|
||||||
source $HOME/.rvm/scripts/rvm
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -n "$CPP11"; then export CPPSTD=c++11; fi
|
if test -n "$CPP11"; then export CPPSTD=c++11; fi
|
||||||
if test -n "$CPP14"; then export CPPSTD=c++14; fi
|
if test -n "$CPP14"; then export CPPSTD=c++14; fi
|
||||||
|
|
|
||||||
27
Tools/CI-linux-environment.sh
Normal file
27
Tools/CI-linux-environment.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Expected to be called from elsewhere with same variables set as CI-linux-install.sh
|
||||||
|
# e.g. RETRY=travis-retry SWIGLANG=python
|
||||||
|
# Sets up environment for using various target languages
|
||||||
|
# For Github Actions where the environment is not preserved between steps
|
||||||
|
set -e # exit on failure (same as -o errexit)
|
||||||
|
|
||||||
|
case "$SWIGLANG" in
|
||||||
|
"javascript")
|
||||||
|
case "$ENGINE" in
|
||||||
|
"node")
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use ${VER}
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
"ruby")
|
||||||
|
if ! command -v rvm; then
|
||||||
|
set +x
|
||||||
|
source $HOME/.rvm/scripts/rvm
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# expected to be called from elsewhere with certain variables set
|
# Expected to be called from elsewhere with certain variables set
|
||||||
# e.g. RETRY=travis-retry SWIGLANG=python GCC=7
|
# e.g. RETRY=travis-retry SWIGLANG=python GCC=7
|
||||||
set -e # exit on failure (same as -o errexit)
|
set -e # exit on failure (same as -o errexit)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue