-
Notifications
You must be signed in to change notification settings - Fork 34
113 lines (100 loc) · 3.66 KB
/
Build_on_Windows.yml
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
# Build SEIMS on Windows using MSVC
name: Build on Windows using MSVC
on:
push:
branches:
- dev
paths-ignore:
- 'data'
- 'gui'
- 'knowledge'
pull_request:
branches:
- dev
paths-ignore:
- 'data'
- 'gui'
- 'knowledge'
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-windows:
runs-on: windows-2019
steps:
- name: Checkout SEIMS
uses: actions/checkout@v3
- name: Start MongoDB Service
# How to start MongoDB as a service on Windows runners
# https://github.com/orgs/community/discussions/30083#discussioncomment-3448499
shell: pwsh
run: |
Set-Service mongodb -StartupType Automatic
Start-Service -Name mongodb
- name: Download mongo-c-driver
# Build mongo-c-driver is time-consuming, I moved it to another repo. https://github.com/crazyzlj/Github_Actions_Precompiled_Packages
# Here, I download the prebuilt library directly.
id: pwshdownmongo
shell: pwsh
run: |
cd ${{github.workspace}}\.github\workflows
./download_mongo-c-driver.ps1 -mongoCPath ${{github.workspace}}\mongolib
Get-ChildItem Env: | Where-Object {$_.Name -Match "^MONGO"} | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV }
- name: Download GDAL
id: pwshdowngdal
shell: pwsh
run: |
cd ${{github.workspace}}\.github\workflows
./download_gdal.ps1 -gdalPath ${{github.workspace}}\gdallib
Get-ChildItem Env: | Where-Object {$_.Name -Match "^GDAL"} | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV }
- name: Setup MSMPI
uses: mpi4py/setup-mpi@v1
with:
mpi: msmpi
- name: Configure CMake
shell: cmd
run: |
cmake -G "Visual Studio 16 2019" -A x64 -B ${{github.workspace}}/build ^
-DGDAL_ROOT=${{env.GDAL_ROOT}} ^
-DMONGOC_ROOT=${{env.MONGOC_ROOT}} ^
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build and Install SEIMS
shell: cmd
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- /m:4
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('seims/pyseims_env.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pyseims
environment-file: seims/pyseims_env.yml
auto-activate-base: false
auto-update-conda: true
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Run SEIMS on demo data
shell: cmd /C CALL {0}
run: |
cd seims
python pyseims_check.py
REM
REM I currently commented out the test command because the unsolved timeout
REM error when running GitHub Actions caused by matplotlib:
REM
REM "Matplotlib is building the font cache; this may take a moment."
REM
REM cd test
REM python demo_preprocess.py -name youwuzhen
REM python demo_runmodel.py -name youwuzhen
REM python demo_postprocess.py -name youwuzhen
REM python -m scoop -n 2 demo_parameters_sensitivity.py -name youwuzhen
REM python -m scoop -n 2 demo_calibration.py -name youwuzhen
REM python -m scoop -n 2 demo_scenario_analysis.py -name youwuzhen