Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt at adding windows-based Github Action CI #2908

Closed
wants to merge 93 commits into from
Closed
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
7bce9a5
Attempt at adding windows-based Github Action CI
WardF Apr 9, 2024
0b41547
Specify bash shell.
WardF Apr 9, 2024
edfd81b
Replace wget with curl.
WardF Apr 9, 2024
43e90bf
Use miniconda to install dependencies.
WardF Apr 9, 2024
2256184
Correct syntax error.
WardF Apr 9, 2024
42984bf
Update conda working environment.
WardF Apr 9, 2024
88222a6
Adjust shell invocation for Windows test.
WardF Apr 9, 2024
795b1a0
Set base to always activate.
WardF Apr 9, 2024
991e870
Making progress, step forward and investigate the current environment.
WardF Apr 9, 2024
6a2e261
Attempt initial build.
WardF Apr 9, 2024
be5f150
Attempt to install m4 via pacman package manager.
WardF Apr 9, 2024
6d02348
Alternate approach to install m4.
WardF Apr 9, 2024
11d72bb
Set prefix path.
WardF Apr 9, 2024
a702a7e
Correct typo
WardF Apr 9, 2024
e51b374
Add diagnostic printline.
WardF Apr 9, 2024
9ad193d
A different approach to setting environmental variable.
WardF Apr 9, 2024
a0948d4
Querying environmental variable.
WardF Apr 9, 2024
f24f93a
Checking a syntax thing.
WardF Apr 9, 2024
855a687
Attempt more straightforward approach.
WardF Apr 9, 2024
40470f2
Progress. Add stanzas to build libnetcdf and then test suite.
WardF Apr 9, 2024
29377ce
Add libxml2 to install manifest.
WardF Apr 9, 2024
3c59493
Add cmake_c_flags.
WardF Apr 9, 2024
6b79207
Address strange error observed.
WardF Apr 9, 2024
80723fa
Correct basic mistake.
WardF Apr 9, 2024
7fe48c8
Add stanza to print out config.h in case of failure.
WardF Apr 9, 2024
0852e08
Trying something I shouldn't need to set manually.
WardF Apr 9, 2024
9224b80
Modifying previous fix.
WardF Apr 9, 2024
0986f01
Removing extraneous line.
WardF Apr 9, 2024
0cde4a4
Add another check to accomodate github actions.
WardF Apr 9, 2024
5d04300
Building appears to be working, add ctest stanza.
WardF Apr 9, 2024
18cfd74
Add a verbose-on-output failure stanza, update environmental variables.
WardF Apr 9, 2024
b82d0d0
Pass path as string.
WardF Apr 9, 2024
df61430
Correct path syntax error.
WardF Apr 9, 2024
596eff5
Correct path syntax error.
WardF Apr 9, 2024
cb2ef18
Diagnostic statement.
WardF Apr 9, 2024
2398205
Additional change to syntax.
WardF Apr 9, 2024
2d50595
Check path via print statement.
WardF Apr 10, 2024
0b1d609
Until we get tests working, removed 're-run on failure' stanza and se…
WardF Apr 10, 2024
584a7c7
Attempt to modify path.
WardF Apr 10, 2024
45fdb6f
Additional debugging, added path to GITHUB_ENV
WardF Apr 10, 2024
d37d6bf
Remove redundant path specification.
WardF Apr 10, 2024
53cdf4e
Attempt a different syntax, and try to brute force this. I'm pretty s…
WardF Apr 10, 2024
2eb0199
Ok. Back to first principles
WardF Apr 10, 2024
9790546
Noticing mixed path syntax on command line, not sure if that matters,…
WardF Apr 10, 2024
42838a9
Lets see a little more information about these failures.
WardF Apr 10, 2024
a328fb8
Add github path to run ctest stanza.
WardF Apr 10, 2024
91b37d5
Realized I missed a library location.
WardF Apr 10, 2024
a973bac
Test another path issue
WardF Apr 10, 2024
7b38d7b
Add missing terminator.
WardF Apr 10, 2024
2641e41
Try a different approach
WardF Apr 10, 2024
b1e56d9
Specify msys2 shell.
WardF Apr 10, 2024
fdb3aa1
Add neglected defaults entry.
WardF Apr 10, 2024
b8b5835
Add line to inspect bash_profile
WardF Apr 10, 2024
d4f3c38
Examine what the default .bash_profile looks like.
WardF Apr 10, 2024
a722795
Investigate strang error that has appeared.
WardF Apr 10, 2024
4bdd4a4
Investigate strang error that has appeared.
WardF Apr 10, 2024
d06d38f
Investigate strang error that has appeared.
WardF Apr 10, 2024
5a794d4
Investigate strang error that has appeared.
WardF Apr 10, 2024
c95f098
Remove stray quote.
WardF Apr 10, 2024
d9216e7
Clean up
WardF Apr 10, 2024
bb6f49a
Clean up
WardF Apr 10, 2024
3ba92b6
Correct syntax
WardF Apr 10, 2024
b991cd5
Fix error in conda.
WardF Apr 10, 2024
b146a94
Stepping changes back in.
WardF Apr 10, 2024
413b787
Double check something.
WardF Apr 10, 2024
cce033f
Doublecheck base .bash_profile
WardF Apr 10, 2024
3f27467
Doublecheck base .bash_profile
WardF Apr 10, 2024
ac05986
Add path to bash_profile.
WardF Apr 10, 2024
5d9315b
Test string munging with sed.
WardF Apr 10, 2024
eb35360
Removing false trailhead.
WardF Apr 10, 2024
ca8539a
Use GITHUB_WORKSPACE
WardF Apr 10, 2024
ccfcf0e
Attempt to create an installer package.
WardF Apr 10, 2024
e79f26b
Install dependencies into single directory.
WardF Apr 10, 2024
d61a2c5
Bump checkout and cache to v4
WardF Apr 10, 2024
6ad444a
Run all tests, not just the nc_test4 subset.
WardF Apr 10, 2024
c51ded4
Isolate test failures.
WardF Apr 10, 2024
243cda7
Make failed tests under Windows CI run in serial fashion.
WardF Apr 11, 2024
dc83236
Disable filter testing
WardF Apr 11, 2024
57c400b
Add verbose flag to run_nccopyz.sh
WardF Apr 12, 2024
f2c77aa
Add verbose flag to tst_bom.sh script.
WardF Apr 12, 2024
0f0468c
Move to msys2 shell from github bash shell.
WardF Apr 15, 2024
1eb6882
Using msys2 directly was worth a shot.
WardF Apr 15, 2024
26fbe6e
Restrict the testing to the current two failures.
WardF Apr 15, 2024
53ca392
Replace literal tab and carriage return with posix character class.
WardF Apr 15, 2024
2b13344
Try different shell.
WardF Apr 15, 2024
ae1d9e9
Escaping a single quote.
WardF Apr 15, 2024
80742bd
No content.
WardF Apr 15, 2024
de9112b
Try to work around tr error on Windows runner.
WardF Apr 15, 2024
1acab85
Remove test now passing, focus on bom test.
WardF Apr 17, 2024
963f6e4
Add debugging statement.
WardF Apr 17, 2024
18302cd
Remove stray line.
WardF Apr 17, 2024
a38d149
Try excluding bom test from Windows CI
WardF Apr 17, 2024
f18da85
Clean up script.
WardF Apr 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions .github/workflows/main-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
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_test:
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.
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
steps:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What compilers do you want to target with this CI? You should specify the compiler used via -DCMAKE_C_COMPILER (or preferably presets) to make sure the appropriate compilers are used.

For MSVC compilers, you would probably have to add uses: ilammy/msvc-dev-cmd@v1 and point the compiler to cl

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this will just be used with the Visual Studio compiler; I need to get a basic test in for Windows + Visual Studio. It will be expanded/revamped down the road, but I'd like to get this in for the v4.9.3 release we need to get out this week. Code compilation is running fine right now, the runtime errors being reported resolve to 'missing DLL', which suggests a pathing issue at runtime.

- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: ""
auto-activate-base: true

- name: Dump Matrix Context
run: echo '${{ toJSON(matrix) }}'

- run: echo "CMAKE_PREFIX_PATH=${env.CONDA_PREFIX}/Library" >> $GITHUB_ENV
- run: echo "PATH=${CONDA_PREFIX}/Library/lib:${PATH}" >> $GITHUB_ENV
Copy link

@LecrisUT LecrisUT Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path separator on windows is ;. Also Github actions doe not use the PATH in GITHUB_ENV. It uses GITHUB_PATH. Generally though all of these should be handled by a conda-setup action like miniconda. I would not recommend to reinvent the wheel for that, especially in the context of multi-os support.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I'm working in an MSYS2 shell, the guidance I'm finding seems to be that I should use : instead of ;.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, clearly something is wrong, so I'll take a look. My priority is to get something that works so that I can move on with the release process, replacing Appveyor, and refine it afterwards. Premature optimization, and all that.

- run: echo "CTEST_OUTPUT_ON_FAILURE=1" >> $GITHUB_ENV

# Grab miniconda and use it to install HDF5
- name: Install Dependencies using Miniconda
run: |
conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
conda config --add channels conda-forge
conda update conda
conda install hdf5=${{ matrix.hdf5 }} m2-m4 libxml2
shell: bash -el {0}

# Double-check something
- name: Check Miniconda
run: |
which h5dump
which m4
shell: bash -el {0}

# Check current directory
- name: Query Current Environment
run: |
ls
echo ""
echo "PATH: $PATH"
echo ""
env
echo ""
ls $CONDA_PREFIX/Library
echo ""
ls $CONDA_PREFIX/Library/include/
shell: bash -el {0}

- name: Perform out-of-directory configuration
shell: bash -el {0}
run: |
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}/Library" -DCMAKE_C_FLAGS="-I${CONDA_PREFIX}/Library/include"
if: ${{ success() }}

- name: View cache - configuration
shell: bash -el {0}
run: |
cd build
cmake -L .
if: ${{ success() }}

- name: Print Summary
shell: bash -l {0}
run: |
cd build
cat libnetcdf.settings

- name: Perform out-of-directory build - libnetcdf
shell: bash -el {0}
run: |
cd build
cmake --build . --config Release --target netcdf -j 4

- name: View config.h - libnetcdf failure
shell: bash -el {0}
run: |
cd build
cat config.h
if: ${{ failure() }}

- name: Perform out-of-directory build - test suite
shell: bash -el {0}
run: |
cd build
cmake --build . --config Release -j 4
if: ${{ success() }}

- name: View config.h - tests failure failure
shell: bash -el {0}
run: |
cd build
cat config.h
if: ${{ failure() }}

- name: Run ctest
shell: bash -el {0}
env:
PATH: ${CONDA_PREFIX}/Library/lib:${PATH}
run: |
echo "Path: ${PATH}"
cd build
ctest . -R nc_test -j 4

# - name: Verbose Output if CTest Failure
# shell: bash -el {0}
# run: |
# cd build
# ctest . -j 4 --rerun-failed --output-on-failure -VV
# if: ${{ failure() }}
2 changes: 1 addition & 1 deletion libdispatch/dmissing.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ strdup(const char* s)
#endif


#ifndef WIN32
#if !defined(_MSC_VER) && !defined(WIN32)

#ifndef HAVE_STRLCPY
/*
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/ncrandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
int
main() {
unsigned int urnd = 0; /* range 0..2147483647 */
#ifdef WIN32
#if defined(WIN32) || defined(_MSC_VER)
(void)rand_s(&urnd);
#else
long rnd;
Expand Down
Loading