Debian Codegraph @

debian/external_deps/fetk/.github/workflows/Build.yaml

raw
1 name: Build and Package
2
3 on:
4 push:
5 branches: [ main ]
6 tags: ['*']
7 pull_request:
8
9 workflow_dispatch:
10
11
12 jobs:
13
14 Build:
15
16 runs-on: ${{ matrix.os }}
17 if: "!contains(github.event.head_commit.message, 'noci')"
18
19 strategy:
20 matrix:
21 fail-fast: [false]
22 os: [ubuntu-latest, macos-latest, windows-latest]
23 include:
24 - os: ubuntu-latest
25 CMAKE_SYSTEM: Linux
26 PACKAGE_TYPE: tar.gz
27 BLA_VENDOR: OpenBLAS
28 - os: macos-latest
29 CMAKE_SYSTEM: Darwin
30 PACKAGE_TYPE: tar.gz
31 BLA_VENDOR: Apple
32 - os: windows-latest
33 CMAKE_SYSTEM: win32
34 PACKAGE_TYPE: zip
35 BLA_VENDOR: OpenBLAS
36 WIN_DEPENDENCIES_RELEASE: v0.4.0
37
38 env:
39 # job-wide environment variables to use in `run` commands to avoid command-injection risks
40 CMAKE_SYSTEM: ${{ matrix.CMAKE_SYSTEM }}
41 CREATE_PACKAGE: ${{ startsWith(github.ref, 'refs/tags/') }}
42 BLA_VENDOR: ${{ matrix.BLA_VENDOR }}
43 WIN_DEPENDENCIES_RELEASE: ${{ matrix.WIN_DEPENDENCIES_RELEASE }}
44
45 steps:
46
47 - name: Add msbuild to PATH
48 if: startsWith(matrix.os, 'windows') # Windows only
49 uses: microsoft/[email protected]
50
51 - name: Checkout the repo
52 uses: actions/checkout@v2
53
54 - name: Install linux dependencies
55 if: startsWith(matrix.os, 'ubuntu') # Linux only
56 run: |
57 sudo apt-get update
58 DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
59 build-essential \
60 libarpack2-dev \
61 liblapack-dev \
62 libf2c2-dev \
63 libopenblas-serial-dev \
64 libsuitesparse-dev
65
66 - name: Install macOS dependencies
67 if: startsWith(matrix.os, 'macos') # Mac only
68 run: |
69 brew install \
70 arpack \
71 lapack \
72 suite-sparse
73
74 - name: Install Window dependencies
75 if: startsWith(matrix.os, 'windows') # Windows only
76 run: |
77 choco install wget
78 wget https://github.com/Electrostatics/cache/releases/download/${WIN_DEPENDENCIES_RELEASE}/apbs_dependencies_vcpkg.zip
79 7z x apbs_dependencies_vcpkg.zip -aoa -o/c/vcpkg
80 ls /c/vcpkg
81 shell: bash
82
83 - name: Configure for Mac and Linux
84 if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') # Linux and Mac only
85 run: |
86 mkdir build
87 cd build
88 cmake -DBLA_VENDOR=${BLA_VENDOR} -DCREATE_PACKAGE=${CREATE_PACKAGE} ..
89
90 - name: Configure for Windows
91 if: startsWith(matrix.os, 'windows') # Windows only
92 env:
93 CMAKE_PREFIX_PATH: ${VCPKG_INSTALLATION_ROOT}/installed/x86-windows
94 run: |
95 mkdir -p build/Release
96 cd build
97 echo $CMAKE_PREFIX_PATH
98 echo "CREATE_PACKAGE: ${CREATE_PACKAGE}"
99 cmake -DCMAKE_BUILD_TYPE=Release -DBLA_VENDOR=${BLA_VENDOR} -DCREATE_PACKAGE=${CREATE_PACKAGE} -DVCPKG_TARGET_TRIPLET=x86-windows -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -A Win32 ..
100 shell: bash
101
102 - name: Build on Mac and Linux
103 if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') # Linux and Mac only
104 run: |
105 cd build
106 make install
107
108 - name: Build on Windows
109 if: startsWith(matrix.os, 'windows') # Windows only
110 run: |
111 cd build
112 cmake --build . --config Release --parallel 1 --target install
113
114 - name: Extract values
115 run: |
116 sed -e 's/#.*//g' VERSION
117 version="$(cat VERSION | xargs)"
118 echo $version
119 version_array=($version)
120 echo ${version_array[2]}
121 version_stripped=`echo "${version_array[2]}" | sed -e 's/-[A-Za-z0-9_-]*$//g'`
122 echo ::set-output name=fetk-version-stripped::${version_stripped}
123 shell: bash
124 id: job-values
125
126 - name: Generate Assets
127 if: startswith(github.ref, 'refs/tags/') # Tag/release only
128 run: |
129 cd build
130 cpack
131
132 - name: Contents of the build dir
133 if: startsWith(github.ref, 'refs/tags/') # Tag/release only
134 run: ls build
135
136 - name: Release
137 if: startsWith(github.ref, 'refs/tags/') # Tag/release only
138 uses: softprops/action-gh-release@v1
139 env:
140 GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
141 with:
142 files: |
143 build/FETK-${{ steps.job-values.outputs.fetk-version-stripped }}-${{ matrix.CMAKE_SYSTEM }}.${{ matrix.PACKAGE_TYPE }}
144 fail_on_unmatched_files: true
145
146 - name: Setup tmate session
147 if: ${{ ! success() }}
148 uses: mxschmitt/action-tmate@v3