1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
|
name: build
on:
schedule:
- cron: "35 9 * * 2"
push:
branches:
- master
tags:
- v**
release:
types: [published]
pull_request:
workflow_dispatch:
inputs:
type:
description: 'Build type (`debug` or `release`)'
default: 'debug'
required: true
# Tip: Use below action to debug with SSH.
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# On Windows:
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
jobs:
prelude:
runs-on: ubuntu-22.04
outputs:
matrix-windows: ${{ steps.set-matrix-windows.outputs.matrix_windows }}
matrix-others: ${{ steps.set-matrix-others.outputs.matrix_others }}
steps:
- name: Create Build Matrix (Windows)
id: set-matrix-windows
run: |
if [[ '${{ github.event_name }}' == "schedule" || '${{ github.event.inputs.type }}' == "release" || '${{ github.ref }}' == "refs/tags/v"* ]]; then
matrix="{deps: ['standard'], arch: ['x86_64'], configuration: ['Release']}"
else
matrix="{deps: ['debug'], arch: ['x86_64'], configuration: ['Debug']}"
fi
echo "matrix_windows=$matrix" >> $GITHUB_OUTPUT
- name: Create Build Matrix (Linux/macOS)
id: set-matrix-others
run: |
if [[ '${{ github.event_name }}' == "schedule" || '${{ github.event.inputs.type }}' == "release" || '${{ github.ref }}' == "refs/tags/v"* ]]; then
matrix="{os: ['ubuntu-22.04', 'ubuntu-22.04-arm', 'macos-15-intel', 'macos-15'], deps: ['standard', 'headless'], configuration: ['Release']}"
else
matrix="{os: ['ubuntu-22.04', 'ubuntu-22.04-arm', 'macos-15-intel', 'macos-15'], deps: ['debug'], configuration: ['Debug']}"
fi
echo "matrix_others=$matrix" >> $GITHUB_OUTPUT
- name: Remove Release (scheduled build only)
if: github.event_name == 'schedule' || github.event.inputs.type == 'release'
uses: dev-drprasad/delete-tag-and-release@v0.2.1
with:
delete_release: true
tag_name: weekly-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-source-code:
runs-on: ubuntu-22.04
needs: prelude
steps:
- name: Checkout GDL
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Compress Source Code Distribution
id: step-compress-source-code
run: |
RELEASE_NAME=
if [[ '${{ github.event_name }}' == "schedule" || '${{ github.event.inputs.type }}' == "release" ]]; then
RELEASE_NAME="unstable-${GITHUB_SHA:0:7}"
elif [[ '${{ github.ref }}' == "refs/tags/v"* ]]; then
RELEASE_NAME="${GITHUB_REF_NAME}"
fi
if [[ ! -z "${RELEASE_NAME}" ]]; then
cp -r $PWD /tmp/gdl-${RELEASE_NAME}
cmake -D SRC=/tmp/gdl-${RELEASE_NAME}/src/version.hpp.in -D DST=/tmp/gdl-${RELEASE_NAME}/src/version.hpp -D GIT_EXECUTABLE=git -P /tmp/gdl-${RELEASE_NAME}/CMakeModules/GenerateVersionHeader.cmake
rm -rf /tmp/gdl-${RELEASE_NAME}/.git
cd /tmp
rm /tmp/gdl-${RELEASE_NAME}/src/version.hpp.in
tar czf "/tmp/gdl-${RELEASE_NAME}.tar.gz" gdl-${RELEASE_NAME}
echo "released=true" >> "$GITHUB_OUTPUT"
fi
- name: Upload Release Assets (unstable)
if: (github.event_name == 'schedule' || github.event.inputs.type == 'release') && steps.step-compress-source-code.outputs.released == 'true'
uses: ncipollo/release-action@v1
with:
artifacts: "/tmp/gdl-*.tar.gz"
name: Weekly Binary Release (unstable)
body: Weekly Binary Release (unstable)
prerelease: true
allowUpdates: true
replacesArtifacts: true
commit: ${{ github.sha }}
tag: weekly-release
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets (stable)
if: startsWith(github.ref, 'refs/tags/v') && steps.step-compress-source-code.outputs.released == 'true'
uses: ncipollo/release-action@v1
with:
artifacts: "/tmp/gdl-*.tar.gz"
name: ${{ github.event.release.tag_name }}
prerelease: false
allowUpdates: true
replacesArtifacts: true
commit: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
build-linux-macos:
runs-on: ${{ matrix.os }}
needs: prelude
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prelude.outputs.matrix-others) }}
env:
DEPS: ${{ matrix.deps }}
Configuration: ${{ matrix.configuration }}
ROOT_DIR: ${{ github.workspace }}/..
steps:
- name: Checkout GDL
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Dependencies
run: |
scripts/build_gdl.sh prep
# - name: Set HDF path on macOS usin brew
# # https://stackoverflow.com/questions/66741778/how-to-install-h5py-needed-for-keras-on-macos-with-m1
# if: contains(matrix.os, 'macos')
# run: echo HDF5_DIR="$(brew --prefix hdf5)" >> $GITHUB_ENV
# - name: Disable OpenMP for Apple Silicon (FIXME!)
# if: matrix.os == 'macos-14'
# run: echo WITH_OPENMP=OFF >> $GITHUB_ENV
- name: Build GDL
run: |
scripts/build_gdl.sh configure
scripts/build_gdl.sh build
- name: Package GDL
run: |
scripts/build_gdl.sh install
scripts/build_gdl.sh pack
scripts/build_gdl.sh prep_deploy
- name: Upload Build Artifacts
if: contains(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
path: gdl-*-${{ matrix.deps }}.dmg
name: GDL (${{ matrix.os }}, ${{ matrix.deps }}, ${{ matrix.configuration }})
- name: Upload Build Artifacts
if: "!contains(matrix.os, 'macos')"
uses: actions/upload-artifact@v4
with:
path: gdl-*-${{ matrix.deps }}.zip
name: GDL (${{ matrix.os }}, ${{ matrix.deps }}, ${{ matrix.configuration }})
- name: Upload Release Assets (unstable)
if: (github.event_name == 'schedule' || github.event.inputs.type == 'release') && startsWith(matrix.os, 'macos-')
uses: ncipollo/release-action@v1
with:
artifacts: "gdl-*-${{ matrix.deps }}.dmg"
name: Weekly Binary Release (unstable)
body: Weekly Binary Release (unstable)
prerelease: true
allowUpdates: true
replacesArtifacts: true
commit: ${{ github.sha }}
tag: weekly-release
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets (stable)
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
artifacts: "gdl-*-${{ matrix.deps }}.zip"
name: ${{ github.event.release.tag_name }}
prerelease: false
allowUpdates: true
replacesArtifacts: true
commit: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Test GDL
run: |
scripts/build_gdl.sh check
build-windows:
runs-on: windows-latest
needs: prelude
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prelude.outputs.matrix-windows) }}
env:
DEPS: ${{ matrix.deps }}
WORKSPACE: ${{ github.workspace }}
Platform: ${{ matrix.arch }}
Configuration: ${{ matrix.configuration }}
steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2.22.0
with:
msystem: MSYS
update: false
release: false
install: >-
mingw-w64-${{ matrix.arch }}-toolchain
mingw-w64-${{ matrix.arch }}-cmake
mingw-w64-${{ matrix.arch }}-nsis
zip
unzip
tar
zstd
make
patch
git
rsync
patch
- name: Checkout GDL
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Cache Dependencies
if: matrix.arch == 'x86_64'
id: cache
uses: actions/cache@v4
with:
path: |
C:\msys64\cache
key: cache-gdl-deps-windows-msys2-${{ matrix.arch }}-v9
- name: Install MSMPI
if: matrix.deps == 'debug' || matrix.deps == 'headless'
run: |
Invoke-WebRequest -Uri https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe -OutFile MSMpiSetup.exe
.\MSMpiSetup.exe -unattend
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
pacman -Q | tr ' ' '-' | sort > ~/snapshot1.txt
scripts/build_gdl.sh prep
pacman -Q | tr ' ' '-' | sort > ~/snapshot2.txt
echo "Setting up cache..."
mkdir -p /cache
for package in $(comm -13 ~/snapshot1.txt ~/snapshot2.txt); do
echo "Caching ${package}..."
fn=`ls /var/cache/pacman/pkg/${package}-*.tar.{gz,bz2,xz,zst} 2> /dev/null || true`
tar xf $fn -C /cache
done
ADDTIONAL_FILES=( /mingw*/bin/mgwxdr-0.dll
/mingw*/lib/libbsdxdr.*
/mingw*/include/rpc/types.h
/mingw*/include/rpc/xdr.h )
for fn in ${ADDTIONAL_FILES[@]}; do
cp --parents ${fn} /cache
done
- name: Restore Cache
if: steps.cache.outputs.cache-hit == 'true'
shell: msys2 {0}
run: |
rsync -rt --no-t --inplace /cache/ /
- name: Setup Python (64 bit)
id: setup-python-64
uses: actions/setup-python@v5
if: matrix.arch == 'x86_64'
with:
python-version: '3.x'
architecture: x64
- name: Setup Python (32 bit)
id: setup-python-32
uses: actions/setup-python@v5
if: matrix.arch == 'i686'
with:
python-version: '3.x'
architecture: x86
- name: Install Numpy
run: pip install numpy
- name: Build GDL
shell: msys2 {0}
run: |
export PATH=`cygpath "${pythonLocation}"`:$PATH
export PYTHON_EXECUTABLE=`cygpath "${pythonLocation}"`/python
if [[ -n "${{ steps.setup-python-32.outputs.python-version }}" ]]; then
export PYTHONVERSION="${{ steps.setup-python-32.outputs.python-version }}"
else
export PYTHONVERSION="${{ steps.setup-python-64.outputs.python-version }}"
fi
scripts/build_gdl.sh configure
scripts/build_gdl.sh build
scripts/build_gdl.sh install
- name: Package GDL
shell: msys2 {0}
run: |
export GDLDE_VERSION=$(git ls-remote --refs --tags https://github.com/gnudatalanguage/gdlde | tail -n1 | cut -d '/' -f3)
scripts/build_gdl.sh pack
scripts/build_gdl.sh prep_deploy
- name: Upload GDL Installer
uses: actions/upload-artifact@v4
with:
name: GDL Installer (${{ matrix.deps }}, ${{ matrix.arch }}, ${{ matrix.configuration }})
path: gdlsetup-*-${{ matrix.deps }}.exe
# STILL TRUE? DO NOT export .zip as artifact: (was due to necessary use of a precise location for our customized plplot drivers before plplot is integrated)
# only an installer can be used (sets the correct environment variables)
# - name: Upload Build Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: GDL (windows-latest, ${{ matrix.deps }}, ${{ matrix.arch }}, ${{ matrix.configuration }})
# path: gdl-*-${{ matrix.deps }}.zip
- name: Upload Release Windows Installer (unstable)
if: github.event_name == 'schedule' || github.event.inputs.type == 'release'
uses: ncipollo/release-action@v1
with:
artifacts: "gdlsetup-*-${{ matrix.deps }}.exe,gdl-*-${{ matrix.deps }}.zip"
name: Weekly Release (unstable)
prerelease: true
allowUpdates: true
replacesArtifacts: true
tag: weekly-release
token: ${{ secrets.GITHUB_TOKEN }}
# supressed, same reason as above
# - name: Upload Release Assets (stable)
# if: startsWith(github.ref, 'refs/tags/v')
# uses: ncipollo/release-action@v1
# with:
# artifacts: "gdlsetup-*-${{ matrix.deps }}.exe,gdl-*-${{ matrix.deps }}.zip"
# name: ${{ github.event.release.tag_name }}
# prerelease: false
# allowUpdates: true
# replacesArtifacts: true
# commit: ${{ github.sha }}
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Test GDL
shell: msys2 {0}
run: |
export PATH=`cygpath "${pythonLocation}"`:$PATH
scripts/build_gdl.sh check
|