This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OSGeo4W Windows Build | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
- release-** | |
- queued_ltr_backports | |
paths: | |
- 'src/**' | |
- 'external/**' | |
- 'python/**' | |
- 'tests/**' | |
- 'ms-windows/**' | |
- 'CMakeLists.txt' | |
- '.github/workflows/osgeo4w.yml' | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
osgeo4w-packages: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Determine package name | |
- run: | | |
REPO=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY | |
read RELBRANCH < <(git ls-remote --heads $REPO "refs/heads/release-*_*" | sed -e '/\^{}$/d' -ne 's#^.*refs/heads/release-#release-#p' | sort -V | tail -1) | |
read OLTRBRANCH LTRBRANCH < <(git ls-remote --tags $REPO | sed -e '/\^{}$/d' -ne 's#^.*refs/tags/ltr-#release-#p' | sort -V | tail -2 | paste -s) | |
[ "$RELBRANCH" != "$LTRBRANCH" ] || LTRBRANCH=$OLTRBRANCH | |
if [ -n "$GITHUB_BASE_REF" ]; then | |
branch=$GITHUB_BASE_REF | |
else | |
branch=${GITHUB_REF##*/} | |
fi | |
case "$branch" in | |
$LTRBRANCH|queued_ltr_backports) | |
p=qgis-ltr-dev | |
;; | |
$RELBRANCH) | |
p=qgis-rel-dev | |
;; | |
master) | |
p="qgis-dev qgis-qt6-dev" | |
;; | |
*) | |
echo "Could not determine package name" | |
exit 1 | |
;; | |
esac | |
echo "matrix={\"pkg\":[\"${p// /\",\"}\"]}">>$GITHUB_OUTPUT | |
osgeo4w-build: | |
name: OSGeo4W Windows Build | |
needs: osgeo4w-packages | |
runs-on: windows-latest | |
env: | |
CCACHE_DIR: build/ccache | |
PATH: C:\WINDOWS\system32;C:\Windows | |
strategy: | |
matrix: ${{ fromJson(needs.osgeo4w-packages.outputs.matrix) }} | |
steps: | |
- name: Dump environment | |
shell: cmd | |
run: | | |
echo ::group::environment | |
set | |
echo ::endgroup:: | |
- name: Keep original line endings | |
run: | |
git config --global core.autocrlf false | |
env: | |
PATH: C:\Program Files\Git\bin;C:\WINDOWS\system32;C:\Windows | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'jef-n/o4w-playground' | |
env: | |
PATH: C:\Program Files\Git\bin;C:\WINDOWS\system32;C:\Windows | |
- name: Setup environment | |
shell: bash {0} | |
env: | |
SHELLOPTS: igncr | |
PKG: ${{ matrix.pkg }} | |
GITHUB_EVENT_NUMBER: ${{ github.event.number }} | |
run: | | |
export PATH=/bin:/usr/bin | |
export HOME=$(cygpath -au "$USERPROFILE") | |
REPO=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY | |
echo PKG=$PKG >>$GITHUB_ENV | |
echo REPO=$REPO >>$GITHUB_ENV | |
echo REF=$GITHUB_REF >>$GITHUB_ENV | |
echo PKGDESC="QGIS build of $GITHUB_REF" >>$GITHUB_ENV | |
echo BUILDNAMEPREFIX=$BUILDNAMEPREFIX >>$GITHUB_ENV | |
echo OSGEO4W_BUILD_RDEPS=0 >>$GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
path: 'src/${{ env.PKG }}/qgis' | |
- name: Restore build cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: build | |
key: build-ccache-osgeo4w-${{ github.event.pull_request.base.ref || github.ref_name }} | |
restore-keys: | | |
build-ccache-osgeo4w-master | |
- name: Build QGIS | |
shell: cmd | |
run: | | |
REM .sh and .py used in tests | |
assoc ShellScript=*.sh | |
ftype ShellScript=%CD%\cygin\bin\bash.exe %1 %* | |
assoc PythonScript=*.py | |
ftype PythonScript=%CD%\osgeo4w\osgeo4w\bin\python3.exe %1 %* | |
call bootstrap.cmd %PKG% | |
- name: Save build cache for push only | |
uses: actions/cache/save@v4 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
path: build | |
key: build-ccache-osgeo4w-${{ github.ref_name }}-${{ github.run_id }} |