Skip to content

Commit ef6c3b6

Browse files
committed
[GitHub] Clean and simplify
1 parent ebd1376 commit ef6c3b6

File tree

2 files changed

+77
-34
lines changed

2 files changed

+77
-34
lines changed

.github/workflows/macos.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,23 @@ jobs:
1212
sofa_branch: [master, v21.06]
1313
env:
1414
SOFA_ROOT: /opt/sofa
15-
SYSTEM: MacOS
15+
SOFA_OS: MacOS
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:
@@ -28,15 +39,15 @@ jobs:
2839
brew install ccache ninja boost eigen pybind11
2940
python3 -m pip install numpy scipy
3041
31-
- name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
42+
- name: Download and install the latest SOFA ${{ env.SOFA_BRANCH }} binaries
3243
shell: bash
3344
run: |
3445
mkdir -p /tmp/sofa_zip
3546
mkdir -p /tmp/sofa_binaries
36-
curl --output /tmp/sofa_zip/${SYSTEM}.zip -L \
37-
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
38-
unzip -qq /tmp/sofa_zip/${SYSTEM}.zip -d /tmp/sofa_zip
39-
unzip -qq /tmp/sofa_zip/${SYSTEM}/SOFA_*.zip -d /tmp/sofa_binaries
47+
curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \
48+
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
49+
unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip
50+
unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries
4051
sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
4152
sudo ls -la ${SOFA_ROOT}
4253
rm -rf /tmp/sofa_*
@@ -45,7 +56,7 @@ jobs:
4556
uses: actions/cache@v2
4657
with:
4758
path: .ccache
48-
key: ccache_${{ matrix.sofa_branch }}_${{ matrix.os }}_${{ hashFiles('**/lockfiles') }}
59+
key: ccache_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('**/lockfiles') }}
4960

5061
- name: Build
5162
env:
@@ -70,7 +81,7 @@ jobs:
7081
- name: Create artifact
7182
uses: actions/upload-artifact@v2
7283
with:
73-
name: SofaPython3_${{ matrix.sofa_branch }}_${{ matrix.os }}
84+
name: SofaPython3_${{ env.GIT_BRANCH }}_${SOFA_OS}
7485
path: install
7586

7687
tests:
@@ -83,9 +94,20 @@ jobs:
8394
sofa_branch: [master, v21.06]
8495
env:
8596
SOFA_ROOT: /opt/sofa
86-
SYSTEM: MacOS
97+
SOFA_OS: MacOS
8798

8899
steps:
100+
- name: Set env vars
101+
run: |
102+
if [ -n "$GITHUB_BASE_REF" ]; then
103+
GIT_BRANCH="$GITHUB_BASE_REF"
104+
else
105+
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
106+
fi
107+
echo "GIT_BRANCH = $GIT_BRANCH"
108+
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
109+
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
110+
89111
- name: Set up Python 3.7
90112
uses: actions/setup-python@v2
91113
with:
@@ -96,23 +118,23 @@ jobs:
96118
brew install boost
97119
python3 -m pip install numpy scipy
98120
99-
- name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
121+
- name: Download and install the latest SOFA ${{ env.SOFA_BRANCH }} binaries
100122
shell: bash
101123
run: |
102124
mkdir -p /tmp/sofa_zip
103125
mkdir -p /tmp/sofa_binaries
104-
curl --output /tmp/sofa_zip/${SYSTEM}.zip -L \
105-
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
106-
unzip -qq /tmp/sofa_zip/${SYSTEM}.zip -d /tmp/sofa_zip
107-
unzip -qq /tmp/sofa_zip/${SYSTEM}/SOFA_*.zip -d /tmp/sofa_binaries
126+
curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \
127+
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
128+
unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip
129+
unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries
108130
sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
109131
sudo ls -la ${SOFA_ROOT}
110132
rm -rf /tmp/sofa_*
111133
112134
- name: Install SP3
113135
uses: actions/download-artifact@v2
114136
with:
115-
name: SofaPython3_${{ matrix.sofa_branch }}_${{ matrix.os }}
137+
name: SofaPython3_${{ env.GIT_BRANCH }}_${SOFA_OS}
116138
path: SofaPython3
117139

118140
- name: Binding.Sofa.Tests

.github/workflows/ubuntu.yml

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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_*
@@ -62,7 +72,7 @@ jobs:
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

Comments
 (0)