Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to put back boost on windows
[simgrid.git] / .github / workflows / jarfile.yml
1 name: SimGrid complete jar file generation
2
3 on: [workflow_dispatch]
4
5 jobs:
6   build:
7     runs-on: ${{ matrix.config.os }}-latest
8     strategy:
9         matrix:
10           config:
11           - { name: "Windows MingW", os: windows, cc: "gcc", cxx: "g++", generator: "MinGW Makefiles", cmake_extra_options: "-Denable_lto=OFF" }
12           - { name: "Ubuntu gcc", os: ubuntu, cc: "gcc", cxx: "g++", generator: "Unix Makefiles", cmake_extra_options: "-DLTO_EXTRA_FLAG=auto" }
13           - { name: "MacOS clang", os: macos, cc: "clang", cxx: "clang++", generator: "Unix Makefiles", cmake_extra_options: "-DLTO_EXTRA_FLAG=auto" }
14     steps:
15     - uses: actions/checkout@v2
16      # install dependencies
17     - name: Init options
18       run: |
19           echo "CC=${{ matrix.config.cc }}"   >> $GITHUB_ENV
20           echo "CXX=${{ matrix.config.cxx }}" >> GITHUB_ENV
21     - name: Install boost on ubuntu
22       if: matrix.config.os == 'ubuntu'
23       run: sudo apt-get update && sudo apt-get install -yq libboost-dev
24     - name: Install boost on macos
25       if: matrix.config.os == 'macos'
26       run: brew install boost
27     - name: Install boost and gcc on windows
28       if: matrix.config.os == 'windows'
29       run: |
30         Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
31         (Get-Content ~\scoop\buckets\main\bucket\gcc.json).replace('http://repo.msys2.org/', 'http://mirrors.huaweicloud.com/msys2/') | Set-Content  ~\scoop\buckets\main\bucket\gcc.json
32         scoop install gcc --global
33         # Use the boost-1.72.0-win32-msvc14.1-x86_64.tar.gz for Windows 2016
34         $url = "https://github.com/actions/boost-versions/releases/download/1.72.0-20200608.4/boost-1.72.0-win32-msvc14.2-x86_64.tar.gz"
35         (New-Object System.Net.WebClient).DownloadFile($url, "$env:TEMP\boost.tar.gz")
36         7z.exe x "$env:TEMP\boost.tar.gz" -o"$env:TEMP\boostArchive" -y | Out-Null
37         7z.exe x "$env:TEMP\boostArchive" -o"$env:TEMP\boost" -y | Out-Null
38         Push-Location -Path "$env:TEMP\boost"
39         Invoke-Expression .\setup.ps1
40         echo "BOOST_ROOT=C:\hostedtoolcache\windows\Boost\1.72.0\x86_64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
41         echo "BOOST_INCLUDEDIR=C:\hostedtoolcache\windows\Boost\1.72.0\x86_64\boost\include" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
42         echo "BOOST_LIBRARYDIR=C:\hostedtoolcache\windows\Boost\1.72.0\x86_64\lib" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
43     - name: Build jar with Cmake
44       run: |
45           mkdir build
46           cd build
47           cmake -Denable_documentation=OFF -Denable_java=ON -Denable_msg=ON -Denable_lib_in_jar=ON -Dminimal-bindings=ON -Denable_compile_optimizations=ON -Denable_smpi=OFF ${{ matrix.config.cmake_extra_options }} -G "${{ matrix.config.generator }}" ..
48           make -j2 simgrid-java_jar
49     - name: Upload jar
50       uses: actions/upload-artifact@v2
51       with:
52           name: jar-${{ matrix.config.os }}
53           path: build/simgrid.jar
54
55   create_jar:
56     needs: build
57     runs-on: ubuntu-latest
58     steps:
59       - uses: actions/checkout@v2
60       - name: Download all jars from ubuntu
61         uses: actions/download-artifact@v2
62       - name: Build final jar
63         run: |
64            patch=$(grep -r set\(SIMGRID_VERSION_PATCH ./CMakeLists.txt | sed 's/.*"\([[:digit:]]\+\)".*/\1/g')
65            major=$(grep -r set\(SIMGRID_VERSION_MAJOR ./CMakeLists.txt | sed 's/.*"\([[:digit:]]\+\)".*/\1/g')
66            minor=$(grep -r set\(SIMGRID_VERSION_MINOR ./CMakeLists.txt | sed 's/.*"\([[:digit:]]\+\)".*/\1/g')
67            if [ $patch -ne 0 ]; then
68              version="$major.$minor.$patch"
69            else
70              version="$major.$minor"
71            fi
72            mkdir content
73            cd content
74            for j in  ubuntu macos windows ; do unzip -n ../jar-$j/simgrid.jar ; done
75            strip NATIVE/*/*/*.so
76            x86_64-linux-gnu-strip NATIVE/*/*/lib*dll
77            zip -r ../simgrid-${version}.jar *
78       - name: Upload jar
79         uses: actions/upload-artifact@v2
80         with:
81           name: jar-final
82           path: simgrid-*.jar
83       - name: cleanup artifacts
84         uses: geekyeggo/delete-artifact@v1
85         with:
86           name: |
87             jar-ubuntu
88             jar-windows
89             jar-macos