diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 770efe40..4ac11926 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -9,8 +9,11 @@ jobs: # Don't cancel the macOS build if the Linux build fails, etc. fail-fast: false matrix: - os: [ubuntu-20.04, macos-11] + os: [ubuntu-20.04, macos-11, windows-2019] use-asan: [YES, NO] + exclude: + - os: windows-2019 + use-asan: YES env: # Expose to the build-*.sh in an environment variable USE_ASAN: ${{ matrix.use-asan }} @@ -19,6 +22,11 @@ jobs: with: submodules: 'recursive' + # https://github.com/ilammy/msvc-dev-cmd + - name: Setup MSVC environment + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + - name: Linux Build if: runner.os == 'Linux' run: | @@ -31,3 +39,45 @@ jobs: if: runner.os == 'macOS' run: | ./build-osx.sh + + - name: Windows Build + if: runner.os == 'Windows' + run: | + .\build-windows.ps1 + + # Upload artifacts. + # These need to be separate, otherwise all of the artifacts are bundled into + # one .zip file. + + - name: Upload win64 artifact + uses: actions/upload-artifact@v3 + if: ${{ runner.os == 'Windows' && matrix.use-asan == 'NO' }} + with: + path: | + build-windows/ericw-tools-*.zip + + - name: Upload Linux artifact + uses: actions/upload-artifact@v3 + if: ${{ runner.os == 'Linux' && matrix.use-asan == 'NO' }} + with: + path: | + build-linux/ericw-tools-*.zip + + - name: Upload macOS artifact + uses: actions/upload-artifact@v3 + if: ${{ runner.os == 'macOS' && matrix.use-asan == 'NO' }} + with: + path: | + build-osx/ericw-tools-*.zip + + - name: Create GitHub Release and upload builds + uses: softprops/action-gh-release@v1 + if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.use-asan == 'NO' }} + with: + draft: true + files: | + build-osx/ericw-tools-*.zip + build-linux/ericw-tools-*.zip + build-windows/ericw-tools-*.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build-windows.ps1 b/build-windows.ps1 new file mode 100644 index 00000000..e7b48820 --- /dev/null +++ b/build-windows.ps1 @@ -0,0 +1,47 @@ +# Download embree and tbb +Invoke-WebRequest 'https://github.com/embree/embree/releases/download/v3.12.1/embree-3.12.1.x64.vc14.windows.zip' -OutFile 'embree64.zip' +7z x embree64.zip -oc:\ +Invoke-WebRequest 'https://github.com/oneapi-src/oneTBB/releases/download/v2020.2/tbb-2020.2-win.zip' -OutFile 'tbb.zip' +7z x tbb.zip -oc:\ + +git submodule update --init --recursive + +# Create and activate a Python virtual environment, and install sphinx (for building our documentation) +py -m venv ericwtools-env +Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser +ericwtools-env\Scripts\Activate.ps1 +python.exe -m pip install sphinx_rtd_theme + +# Confirm Sphinx is installed +get-command sphinx-build + +choco install ninja + +mkdir build-windows +cd build-windows + +cmake .. -GNinja -Dembree_DIR="C:\embree-3.12.1.x64.vc14.windows" -DTBB_DIR="C:\tbb\cmake" -DCMAKE_BUILD_TYPE=Release + +ninja +if ( $? -eq $false ) { + throw "build failed" +} + +cpack +if ( $? -eq $false ) { + throw "package failed" +} + +.\tests\Release\tests.exe + +if ( $? -eq $false ) { + throw "tests failed" +} + +# run hidden tests (releaseonly) +.\tests\Release\tests.exe [.] + +if ( $? -eq $false ) { + throw "tests [.] failed" +} +