summaryrefslogtreecommitdiffstats
path: root/src/pmdk/.github/workflows/gha.yml
blob: 402d4f878b46740bc03ae1d852e11a9295f52f67 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: PMDK
on: [push, pull_request]

env:
    GITHUB_REPO:    pmem/pmdk
    DOCKERHUB_REPO: pmem/pmdk

jobs:
  linux:
    name: Linux
    runs-on: ubuntu-latest
    env:
      DOCKERHUB_USER:          ${{ secrets.DOCKERHUB_USER }}
      DOCKERHUB_PASSWORD:      ${{ secrets.DOCKERHUB_PASSWORD }}
      DOC_UPDATE_GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }}
      HOST_WORKDIR:   /home/runner/work/pmdk/pmdk
      WORKDIR:        utils/docker
      PMDK_CC:        gcc
      PMDK_CXX:       g++
      MAKE_PKG:       0
      REMOTE_TESTS:   1
      VALGRIND:       1
      SRC_CHECKERS:   0
    strategy:
      matrix:
        CONFIG: ["N=1 OS=ubuntu OS_VER=19.10 FAULT_INJECTION=1 TEST_BUILD=debug",
                 "N=2 OS=ubuntu OS_VER=19.10 FAULT_INJECTION=1 TEST_BUILD=nondebug UBSAN=1",
                 "N=3 OS=ubuntu OS_VER=19.10 PMDK_CC=clang PMDK_CXX=clang++ TEST_BUILD=debug SRC_CHECKERS=1",
                 "N=4 OS=ubuntu OS_VER=19.10 PMDK_CC=clang PMDK_CXX=clang++ TEST_BUILD=nondebug",
                 "N=5 OS=fedora OS_VER=31    PMDK_CC=clang PMDK_CXX=clang++ TEST_BUILD=debug",
                 "N=6 OS=fedora OS_VER=31    PMDK_CC=clang PMDK_CXX=clang++ TEST_BUILD=nondebug AUTO_DOC_UPDATE=1",
                 "N=7 OS=fedora OS_VER=31    MAKE_PKG=1 EXPERIMENTAL=y REMOTE_TESTS=0 VALGRIND=0 PUSH_IMAGE=1",
                 "N=8 OS=ubuntu OS_VER=19.10 MAKE_PKG=1 EXPERIMENTAL=y REMOTE_TESTS=0 VALGRIND=0 NDCTL_ENABLE=n PUSH_IMAGE=1",
                 "N=9 OS=ubuntu OS_VER=19.10 MAKE_PKG=1 EXPERIMENTAL=y REMOTE_TESTS=0 VALGRIND=0 NDCTL_ENABLE=n PMDK_CC=clang PMDK_CXX=clang++",
                "N=10 OS=ubuntu OS_VER=19.10 COVERAGE=1 FAULT_INJECTION=1 TEST_BUILD=debug"]
    steps:
       - name: Clone the git repo
         uses: actions/checkout@v2
         with:
            fetch-depth: 50

       - name: Pull or rebuild the image
         run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh

       - name: Run the build
         run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build-CI.sh

       - name: Push the image
         run: cd $WORKDIR && source ./set-vars.sh && ${{ matrix.CONFIG }} /bin/bash -c "if [[ -f ${CI_FILE_PUSH_IMAGE_TO_REPO} ]]; then images/push-image.sh; fi"

  windows:
    name: Windows
    runs-on: windows-latest
    env:
      platform: x64
      solutionname: PMDK.sln
      ex_solutionname: Examples.sln
      msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin"
      # Platform Toolset for Visual Studio 2019
      platform_toolset: "v142"
      perl: "C:\\Strawberry\\perl\\bin"
    strategy:
      matrix:
        CONFIG: [Debug, Release]
    steps:
       - name: Update Path
         run: |
           echo "::add-path::$Env:msbuild"
           echo "::add-path::$Env:perl"

       - name: Clone the git repo
         uses: actions/checkout@v2

       - name: Unshallow it
         run: git fetch --prune --unshallow

       - name: Various debug checks (cstyle, whitespace etc.)
         run: |
           if ("${{ matrix.CONFIG }}" -eq "Release")
           {
              Install-Module PsScriptAnalyzer -Force
              utils/CSTYLE.ps1
              if ($LASTEXITCODE -ne 0) {
                 exit 1
              }
              utils/CHECK_WHITESPACE.ps1
              if ($LASTEXITCODE -ne 0) {
                 exit 1
              }
              utils/ps_analyze.ps1
              if ($LASTEXITCODE -ne 0) {
                 exit 1
              }
              perl utils/sort_solution check
              if ($LASTEXITCODE -ne 0) {
                 exit 1
              }
              ./utils/check_sdk_version.py -d .
              if ($LASTEXITCODE -ne 0) {
                 exit 1
              }
           }

       - name: Build
         run: |
           msbuild src\$Env:solutionname -property:Configuration=${{ matrix.CONFIG }},PlatformToolset=$Env:platform_toolset -m -v:m
           msbuild src\examples\$Env:ex_solutionname -property:Configuration=${{ matrix.CONFIG }},PlatformToolset=$Env:platform_toolset -m -v:m

       - name: Create ZIP archive
         run: utils/CREATE-ZIP.ps1 -b ${{ matrix.CONFIG }}

       - name: Run tests
         shell: powershell
         run: |
           if ($true) {
               cd src\test
               echo "`$Env:NON_PMEM_FS_DIR = `"C:\temp`"" >> testconfig.ps1
               echo "`$Env:PMEM_FS_DIR = `"C:\temp`"" >> testconfig.ps1
               echo "`$Env:PMEM_FS_DIR_FORCE_PMEM = `"1`"" >> testconfig.ps1
               echo "`$Env:PMDK_NO_ABORT_MSG = `"1`"" >> testconfig.ps1
               echo "`$Env:TM = `"1`"" >> testconfig.ps1
               write-output "config = {
                                       'unittest_log_level': 1,
                                       'cacheline_fs_dir': 'C:\\temp',
                                       'force_cacheline': True,
                                       'page_fs_dir': 'C:\\temp',
                                       'force_page': False,
                                       'byte_fs_dir': 'C:\\temp',
                                       'force_byte': True,
                                       'tm': True,
                                       'test_type': 'check',
                                       'granularity': 'all',
                                       'fs_dir_force_pmem': 1,
                                       'keep_going': False,
                                       'timeout': '4m',
                                       'build': 'debug',
                                       'force_enable': None,
                                       'fail_on_skip': False,
                                       'enable_admin_tests': False,
                                        }" | out-file "testconfig.py" -encoding utf8

               if ("${{ matrix.CONFIG }}" -eq "Debug") {
                   ./RUNTESTS.ps1 -b debug -o 4m
                   if ($?) {
                       python ./RUNTESTS.py -b debug
                   }
               }
               if ("${{ matrix.CONFIG }}" -eq "Release") {
                   ./RUNTESTS.ps1 -b nondebug -o 4m
                   if ($?) {
                       python ./RUNTESTS.py -b release
                   }
               }
           }