-
-
Notifications
You must be signed in to change notification settings - Fork 413
OSGeo4W workflow for GitHub Actions #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
16b3f4d
Test workflow for OSGeo4W
HuidaeCho b894b70
Test workflow for OSGeo4W
HuidaeCho edcfa53
Try installing OSGeo4W
HuidaeCho 37bc652
Try installing OSGeo4W
HuidaeCho 87dd0b9
Try installing OSGeo4W
HuidaeCho cc90b66
Try installing OSGeo4W
HuidaeCho 07346df
Try installing OSGeo4W
HuidaeCho a77b60c
Try installing OSGeo4W
HuidaeCho 545cd39
Let's try configure
HuidaeCho 77be2ba
Fix run
HuidaeCho 08034b3
OK.. Let me use bash in MSYS2
HuidaeCho 0faa797
Fix path to osgeo4w.sh
HuidaeCho d5e5ba3
Add osgeo4w.sh
HuidaeCho 2cbc03e
Where am I?
HuidaeCho fa7d4dc
Pass absolute path to bash.exe
HuidaeCho 46c6b07
Try to compile
HuidaeCho d39a443
Where am I again?
HuidaeCho efd0ba1
Happy?
HuidaeCho f8ae60d
CD first..?
HuidaeCho 92cc739
nc-config may not work
HuidaeCho 6805a5d
What?
HuidaeCho 048f8e3
Let me check C:\OSGeo4W64
HuidaeCho 6980310
Wait for OSGeo4W to be fully installed
HuidaeCho db4d930
Need to install MSYS2 packages?
HuidaeCho d7af4c7
Why pacman does not run
HuidaeCho 63193de
Execute pacman directly
HuidaeCho 4a44dd2
Execute pacman directly without confirmation
HuidaeCho e4771e5
nc-config just works?
HuidaeCho 2b20fd9
Define PROJ_LIB
HuidaeCho 458cbaa
Add test batch files
HuidaeCho 2798394
Fix PROJ_LIB
HuidaeCho a4e8847
No autocrlf
HuidaeCho 6cb23d2
Add packaging code
HuidaeCho 9b2c5ac
Test packaging
HuidaeCho 459b394
Test both uninstalled and packaged binaries
HuidaeCho c480c8c
PATH not recognized?
HuidaeCho 2dd4065
Test PATH
HuidaeCho 472e9b6
Test PATH
HuidaeCho bbc4549
Test PATH
HuidaeCho 9e50a0c
OK, runs are separate sessions
HuidaeCho 9d604af
OK.. batch files do not recognize $env:PATH?
HuidaeCho a755800
Remove trailing semi-colons
HuidaeCho 9093e58
unix2dos batch files
HuidaeCho acf8bc9
Back to LF; use cmd /c
HuidaeCho 5bc58ad
Use call instead of cmd /c
HuidaeCho c65727b
cmd /c works; call does not
HuidaeCho 32dd642
Fix gunittest for Windows
HuidaeCho de48e5c
Relative paths not working?
HuidaeCho 757020b
Workflow name to build and tests
HuidaeCho 26f2a45
Fix paths
HuidaeCho fae13e7
Add mingw64 path
HuidaeCho 8b559e3
Back to relative paths
HuidaeCho 1b1001d
Use $bin instead of bin.$arch
HuidaeCho 141d117
Just directly call grass.bat; PATH changes after each grass.bat call
HuidaeCho 1d59764
Python encodings module test
HuidaeCho 2a1bbfd
Avoid python3 from mingw64
HuidaeCho b13a7e8
MSYS2 path first for DLL dependencies
HuidaeCho d073630
50% success rate
HuidaeCho d8dd14a
Unit test encoding should be independent of the system encoding
HuidaeCho 48e82a6
Just test packaged binaries only
HuidaeCho 517c808
Use a non-interactive monitor for unit testing
HuidaeCho 6af11b3
Success rate for test_thorough.bat 60%
HuidaeCho 3a9983c
Address review comments
HuidaeCho 16450be
Rename (src|dist)_win_esc to (src|dist)_esc
HuidaeCho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Usage: build_osgeo4w.sh [-p] [path] | ||
| # | ||
| # By default, the script will look for the source code in the current directory | ||
| # and create bin.x86_64-w64-mingw32\grass$ver.bat (run this batch file to start | ||
| # GRASS GIS) and dist.x86_64-w64-mingw32\etc\env.bat. | ||
| # | ||
| # -p optionally install GRASS GIS to C:\OSGeo4W64\opt\grass (run | ||
| # C:\OSGeo4W64\opt\grass\grass$ver.bat) and create an unzippable package | ||
| # grass$ver-x86_64-w64-mingw32-osgeo4w64-$date.zip | ||
| # | ||
| # path specify a path to the source code | ||
| # | ||
|
|
||
| # stop on errors | ||
| set -e | ||
|
|
||
| if [ "$1" = "-p" ]; then | ||
| package=1 | ||
| shift | ||
| else | ||
| package=0 | ||
| fi | ||
|
|
||
| test -d "$1" && cd "$1" | ||
|
|
||
| osgeo4w_path=/c/OSGeo4W64 | ||
| arch=x86_64-w64-mingw32 | ||
| src=`pwd` | ||
|
|
||
| # compile | ||
|
|
||
| export PATH=/mingw64/bin:/c/OSGeo4W64/bin:/usr/bin | ||
| export PROJ_LIB=$osgeo4w_path/share/proj | ||
|
|
||
| OSGEO4W_ROOT_MSYS=$osgeo4w_path \ | ||
| ./configure \ | ||
| --host=$arch \ | ||
| --with-includes=$osgeo4w_path/include \ | ||
| --with-libs="$osgeo4w_path/lib $osgeo4w_path/bin" \ | ||
| --with-nls \ | ||
| --with-freetype-includes=$osgeo4w_path/include/freetype2 \ | ||
| --with-bzlib \ | ||
| --with-geos=$src/mswindows/osgeo4w/geos-config \ | ||
| --with-netcdf=$osgeo4w_path/bin/nc-config \ | ||
| --with-gdal=$src/mswindows/osgeo4w/gdal-config \ | ||
| --with-liblas=$src/mswindows/osgeo4w/liblas-config \ | ||
| --with-opengl=windows | ||
|
|
||
| make | ||
|
|
||
| # install | ||
|
|
||
| bin=bin.$arch | ||
| dist=dist.$arch | ||
| ver=`sed -n '/^INST_DIR[ \t]*=/{s/^.*grass//; p}' include/Make/Platform.make` | ||
|
|
||
| rm -f $dist/grass$ver.tmp $dist/etc/fontcap | ||
|
|
||
| # create batch files | ||
|
|
||
| src_esc=`echo $src | sed 's#^/\([a-z]\)#\1:#; s#/#\\\\\\\\#g'` | ||
| dist_esc="$src_esc\\\\$dist" | ||
|
|
||
| ( | ||
| sed 's/^\(set GISBASE=\).*/\1'$dist_esc'/' \ | ||
| mswindows/osgeo4w/env.bat.tmpl | ||
| cat<<EOT | ||
|
|
||
| set PATH=C:\\msys64\\mingw64\\bin;%OSGEO4W_ROOT%\\apps\\msys\\bin;%PATH% | ||
|
|
||
| if not exist %GISBASE%\etc\fontcap ( | ||
| pushd . | ||
| %~d0 | ||
| cd %GISBASE%\lib | ||
| set GISRC=dummy | ||
| %GISBASE%\bin\g.mkfontcap.exe | ||
| popd | ||
| ) | ||
| EOT | ||
| ) > $dist/etc/env.bat | ||
| unix2dos $dist/etc/env.bat | ||
|
|
||
| ( | ||
| sed -e 's/^\(call "\)%~dp0\(.*\)$/\1C:\\OSGeo4W64\\bin\2/' \ | ||
| -e 's/^\(call "\).*\(\\etc\\env\.bat"\)$/\1'$dist_esc'\2/' \ | ||
| -e 's/^\(.* "\)%GISBASE%\\etc\(\\grass.*\)$/\1%GISBASE%\\..\\'$bin'\2/' \ | ||
| -e 's/@POSTFIX@/'$ver'/g' \ | ||
| mswindows/osgeo4w/grass.bat.tmpl | ||
| ) > $bin/grass$ver.bat | ||
| unix2dos $bin/grass$ver.bat | ||
|
|
||
| test $package -eq 0 && exit | ||
|
|
||
| # package | ||
|
|
||
| opt_path=$osgeo4w_path/opt | ||
| grass_path=$opt_path/grass | ||
|
|
||
| mkdir -p $opt_path | ||
| cp -a $dist $grass_path | ||
| cp -a $bin/grass$ver.py $grass_path/etc | ||
| cp -a `ldd $dist/lib/*.dll | awk '/mingw64/{print $3}' | | ||
| sort -u | grep -v 'lib\(crypto\|ssl\)'` $grass_path/lib | ||
|
|
||
| ( | ||
| sed -e 's/^\(set GISBASE=\).*/\1%OSGEO4W_ROOT%\\opt\\grass/' \ | ||
| mswindows/osgeo4w/env.bat.tmpl | ||
| cat<<EOT | ||
|
|
||
| set PATH=%OSGEO4W_ROOT%\\apps\\msys\\bin;%PATH% | ||
|
|
||
| if not exist %GISBASE%\etc\fontcap ( | ||
| pushd . | ||
| %~d0 | ||
| cd %GISBASE%\lib | ||
| set GISRC=dummy | ||
| %GISBASE%\bin\g.mkfontcap.exe | ||
| popd | ||
| ) | ||
| EOT | ||
| ) > $grass_path/etc/env.bat | ||
| unix2dos $grass_path/etc/env.bat | ||
|
|
||
| ( | ||
| sed -e 's/^\(call "%~dp0\)\(.*\)$/\1\\..\\..\\bin\2/' \ | ||
| -e 's/^\(call "%OSGEO4W_ROOT%\\\).*\(\\etc\\env\.bat"\)$/\1opt\\grass\2/' \ | ||
| -e 's/@POSTFIX@/'$ver'/g' \ | ||
| mswindows/osgeo4w/grass.bat.tmpl | ||
| ) > $grass_path/grass$ver.bat | ||
| unix2dos $grass_path/grass$ver.bat | ||
|
|
||
| exit | ||
|
|
||
| # don't package for GitHub workflow; unnecessary | ||
|
|
||
| osgeo4w_basename=`basename $osgeo4w_path` | ||
| date=`date +%Y%m%d` | ||
| zip=$src/grass$ver-$arch-osgeo4w64-$date.zip | ||
|
|
||
| cd $osgeo4w_path/.. | ||
| zip -r $zip $osgeo4w_basename -x "$osgeo4w_basename/var/*" "*/__pycache__/*" | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: OSGeo4W | ||
|
|
||
| on: | ||
| - push | ||
| - pull_request | ||
|
|
||
| jobs: | ||
| build: | ||
| name: ${{ matrix.os }} build and tests | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - windows-2019 | ||
| fail-fast: false | ||
|
|
||
| steps: | ||
| - name: Set git to use LF | ||
| run: | | ||
| git config --global core.autocrlf false | ||
| git config --global core.eol lf | ||
| - uses: actions/checkout@v2 | ||
| - name: Install OSGeo4W | ||
| run: | | ||
| $exe = 'osgeo4w-setup-x86_64.exe' | ||
| $url = 'http://download.osgeo.org/osgeo4w/' + $exe | ||
| (New-Object System.Net.WebClient).DownloadFile($url, $exe) | ||
| Start-Process ('.\'+$exe) -ArgumentList '-A -g -k -q -s http://download.osgeo.org/x86_64 -P cairo,fftw,freetype-devel,gdal-ecw,gdal-mrsid,liblas-devel,libxdr,msys,pdcurses,python3-numpy,python3-pywin32,python3-wx,regex-devel,wxpython,zstd-devel' -Wait | ||
| - name: Install MSYS2 packages | ||
| run: C:\msys64\usr\bin\pacman.exe --noconfirm -S tar libintl make bison diffutils git dos2unix zip mingw-w64-x86_64-toolchain mingw-w64-x86_64-cairo mingw-w64-x86_64-python3-six | ||
| - name: Compile GRASS GIS | ||
| run: C:\msys64\usr\bin\bash.exe -l (''+(Get-Location)+'\.github\workflows\build_osgeo4w.sh') -p (Get-Location) | ||
| - name: Test executing of the grass command | ||
| run: .github/workflows/test_simple.bat 'C:\OSGeo4W64\opt\grass\grass79.bat' | ||
| - name: Run tests | ||
| run: .github/workflows/test_thorough.bat 'C:\OSGeo4W64\opt\grass\grass79.bat' |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| set grass=%1 | ||
|
|
||
| call %grass% --tmp-location EPSG:4326 --exec g.region res=0.1 -p |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| set grass=%1 | ||
| set python=C:\OSGeo4W64\bin\python3 | ||
|
|
||
| call %grass% --tmp-location XY --exec g.extension g.download.location | ||
| call %grass% --tmp-location XY --exec g.download.location url=http://fatra.cnr.ncsu.edu/data/nc_spm_full_v2alpha2.tar.gz dbase=%USERPROFILE% | ||
| call %grass% --tmp-location XY --exec %python% -m grass.gunittest.main --grassdata %USERPROFILE% --location nc_spm_full_v2alpha2 --location-type nc --min-success 60 | ||
HuidaeCho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the binaries downloadable somewhere? could these be used to upload for daily builds in OSGeo4W?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at this point, but we could use GitHub artifacts to copy out the package: https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
if we're going this way later on, maybe the install scheme (now in \opt) have to be adapted to be usable in OSGeo4W?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current workflow is mainly for testing, but changing the install scheme wouldn't be a problem. I thought about that possibility too, but we already have working daily builds for Windows. Also, I wanted to create a portable package that doesn't require admin rights to install.