Attempt at adding windows-based Github Action CI #1
Workflow file for this run
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: NetCDF-C CMake CI - Windows | |
on: [pull_request, workflow_dispatch] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
cmake_build_and_teset: | |
strategy: | |
matrix: | |
name: | |
- "Windows MSVC" | |
hdf5: | |
- "1.14.3" | |
# Visual Studio + CMake | |
include: | |
- name: "Windows MSVC" | |
os: windows-latest | |
generator: "-G \"Visual Studio 17 2022\"" | |
name: "${{ matrix.name }}" | |
runs-on: ${{ matrix.os }} | |
# Each step in the job. | |
steps: | |
- name: Dump Matrix Context | |
run: echo '${{ toJSON(matrix) }}' | |
- name: Set environment for MSVC (Windows) | |
run: | | |
# Set these environment variables so CMake picks the correct compiler | |
echo "CXX=cl.exe" >> $GITHUB_ENV | |
echo "CC=cl.exe" >> $GITHUB_ENV | |
if: matrix.os == 'windows-latest' | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Get Sources | |
uses: actions/[email protected] | |
# Grab miniconda and use it to install HDF5 | |
#- name: Install Miniconda | |
# uses: conda-incubator/setup-miniconda@v3 | |
# with: | |
# miniconda-version: "latest" | |
# activate-environment: base | |
# Install HDF5 | |
- name: Install HDF5 | |
run: | | |
set -x | |
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-$(echo ${{ matrix.hdf5 }} | cut -d. -f 1,2)/hdf5-${{ matrix.hdf5 }}/src/hdf5-${{ matrix.hdf5 }}.tar.bz2 | |
tar -jxf hdf5-${{ matrix.hdf5 }}.tar.bz2 | |
pushd hdf5-${{ matrix.hdf5 }} | |
mkdir build | |
pushd build | |
cmake .. -DCMAKE_INSTALL_PREFIX=${HOME}/environments/${{ matrix.hdf5 }} | |
cmake --build . --config Release -j 4 | |
cmake --build . --config Release --target install -j 4 |