Build Windows #29
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: Build Windows | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Windows | |
uses: microsoft/[email protected] | |
- name: Restore artifacts, or run vcpkg, build (and cache artifacts as post step) | |
uses: lukka/run-vcpkg@v11 | |
id: runvcpkg | |
with: | |
vcpkgGitCommitId: 'acc3bcf76b84ae5041c86ab55fe138ae7b8255c7' | |
# There is a missing directory/file in Visual Studio 2022 vcpkg support | |
# A later update should fix this | |
# In the meantime, create the missing directory and download the missing file | |
- name: Fix vcpkg | |
shell: bash | |
run: | | |
mkdir "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/vcpkg/scripts/msys" | |
curl -L https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/cmake/compile_wrapper_consider_clang-cl.patch -o "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/vcpkg/scripts/msys/compile_wrapper_consider_clang-cl.patch" | |
- name: Setup devcmd to use cl.exe | |
uses: ilammy/[email protected] | |
- name: Configure sccache | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Create build directory | |
shell: bash | |
run: | | |
cmake --version | |
mkdir build | |
echo $VCPKG_ROOT/vcpkg list | |
# - name: Run CMake with vcpkg.json manifest | |
# uses: lukka/run-cmake@v10 | |
# with: | |
# configurePreset: msvc-sccache | |
# vcpkgJsonGlob: '${{ github.workspace }}/vcpkg.json' | |
- name: CMake Setup on Windows | |
shell: bash | |
working-directory: build | |
run: | | |
export UseMultiToolTask=true | |
cmake .. --preset msvc-sccache | |
# - name: CMake Setup on Windows | |
# uses: lukka/run-cmake@v10 | |
# with: | |
# configurePreset: 'msvc-sccache' | |
# # buildDirectory: '${{ github.workspace }}/build' | |
- name: Build | |
shell: bash | |
working-directory: build | |
continue-on-error: true | |
run: | | |
export UseMultiToolTask=true | |
cmake --build . --config Release | |
- name: Package | |
working-directory: build | |
continue-on-error: true | |
run: | | |
cpack -V --preset msvc | |
dir dist/* | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: wix.log | |
# # if: failure() | |
# path: build/dist/_CPack_Packages/win64/WIX/wix.log | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: installers | |
path: | | |
build/dist/*.msi | |
build/dist/*.zip | |
build/dist/*.exe | |
build/dist/*.nupkg | |
# - name: Install from build | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# cmake --build . --config Release --target install | |
# # - name: Clean build | |
# # working-directory: build | |
# # continue-on-error: true | |
# # run: | | |
# # cmake --build . --config Release --target clean | |
# # cmake . -DSRCML_TEST_INSTALLED=ON | |
# - name: Set PATH for Windows | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# echo "/c/Program Files/srcML/bin" >> $GITHUB_PATH | |
# - name: Run Installed srcml | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# EOL="\r\n" | |
# export PATH=$PATH:"/c/Program Files/srcML/bin" | |
# SRCML_HOME="/c/Program Files/srcML/bin" | |
# ls -lh "$SRCML_HOME" | |
# SRCML="$SRCML_HOME/srcml.exe" | |
# ls -lh "$SRCML" | |
# export MSYS2_ARG_CONV_EXCL="*" | |
# diff='diff -Z ' | |
# "$SRCML" --version | |
# "$SRCML" --text="int a;" -l C++ | |
# touch "a.cpp" | |
# "$SRCML" a.cpp | |
# echo "a;" >> a.cpp | |
# "$SRCML" a.cpp | |
# echo "b;" >> b.cpp | |
# "$SRCML" a.cpp b.cpp | |
# - name: Create build examples directory | |
# shell: bash | |
# continue-on-error: true | |
# run: | | |
# mkdir build2 | |
# - name: Build examples | |
# shell: bash | |
# working-directory: build2 | |
# continue-on-error: true | |
# run: | | |
# cmake "/c/Program Files/srcML/share/srcml/examples" -DsrcML_DIR="C:/Program Files/srcML/cmake" -G Ninja | |
# ninja | |
# - name: Run examples | |
# shell: bash | |
# working-directory: build2 | |
# continue-on-error: true | |
# run: | | |
# ls *.exe | |
# ./srcml_copy_archive.exe || echo $? | |
# ./srcml_create_archive_fd.exe || echo $? | |
# ./srcml_create_archive_file.exe || echo $? | |
# ./srcml_create_archive_filename.exe || echo $? | |
# ./srcml_create_archive_full.exe || echo $? | |
# ./srcml_direct_language.exe || echo $? | |
# ./srcml_direct_language_list.exe || echo $? | |
# ./srcml_direct_language_xml.exe || echo $? | |
# ./srcml_direct_src2srcml.exe || echo $? | |
# ./srcml_direct_srcml2src.exe || echo $? | |
# ./srcml_list.exe || echo $? | |
# ./srcml_read_archive_fd.exe || echo $? | |
# ./srcml_read_archive_file.exe || echo $? | |
# ./srcml_read_archive_filename.exe || echo $? | |
# ./srcml_read_archive_full.exe || echo $? | |
# ./srcml_read_archive_memory.exe || echo $? | |
# ./srcml_relaxng.exe || echo $? | |
# ./srcml_sort_archive.exe || echo $? | |
# ./srcml_split_archive.exe || echo $? | |
# ./srcml_transform.exe || echo $? | |
# ./srcml_xpath.exe || echo $? | |
# ./srcml_xslt.exe || echo $? | |
test-installer: | |
needs: build | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
installer: [msi, inno, nuget] | |
steps: | |
# Download the installer artifact | |
- name: Download installer | |
uses: actions/download-artifact@v3 | |
with: | |
name: installers | |
# - shell: bash | |
# continue-on-error: true | |
# run: | | |
# ls -lh | |
- name: Install package Wix msi | |
# continue-on-error: true | |
if: ${{ matrix.installer == 'msi' }} | |
run: msiexec /i srcml-1.0.0-windows-x86_64.msi /quiet /norestart /L*vx .\msi.log | |
- uses: actions/upload-artifact@v3 | |
if: ${{ matrix.installer == 'msi' }} | |
with: | |
name: msi.log | |
path: ./msi.log | |
- name: Install package Inno Setup | |
# continue-on-error: true | |
if: ${{ matrix.installer == 'inno' }} | |
run: | | |
dir | |
D:\a\srcML-1942\srcML-1942\srcml-1.0.0-windows-x86_64.exe /VERYSILENT | |
# - uses: actions/upload-artifact@v3 | |
# if: ${{ matrix.installer == 'msi' }} | |
# with: | |
# name: msi.log | |
# path: ./msi.log | |
- name: Install package Nuget | |
# continue-on-error: true | |
if: ${{ matrix.installer == 'nuget' }} | |
run: | | |
mkdir LocalNuGetFeed | |
nuget add srcml.1.0.0.nupkg -Source LocalNuGetFeed | |
nuget install srcml -Source D:\a\srcML-1942\srcML-1942\LocalNuGetFeed -OutputDirectory "C:\Program Files" | |
mv "C:\Program Files\srcml.1.0.0" "C:\Program Files\srcML" | |
# - uses: actions/upload-artifact@v3 | |
# if: ${{ matrix.installer == 'msi' }} | |
# with: | |
# name: msi.log | |
# path: ./msi.log | |
- name: Set PATH for Windows | |
shell: bash | |
continue-on-error: true | |
run: | | |
echo "/c/Program Files/srcML/bin" >> $GITHUB_PATH | |
echo "/c/Program Files/srcml.1.0.0/bin" >> $GITHUB_PATH | |
echo "/c/Program Files (x86)/srcML/bin" >> $GITHUB_PATH | |
- name: Run Installed srcml | |
shell: bash | |
continue-on-error: true | |
run: | | |
srcml --help | |
srcml --text="a;" -l C++ | |
# - name: Create build examples directory | |
# shell: bash | |
# continue-on-error: true | |
# run: | | |
# mkdir build3 | |
# - name: Build examples | |
# shell: bash | |
# working-directory: build3 | |
# continue-on-error: true | |
# run: | | |
# cmake "/c/Program Files/srcML/share/srcml/examples" -G Ninja | |
# ninja | |
# - name: Run examples | |
# shell: bash | |
# working-directory: build3 | |
# continue-on-error: true | |
# run: | | |
# ./srcml_copy_archive.exe || echo $? | |
# ./srcml_create_archive_fd.exe || echo $? | |
# ./srcml_create_archive_file.exe || echo $? | |
# ./srcml_create_archive_filename.exe || echo $? | |
# ./srcml_create_archive_full.exe || echo $? | |
# ./srcml_direct_language.exe || echo $? | |
# ./srcml_direct_language_list.exe || echo $? | |
# ./srcml_direct_language_xml.exe || echo $? | |
# ./srcml_direct_src2srcml.exe || echo $? | |
# ./srcml_direct_srcml2src.exe || echo $? | |
# ./srcml_list.exe || echo $? | |
# ./srcml_read_archive_fd.exe || echo $? | |
# ./srcml_read_archive_file.exe || echo $? | |
# ./srcml_read_archive_filename.exe || echo $? | |
# ./srcml_read_archive_full.exe || echo $? | |
# ./srcml_read_archive_memory.exe || echo $? | |
# ./srcml_relaxng.exe || echo $? | |
# ./srcml_sort_archive.exe || echo $? | |
# ./srcml_split_archive.exe || echo $? | |
# ./srcml_transform.exe || echo $? | |
# ./srcml_xpath.exe || echo $? | |
# ./srcml_xslt.exe || echo $? | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup msys2 with additional client-test packages for Windows | |
uses: msys2/setup-msys2@v2 | |
continue-on-error: true | |
with: | |
install: >- | |
zip | |
cpio | |
diffutils | |
util-linux | |
cmake | |
libxml2 | |
- name: Create build directory | |
shell: bash | |
run: | | |
mkdir build | |
- name: Build | |
shell: bash | |
working-directory: build | |
continue-on-error: true | |
run: | | |
export UseMultiToolTask=true | |
cmake ../test/client | |
- name: Windows Client Tests on Installed srcml | |
shell: msys2 {0} | |
working-directory: build | |
timeout-minutes: 10 | |
continue-on-error: true | |
run: | | |
export SRCML_HOME="/c/Program Files/srcML/bin" | |
ctest -C Release -VV | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ClientTest.windows-latest.log | |
path: build/Testing/Temporary/LastTest.log | |
# - name: Build libsrcml Tests | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# export UseMultiToolTask=true | |
# export PATH=$PATH:"/c/Program Files/srcML/bin/" | |
# echo "C:\Program Files\srcML\bin" >> $GITHUB_PATH | |
# SRCML_HOME="/c/Program Files/srcML/bin/" | |
# cmake . -DBUILD_LIBSRCML_TESTS=ON | |
# cmake --build . --config Release --target build_libsrcml_tests | |
# - name: Check dependents | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# dumpbin -dependents "/c/Program Files/srcML/bin/srcml.exe" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/archive.dll" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/libcurl.dll" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/libsrcml.dll" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/libxml2.dll" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/libexslt.dll" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/libxslt.dll" || true | |
# dumpbin -dependents "/c/Program Files/srcML/bin/iconv-2.dll" || true | |
# dumpbin -exports "/c/Program Files/srcML/bin/libsrcml.dll" || true | |
# - name: Run libsrcml Tests on Installed libsrcml | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# ctest -C Release -R ^test_ | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: libsrcmlTest.windows-latest.log | |
# path: build/Testing/Temporary/LastTest.log | |
# - name: Generate Parser Tests | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# export PATH=$PATH:"/c/Program Files/srcML/bin/" | |
# ls -lh "/c/Program Files/srcML/bin/" | |
# echo "C:\Program Files\srcML\bin" >> $GITHUB_PATH | |
# cmake . -DBUILD_PARSER_TESTS=ON | |
# cmake --build . --config Release --target gen_parser_tests | |
# - name: Run Parser Tests | |
# shell: bash | |
# working-directory: build | |
# continue-on-error: true | |
# run: | | |
# srcml --parser-test test/parser/testsuite | tee ParserTest.log | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: ParserTest.windows-latest.log | |
# path: build/ParserTest.log |