Update submodule #1591
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: Windows | |
on: | |
push: | |
branches: [ main, ci-sandbox ] | |
pull_request: | |
branches: [ '**' ] | |
env: | |
MKL_URL: "https://data.statmt.org/romang/marian-regression-tests/ci/mkl-2020.1-windows-static.zip" | |
CCACHE_BASEDIR: "${{ github.workspace }}" | |
CCACHE_DIR: "${{ github.workspace }}\\ccache" | |
CCACHE_COMPILERCHECK: content | |
CCACHE_COMPRESS: 'true' | |
CCACHE_COMPRESSLEVEL: 9 | |
CCACHE_MAXSIZE: 200M | |
ccache_version: '4.5' | |
jobs: | |
build-windows: | |
strategy: | |
matrix: | |
include: | |
# Windows CPU-only build | |
- name: "Windows CPU-only" | |
identifier: "windows-x64" | |
runs-on: windows-2019 | |
name: ${{ matrix.name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Download ccache | |
shell: cmake -P {0} | |
run: | | |
set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v${{ env.ccache_version }}/${{ runner.os }}.tar.xz") | |
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz) | |
if(ret AND NOT ret EQUAL 0) | |
message( FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Generate ccache_vars for ccache based on machine | |
shell: cmake -P {0} | |
id: ccache_vars | |
run: |- | |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) | |
message("::set-output name=timestamp::${current_date}") | |
message("::set-output name=hash::${{ env.ccache_compilercheck }}") | |
- name: Cache-op for build-cache through ccache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }} | |
restore-keys: |- | |
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }} | |
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }} | |
ccache-${{ matrix.identifier }} | |
- name: ccache prolog | |
run: |- | |
${{github.workspace}}\ccache.exe -sv # Print current cache stats | |
${{github.workspace}}\ccache.exe -z # Print current cache stats | |
- name: Download MKL | |
run: | | |
# Wget retries downloading files and is faster than Invoke-WebRequest | |
C:\msys64\usr\bin\wget.exe -nv ${{ env.MKL_URL }} -O mkl.zip | |
Expand-Archive -Force mkl.zip ${{ github.workspace }}\mkl | |
# Set MKLROOT environment variable so that CMake can find MKL | |
echo "MKLROOT=${{ github.workspace }}\mkl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
shell: powershell | |
- name: Disable debug vcpkg build | |
shell: powershell | |
working-directory: C:\vcpkg\triplets | |
run: | | |
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' # Powershell murders me. | |
echo "set(VCPKG_BUILD_TYPE release)" | Tee-Object -FilePath x64-windows-static.cmake -Append | |
echo "set(VCPKG_BUILD_TYPE release)" | Tee-Object -FilePath x64-windows.cmake -Append | |
cat x64-windows-static.cmake | |
cat x64-windows.cmake | |
- name: Install dependencies with vcpkg | |
working-directory: C:\vcpkg | |
run: | | |
$Env:VCPKG_BUILD_TYPE = 'release' | |
$Env:VCPKG_DEFAULT_TRIPLET = 'x64-windows-static' # QT6 version, linguist tools not working yet: qtbase:x64-windows-static qttools:x64-windows-static qtsvg:x64-windows-static | |
.\vcpkg install protobuf:x64-windows-static pcre2:x64-windows-static | |
.\vcpkg upgrade --no-dry-run # In case there are new builds available after cache restoration | |
shell: powershell | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure | |
working-directory: ${{github.workspace}}/build #@TODO figure out how variables are accessed from power shell, as they seem to not be read. | |
run: | | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_STATIC_LIBS=ON -DVCPKG_TARGET_TRIPLET='x64-windows-static' ` | |
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ` | |
-DCMAKE_CXX_COMPILER_LAUNCHER=${{github.workspace}}\ccache.exe ` | |
-DCMAKE_C_COMPILER_LAUNCHER=${{github.workspace}}\ccache.exe | |
shell: powershell | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
run: cmake --build . --config Release -j3 | |
shell: powershell | |
- name: Print versions | |
working-directory: ${{github.workspace}}/build | |
run: | | |
.\app\Release\bergamot.exe --version | |
shell: cmd | |
- name: ccache epilog | |
run: |- | |
${{github.workspace}}\\ccache.exe -sv # Print current cache stats |