Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill remaining traces of win32 support.
[simgrid.git] / .github / workflows / jarfile.yml
1 name: Jar build
2
3 on:
4   workflow_dispatch:
5   schedule:
6   # * is a special character in YAML so you have to quote this string
7       - cron:  '0 18 * * 0'
8 jobs:
9   build:
10     runs-on: ${{ matrix.config.os }}-latest
11     strategy:
12         matrix:
13           config:
14           - { name: "Ubuntu gcc", os: ubuntu, cc: "gcc", cxx: "g++", generator: "Unix Makefiles", cmake_extra_options: "-DLTO_EXTRA_FLAG=auto" }
15           - { name: "MacOS clang", os: macos, cc: "clang", cxx: "clang++", generator: "Unix Makefiles", cmake_extra_options: "-DLTO_EXTRA_FLAG=auto" }
16     steps:
17     - uses: actions/checkout@v2
18      # install dependencies
19     - name: Init options
20       run: |
21           echo "CC=${{ matrix.config.cc }}"   >> $GITHUB_ENV
22           echo "CXX=${{ matrix.config.cxx }}" >> GITHUB_ENV
23     - name: Install boost and eigen on ubuntu
24       if: matrix.config.os == 'ubuntu'
25       run: sudo apt-get update && sudo apt-get install -yq libboost-dev libeigen3-dev
26     - name: Install boost and eigen on macos
27       if: matrix.config.os == 'macos'
28       run: brew install boost eigen
29     - name: Build and test jar with Cmake
30       run: |
31           mkdir build
32           cd build
33           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 }}" ..
34           make -j2 simgrid-java_jar java-all
35           ctest -R java --output-on-failure
36     - name: Upload jar
37       uses: actions/upload-artifact@v2
38       with:
39           name: jar-${{ matrix.config.os }}
40           path: build/simgrid.jar
41     - name: Create the failure Message
42       if: ${{ failure() }}
43       run: |
44         echo "{\"attachments\": [{\"color\": \"#FF0000\", \"text\":\"Failure when building JAR file on ${{ matrix.config.name }}! See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}]}" > mattermost.json
45     - uses: mattermost/action-mattermost-notify@master
46       if: ${{ failure() }}
47       env:
48         MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
49         MATTERMOST_CHANNEL: ${{ secrets.MATTERMOST_CHANNEL}}
50   create_jar:
51     needs: build
52     runs-on: ubuntu-latest
53     steps:
54       - uses: actions/checkout@v2
55       - name: Download all jars from ubuntu
56         uses: actions/download-artifact@v2
57       - name: Build final jar
58         run: |
59            patch=$(grep -r set\(SIMGRID_VERSION_PATCH ./CMakeLists.txt | sed 's/.*"\([[:digit:]]\+\)".*/\1/g')
60            major=$(grep -r set\(SIMGRID_VERSION_MAJOR ./CMakeLists.txt | sed 's/.*"\([[:digit:]]\+\)".*/\1/g')
61            minor=$(grep -r set\(SIMGRID_VERSION_MINOR ./CMakeLists.txt | sed 's/.*"\([[:digit:]]\+\)".*/\1/g')
62            if [ $patch -ne 0 ]; then
63              version="$major.$minor.$patch"
64            else
65              version="$major.$minor"
66            fi
67            mkdir content
68            cd content
69            for j in  ubuntu macos ; do unzip -n ../jar-$j/simgrid.jar ; done
70            strip NATIVE/*/*/*.so
71            x86_64-linux-gnu-strip NATIVE/*/*/lib*dll
72            zip -r ../simgrid-${version}.jar *
73       - name: Upload jar
74         uses: actions/upload-artifact@v2
75         with:
76           name: jar-final
77           path: simgrid-*.jar
78       - name: cleanup artifacts
79         uses: geekyeggo/delete-artifact@v1
80         with:
81           name: |
82             jar-ubuntu
83             jar-macos
84       - name: Create the failure Message
85         if: ${{ failure() }}
86         run: |
87           echo "{\"attachments\": [{\"color\": \"#FF0000\", \"text\":\"Failure when assembling JAR file ! See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}]}" > mattermost.json
88       - name: Create the success Message
89         if: ${{ success() }}
90         run: |
91           echo "{\"attachments\": [{\"color\": \"#00FF00\", \"text\":\"JAR file built successfully ! You can get it on: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}]}" > mattermost.json
92       - uses: mattermost/action-mattermost-notify@master
93         env:
94           MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
95           MATTERMOST_CHANNEL: ${{ secrets.MATTERMOST_CHANNEL}}