summaryrefslogtreecommitdiffstats
path: root/.github/workflows/main.yml
blob: 5c38961801aea737b1735614a5769db4bfb14e1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: hdf5 dev CI

# Controls when the action will run. Triggers the workflow on push or pull request
on:
  push:
    branches: [ develop, hdf5_1_12, hdf5_1_10, hdf5_1_8 ]
  pull_request:
    branches: [ develop ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    strategy:
      fail-fast: false
      matrix:
        name: ["Windows Latest MSVC", "Ubuntu Latest GCC", "macOS Latest Clang"]
        include:
          - name: "Windows Latest MSVC"
            artifact: "Windows-MSVC.tar.xz"
            os: windows-latest
            build_type: "Release"
            toolchain: ""
            fortran: OFF
            generator: "-G \"Visual Studio 16 2019\" -A x64"
          - name: "Ubuntu Latest GCC"
            artifact: "Linux.tar.xz"
            os: ubuntu-latest
            build_type: "Release"
            fortran: OFF
            toolchain: "config/toolchain/GCC.cmake"
            generator: "-G Ninja"
          - name: "macOS Latest Clang"
            artifact: "macOS.tar.xz"
            os: macos-latest
            build_type: "Release"
            fortran: OFF
            toolchain: "config/toolchain/clang.cmake"
            generator: "-G Ninja"

    name: ${{ matrix.name }}
    # The type of runner that the job will run on
    runs-on: ${{ matrix.os }}
          
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    - name: Install Dependencies (Linux)
      run: sudo apt-get install ninja-build
      if: matrix.os == 'ubuntu-latest'
    - name: Install Dependencies (Windows)
      run: choco install ninja
      if: matrix.os == 'windows-latest'
    - name: Install Dependencies (macOS)
      run: brew install ninja
      if: matrix.os == 'macos-latest'
    - name: Set environment for MSVC (Windows)
      if:  matrix.os == 'windows-latest'
      run: |
        # Set these env vars so cmake picks the correct compiler
        echo "::set-env name=CXX::cl.exe"
        echo "::set-env name=CC::cl.exe"
    
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - name: Get Sources
      uses: actions/checkout@v2

    - name: Configure
      run: |
        mkdir "${{ runner.workspace }}/build"
        cd "${{ runner.workspace }}/build"
        cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} -DHDF5_BUILD_JAVA=ON $GITHUB_WORKSPACE
      shell: bash

    - name: Build
      run: cmake --build . --config ${{ matrix.build_type }}
      working-directory: ${{ runner.workspace }}/build      

    - name: Test
      run: ctest --build . -C ${{ matrix.build_type }} -V
      working-directory: ${{ runner.workspace }}/build