Debian Codegraph @

.github/workflows/linux-ci.yml

raw
1 ---
2 name: Linux build and test
3 on:
4 push:
5 branches:
6 - 'master'
7 - 'stable/*'
8 pull_request:
9 branches:
10 - '**'
11 release:
12 types:
13 - created
14
15 jobs:
16 test:
17 name: Run tests
18 runs-on: ${{ matrix.os }}
19 strategy:
20 matrix:
21 os: [ubuntu-20.04, ubuntu-22.04]
22 build_static: [true, false]
23 download_requirements: [sudo apt install -y -qq gfortran liblapack-dev libmetis-dev libnauty2-dev]
24 include:
25 - os: macos-13
26 build_static: false
27 flags: CC=clang OSX=13
28 download_requirements: brew install metis bash
29 - os: macos-13
30 build_static: false
31 flags: CC=gcc-13 CXX=g++-13 OSX=13 ADD_CXXFLAGS=-Wl,-ld_classic
32 download_requirements: brew install metis bash
33 - os: macos-14
34 arch: arm64
35 build_static: false
36 flags: CC=gcc-13 CXX=g++-13 OSX=14 ADD_CXXFLAGS=-Wl,-ld_classic
37 download_requirements: brew install metis bash
38 steps:
39 - name: Checkout source
40 uses: actions/checkout@v4
41 with:
42 path: ${{ github.event.repository.name }}
43 - name: Install required packages from package manager
44 run: ${{ matrix.download_requirements }}
45 - name: Checkout coinbrew
46 uses: actions/checkout@v4
47 with:
48 repository: coin-or/coinbrew
49 path: coinbrew
50 - name: Build project
51 run: |
52 export ${{ matrix.flags }}
53 ADD_ARGS=()
54 ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' )
55 ADD_BUILD_ARGS=()
56 ADD_BUILD_ARGS+=( --tests main --enable-relocatable )
57 ADD_BUILD_ARGS+=( --verbosity 2 )
58 [[ ${{ matrix.build_static }} == "true" ]] && \
59 ADD_BUILD_ARGS+=( --static --with-lapack='-llapack -lblas -lgfortran -lquadmath -lm' )
60 bash coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update \
61 "${ADD_ARGS[@]}"
62 bash coinbrew/coinbrew build ${{ github.event.repository.name }} \
63 "${ADD_ARGS[@]}" "${ADD_BUILD_ARGS[@]}" \
64 ADD_CXXFLAGS="${ADD_CXXFLAGS}" CC=${CC} CXX=${CXX}
65 [[ ${CC} ]] && CC="${CC}" || CC=""
66 echo "CC=${CC}" >> $GITHUB_ENV
67 - name: Archive dist contents
68 run: |
69 cp ${{ github.event.repository.name }}/README.md dist/
70 cp ${{ github.event.repository.name }}/LICENSE dist/
71 tar -czvf release.tar.gz -C dist .
72 - name: Checkout package name generation script
73 uses: actions/checkout@v4
74 with:
75 repository: coin-or-tools/platform-analysis-tools
76 path: tools
77 ref: 0.0.2
78 - name: Retrieve platform info
79 run: |
80 python3 -m venv venv
81 source venv/bin/activate
82 pip install -r tools/requirements.txt
83 [[ ${{ matrix.build_static }} == "true" ]] && buildtype=static || buildtype=
84 platform_str=`python3 tools/hsf_get_platform.py -b $buildtype`
85 echo "platform_string=${platform_str}" >> $GITHUB_ENV
86 - name: Upload Artifact
87 uses: actions/upload-artifact@v4
88 with:
89 name: ${{ github.event.repository.name }}-${{ env.platform_string }}.tar.gz
90 path: release.tar.gz
91 if-no-files-found: error
92 - name: Upload package to release
93 if: ${{ github.event_name == 'release'}}
94 uses: actions/upload-release-asset@v1
95 env:
96 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97 with:
98 upload_url: ${{ github.event.release.upload_url }}
99 asset_path: ./release.tar.gz
100 asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ env.platform_string }}.tar.gz
101 asset_content_type: application/gzip