Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 110 additions & 59 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,150 @@
name: CI
name: MacOS CI

on: pull_request
on: [workflow_dispatch, pull_request]

jobs:
build:
name: Building on ${{ matrix.os }}
name: Building with SOFA ${{ matrix.sofa_branch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15]
sofa_branch: [master, v21.06]
env:
TOKEN: ${{ secrets.SOFA_REPO_READ_TOKEN }}
SOFA_ROOT: /opt/sofa
SOFA_OS: MacOS

steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Set env vars
run: |
echo github.event.number = ${{ github.event.number }}
echo github.event.pull_request.number = ${{ github.event.pull_request.number }}
echo github.event.issue.number = ${{ github.event.issue.number }}
if [ -n "${{ github.event.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.number }}"
elif [ -n "${{ github.event.pull_request.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.pull_request.number }}"
elif [ -n "${{ github.event.issue.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.issue.number }}"
else
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
fi
echo "GIT_BRANCH = $GIT_BRANCH"
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Install requirements
run: |
brew install ccache ninja boost eigen pybind11
python3 -m pip install numpy
brew install eigen boost
brew install ccache ninja
python3 -m pip install numpy scipy

- name: Download SOFA nightly build
run: |
curl --output sofa.zip -L \
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip
- name: pybind11 cache files
uses: actions/cache@v2
id: pybind11_cache
with:
path: /tmp/pybind11
key: pybind11_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }}

- name: Install SOFA nightly build
- name: Build pybind11
if: steps.pybind11_cache.outputs.cache-hit != 'true'
run: |
sudo unzip sofa.zip -d temp
sudo unzip temp/MacOS/`ls temp/MacOS/` -d temp
sudo rm -rf temp/MacOS
sudo mv temp/`ls temp` $SOFA_ROOT
rm -rf temp

- name: Get Time
id: time
uses: nanzm/[email protected]
with:
timeZone: 8
format: 'YYYY-MM-DD-HH-mm-ss'
git clone -b v2.4.3 --depth 1 https://github.com/pybind/pybind11.git /tmp/pybind11
cd /tmp/pybind11
cmake -DCMAKE_BUILD_TYPE=Release -DPYBIND11_TEST=OFF -DPYTHON_EXECUTABLE=$(which python3.7) .
make --silent

- name: Install pybind11
run: |
cd /tmp/pybind11
sudo make --silent install

- name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
shell: bash
run: |
mkdir -p /tmp/sofa_zip
mkdir -p /tmp/sofa_binaries
curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \
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
unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip
unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries
sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
sudo ls -la ${SOFA_ROOT}
rm -rf /tmp/sofa_*

- name: ccache cache files
uses: actions/cache@v2
with:
path: .ccache
key: ${{ matrix.os }}-ccache-${{ steps.time.outputs.time }}
restore-keys: |
${{ matrix.os }}-ccache-
key: ccache_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }}

- name: Build
env:
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: "500M"
run:
export CCACHE_BASEDIR=$GITHUB_WORKSPACE &&
export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache &&
ccache -z &&
cmake
-GNinja
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake
-DCMAKE_BUILD_TYPE=Release
-DPYTHON_EXECUTABLE=$(which python)
.
&& ninja && ninja install
&& echo ${CCACHE_BASEDIR}
&& ccache -s

- name: Archive production
run: |
export CCACHE_BASEDIR=$GITHUB_WORKSPACE
export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache
ccache -z
cmake \
-GNinja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE=$(which python3.7) \
.
ninja install
echo ${CCACHE_BASEDIR}
ccache -s

- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: sp3-${{ matrix.os }}
name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }}
path: install

tests:
name: Testing on ${{ matrix.os }}
name: Testing with SOFA ${{ matrix.sofa_branch }}
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15]
sofa_branch: [master, v21.06]
env:
TOKEN: ${{ secrets.SOFA_REPO_READ_TOKEN }}
SOFA_ROOT: /opt/sofa
SOFA_OS: MacOS

steps:
- name: Set env vars
run: |
echo github.event.number = ${{ github.event.number }}
echo github.event.pull_request.number = ${{ github.event.pull_request.number }}
echo github.event.issue.number = ${{ github.event.issue.number }}
if [ -n "${{ github.event.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.number }}"
elif [ -n "${{ github.event.pull_request.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.pull_request.number }}"
elif [ -n "${{ github.event.issue.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.issue.number }}"
else
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
fi
echo "GIT_BRANCH = $GIT_BRANCH"
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV

- name: Set up Python 3.7
uses: actions/setup-python@v2
Expand All @@ -103,25 +154,25 @@ jobs:
- name: Install requirements
run: |
brew install boost
python3 -m pip install numpy

- name: Download SOFA nightly build
run: |
curl --output sofa.zip -L \
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip
python3 -m pip install numpy scipy

- name: Install SOFA nightly build
- name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
shell: bash
run: |
sudo unzip sofa.zip -d temp
sudo unzip temp/MacOS/`ls temp/MacOS/` -d temp
sudo rm -rf temp/MacOS
sudo mv temp/`ls temp` $SOFA_ROOT
rm -rf temp
mkdir -p /tmp/sofa_zip
mkdir -p /tmp/sofa_binaries
curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \
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
unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip
unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries
sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
sudo ls -la ${SOFA_ROOT}
rm -rf /tmp/sofa_*

- name: Install SP3
uses: actions/download-artifact@v2
with:
name: sp3-${{ matrix.os }}
name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }}
path: SofaPython3

- name: Binding.Sofa.Tests
Expand Down
Loading