@@ -12,12 +12,23 @@ jobs:
1212 sofa_branch : [master, v21.06]
1313 env :
1414 SOFA_ROOT : /opt/sofa
15- SYSTEM : Linux
15+ SOFA_OS : Linux
1616
1717 steps :
1818 - name : Checkout source code
1919 uses : actions/checkout@v2
2020
21+ - name : Set env vars
22+ run : |
23+ if [ -n "$GITHUB_BASE_REF" ]; then
24+ GIT_BRANCH="$GITHUB_BASE_REF"
25+ else
26+ GIT_BRANCH="${GITHUB_REF#refs/heads/}"
27+ fi
28+ echo "GIT_BRANCH = $GIT_BRANCH"
29+ if [ -z "$GIT_BRANCH" ]; then exit 1; fi
30+ echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
31+
2132 - name : Set up Python 3.7
2233 uses : actions/setup-python@v2
2334 with :
@@ -29,12 +40,12 @@ jobs:
2940 sudo apt install -qq ccache ninja-build
3041 python3 -m pip install numpy scipy
3142
32- - name : Cache pybind11
43+ - name : pybind11 cache files
3344 uses : actions/cache@v2
3445 id : pybind11_cache
3546 with :
3647 path : /tmp/pybind11
37- key : pybind24
48+ key : pybind11_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('**/lockfiles') }}
3849
3950 - name : Build and install pybind11
4051 if : steps.pybind11_cache.outputs.cache-hit != 'true'
@@ -43,17 +54,16 @@ jobs:
4354 cd /tmp/pybind11
4455 cmake -DCMAKE_BUILD_TYPE=Release -DPYBIND11_TEST=OFF .
4556 sudo make --silent install
46- rm -rf /tmp/pybind11
4757
48- - name : Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
58+ - name : Download and install the latest SOFA ${{ env.SOFA_BRANCH }} binaries
4959 shell : bash
5060 run : |
5161 mkdir -p /tmp/sofa_zip
5262 mkdir -p /tmp/sofa_binaries
53- curl --output /tmp/sofa_zip/${SYSTEM }.zip -L \
54- https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SYSTEM }/*zip*/${SYSTEM }.zip
55- unzip -qq /tmp/sofa_zip/${SYSTEM }.zip -d /tmp/sofa_zip
56- unzip -qq /tmp/sofa_zip/${SYSTEM }/SOFA_*.zip -d /tmp/sofa_binaries
63+ curl --output /tmp/sofa_zip/${SOFA_OS }.zip -L \
64+ https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS }/*zip*/${SOFA_OS }.zip
65+ unzip -qq /tmp/sofa_zip/${SOFA_OS }.zip -d /tmp/sofa_zip
66+ unzip -qq /tmp/sofa_zip/${SOFA_OS }/SOFA_*.zip -d /tmp/sofa_binaries
5767 sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
5868 sudo ls -la ${SOFA_ROOT}
5969 rm -rf /tmp/sofa_*
6272 uses : actions/cache@v2
6373 with :
6474 path : .ccache
65- key : ccache_${{ matrix.sofa_branch }}_${{ matrix.os }}_${{ hashFiles('**/lockfiles') }}
75+ key : ccache_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('**/lockfiles') }}
6676
6777 - name : Build
6878 env :
@@ -87,11 +97,11 @@ jobs:
8797 - name : Create artifact
8898 uses : actions/upload-artifact@v2
8999 with :
90- name : SofaPython3_${{ matrix.sofa_branch }}_${{ matrix.os } }
100+ name : SofaPython3_${{ env.GIT_BRANCH }}_${SOFA_OS }
91101 path : install
92102
93103 tests :
94- name : Testing with SOFA ${{ matrix.sofa_branch }}
104+ name : Testing on ${{ matrix.os }}
95105 needs : [build]
96106 runs-on : ${{ matrix.os }}
97107 strategy :
@@ -100,9 +110,20 @@ jobs:
100110 sofa_branch : [master, v21.06]
101111 env :
102112 SOFA_ROOT : /opt/sofa
103- SYSTEM : Linux
113+ SOFA_OS : Linux
104114
105115 steps :
116+ - name : Set env vars
117+ run : |
118+ if [ -n "$GITHUB_BASE_REF" ]; then
119+ GIT_BRANCH="$GITHUB_BASE_REF"
120+ else
121+ GIT_BRANCH="${GITHUB_REF#refs/heads/}"
122+ fi
123+ echo "GIT_BRANCH = $GIT_BRANCH"
124+ if [ -z "$GIT_BRANCH" ]; then exit 1; fi
125+ echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
126+
106127 - name : Set up Python 3.7
107128 uses : actions/setup-python@v2
108129 with :
@@ -113,23 +134,23 @@ jobs:
113134 sudo apt install -qq libboost-all-dev
114135 python3 -m pip install numpy scipy
115136
116- - name : Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
137+ - name : Download and install the latest SOFA ${{ env.SOFA_BRANCH }} binaries
117138 shell : bash
118139 run : |
119140 mkdir -p /tmp/sofa_zip
120141 mkdir -p /tmp/sofa_binaries
121- curl --output /tmp/sofa_zip/${SYSTEM }.zip -L \
122- https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SYSTEM }/*zip*/${SYSTEM }.zip
123- unzip -qq /tmp/sofa_zip/${SYSTEM }.zip -d /tmp/sofa_zip
124- unzip -qq /tmp/sofa_zip/${SYSTEM }/SOFA_*.zip -d /tmp/sofa_binaries
142+ curl --output /tmp/sofa_zip/${SOFA_OS }.zip -L \
143+ https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS }/*zip*/${SOFA_OS }.zip
144+ unzip -qq /tmp/sofa_zip/${SOFA_OS }.zip -d /tmp/sofa_zip
145+ unzip -qq /tmp/sofa_zip/${SOFA_OS }/SOFA_*.zip -d /tmp/sofa_binaries
125146 sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
126147 sudo ls -la ${SOFA_ROOT}
127148 rm -rf /tmp/sofa_*
128149
129150 - name : Install SP3
130151 uses : actions/download-artifact@v2
131152 with :
132- name : SofaPython3_${{ matrix.sofa_branch }}_${{ matrix.os } }
153+ name : SofaPython3_${{ env.GIT_BRANCH }}_${SOFA_OS }
133154 path : SofaPython3
134155
135156 - name : Binding.Sofa.Tests
0 commit comments