@@ -6,30 +6,43 @@ cd $ROOT
66
77CONTAINER_TAG=` cat ${ROOT} /bin/.container-tag`
88
9+ if [ -v GITHUB_ACTIONS ]; then
10+ echo " ACTIONS"
11+ CONTAINER_PATH=${ROOT} /.singularity/image.sif
12+ HOME_PATH=${GITHUB_WORKSPACE}
13+ HOME_OPT=" --home ${ROOT} /.home"
14+ SINGULARITY_CACHE=--disable-cache
15+ else
16+ CONTAINER_PATH=${ROOT} /.singularity/image-$CONTAINER_TAG .sif
17+ HOME_PATH=${HOME}
18+ HOME_OPT=" --bind ${ROOT} /.home:${HOME_PATH} "
19+ SINGULARITY_CACHE=
20+ fi
21+
922if [ ! -d $ROOT /.home ]; then
1023 mkdir $ROOT /.home
1124fi
1225
13- if [ ! -f $ROOT /.singularity/image- $CONTAINER_TAG .sif ]; then
26+ if [ ! -f ${CONTAINER_PATH} ]; then
1427 echo " Fetching container..."
1528 if [ ! -d " ${ROOT} /.singularity" ]; then
1629 mkdir -p ${ROOT} /.singularity
1730 fi
18- singularity pull --disable-cache ${ROOT} /.singularity/image- $CONTAINER_TAG .sif oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG
31+ singularity pull ${SINGULARITY_CACHE} ${CONTAINER_PATH} oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG
1932fi
2033
2134if [ ! -f $ROOT /.bundle/config ]; then
2235 OLDDIR=$PWD
2336 cd $ROOT
24- singularity run --home ${ROOT} /.home .singularity/image- $CONTAINER_TAG .sif bundle config set --local path ${ROOT} /.home/.gems
25- singularity run --home ${ROOT} /.home .singularity/image- $CONTAINER_TAG .sif bundle config set --local cache_path ${ROOT} /.home/.cache
37+ singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle config set --local path ${ROOT} /.home/.gems
38+ singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle config set --local cache_path ${ROOT} /.home/.cache
2639 cd $OLDDIR
2740fi
2841
2942if [ ! -d $ROOT /.home/.gems ]; then
3043 OLDDIR=$PWD
3144 cd $ROOT
32- singularity run --home ${ROOT} /.home .singularity/image- $CONTAINER_TAG .sif bundle install
45+ singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle install
3346 cd $OLDDIR
3447fi
3548
3952
4053if [[ ! -z " $DEVELOPMENT " && $DEVELOPMENT -eq 1 ]]; then
4154 if [ ! -d " ${ROOT} /.home/.yard/gem_index" ]; then
42- singularity run --home ${ROOT} /.home .singularity/image- $CONTAINER_TAG .sif bundle exec --gemfile ${ROOT} /Gemfile yard config --gem-install-yri
43- singularity run --home ${ROOT} /.home .singularity/image- $CONTAINER_TAG .sif bundle exec --gemfile ${ROOT} /Gemfile yard gems
55+ singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec --gemfile ${ROOT} /Gemfile yard config --gem-install-yri
56+ singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec --gemfile ${ROOT} /Gemfile yard gems
4457 touch ${ROOT} /.stamps/dev_gems
4558 fi
4659fi
@@ -64,11 +77,11 @@ if [[ ! -z "$VSCODE" && $VSCODE -eq 1 ]]; then
6477fi
6578
6679if [ ! -d ${ROOT} /node_modules ]; then
67- singularity run --home ${PWD} /.home .singularity/image- $CONTAINER_TAG .sif npm i
80+ singularity run ${HOME_OPT} ${CONTAINER_PATH} npm i
6881fi
6982
70- BUNDLE=" singularity run --home ${PWD} /.home .singularity/image- $CONTAINER_TAG .sif bundle"
71- RUBY=" singularity run --home ${PWD} /.home .singularity/image- $CONTAINER_TAG .sif bundle exec ruby"
72- RAKE=" singularity run --home ${PWD} /.home .singularity/image- $CONTAINER_TAG .sif bundle exec rake"
73- NPM=" singularity run --home ${PWD} /.home .singularity/image- $CONTAINER_TAG .sif npm"
74- NPX=" singularity run --home ${PWD} /.home .singularity/image- $CONTAINER_TAG .sif npx"
83+ BUNDLE=" singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle"
84+ RUBY=" singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec ruby"
85+ RAKE=" singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec rake"
86+ NPM=" singularity run ${HOME_OPT} ${CONTAINER_PATH} npm"
87+ NPX=" singularity run ${HOME_OPT} ${CONTAINER_PATH} npx"
0 commit comments